Jul 1

由于拜服于mpd的轻巧和简单,决心安装这个linux下最好用的音乐播放器。

(现在已经可以支持ape了)

在ubuntu安装很简单:

 

sudo apt-get install mpd mpc sonata

 

 

sonata是一个同样简洁的前端,配合mpd使用

但是使用过程中却遇到了一些麻烦,首先是

 

更改了端口一样没有效果,烦躁中卸载了mpd打算重新编译,

但发现源码编译还要自己安装库如libcue等,于是放弃。

重新安装是出现:

 

正在设置 mpd (0.14.2-3ubuntu2) ...
 * Starting Music Player Daemon mpd                                             problem opening log file "/home/jack/音乐/mpd/mpd.log" (config line 11) for writing
Aborted
                                                                         [fail]
invoke-rc.d: initscript mpd, action "start" failed.
dpkg:处理 mpd (--configure)时出错:
 子进程 post-installation script 返回了错误号 134
正在处理用于 libc6 的触发器...
ldconfig deferred processing now taking place
在处理时有错误发生:
 mpd
E: Sub-process /usr/bin/dpkg returned an error code (1)

 


 

解决办法是:

sudo rm /var/lib/dpkg/info/mpd.postinst
sudo apt-get --reinstall install mpd

 

 

回到上面的端口占用问题,解决办法是编辑/etc/hosts文件,

去掉里面的ipv6支持如下:

 

# The following lines are desirable for IPv6 capable hosts
#::1     localhost ip6-localhost ip6-loopback
#fe00::0 ip6-localnet
#ff00::0 ip6-mcastprefix
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters
#ff02::3 ip6-allhosts

这样就可以修改~/.mpdconf文件来配置mpd了,我的.mpdconf部分如下:

 


######################## REQUIRED PATHS ########################
# You can put symlinks in here, if you like. Make sure that
# the user that mpd runs as (see the 'user' config parameter)
# can read the files in this directory.
music_directory  "/home/jack/音乐"
playlist_directory      "/home/jack/音乐/mpd/playlists"
db_file   "/home/jack/音乐/mpd/tag_cache"
log_file                "/home/jack/音乐/mpd/mpd.log"
error_file            "/home/jack/音乐/mpd/errors.log"
################################################################


######################## OPTIONAL PATHS ########################
#
# If you wish to use mpd --kill to stop MPD, then you must
# specify a file here in which to store MPD's process ID.
#
pid_file                "/home/jack/音乐/mpd/pid"
#
# If specified, MPD will save its current state (playlist,
# current song, playing/paused, etc.) at exit.  This will be
# used to restore the session the next time it is run.
#
state_file            "/home/jack/音乐/mpd/state"
#
################################################################


######################## DAEMON OPTIONS ########################
#
# If started as root, MPD will drop root privileges and run as
# this user instead.  Otherwise, MPD will run as the user it was
# started by.  If left unspecified, MPD will not drop root
# privileges at all (not recommended).
#
user                            "mpd"
#
# The address and port to listen on.
#
#bind_to_address                 "127.0.0.1"
bind_to_address                 "localhost"
port                            "6600"
#
# If the address is a path, then a UNIX domain socket will be
# created instead of listening on a TCP port.
#
#bind_to_address                 "/var/run/mpd/sock"
#
# Controls the amount of information that is logged.  Can be
# "default", "secure", or "verbose".
#
#log_level                       "default"
#
################################################################

########################## AUDIO OUTPUT ########################
#
audio_output {
        type       "pulse"
        name       "My MPD PulseAudio Output"
}

################################################################

###################### CHARACTER ENCODINGS #####################
#
# If file or directory names do not display correctly, then you
# may need to change this.  In most cases it should be either
# "ISO-8859-1" or "UTF-8".  You must recreate your database
# after changing this (use mpd --create-db).
#
filesystem_charset              "UTF-8"
#
# The encoding that ID3v1 tags should be converted from.
#
id3v1_encoding                  "GBK"
#
################################################################


 

 

 

接下来就可以使用

 

sduo mpd --create-db

 

来更新数据库了,还是有问题

 

Can't open db file "/home/jack/音乐/mpd/tag_cache" for reading/writing: Permission denied

 

 

去掉sudo出现

 

cannot setgid for user "mpd" at line 39: Operation not permitted
忽略
 

 

 

应该是权限问题,解决方法;

 

sudo chmod 0777 -R /home/jack/音乐/

 ps:后来发现有些目录无法加载,也同样是权限问题,解决方法同上

 

接下来更新数据库没问题了

 

sudo mpd

 

 

 

打开sonata或gmpc好好享受听歌的乐趣吧,其余的乱码及歌词支持接下来在解决。