我正在尝试将本地文件添加到 mpd(通过 mpc)并播放它。我的平台是 OpenWRT 嵌入式 linux。
因此,在手册页中,它指出:
mpc add <file> Add a song to the current playlist
如果我这样做:
root@OpenWrt:~/.mpd# mpc add /usr/share/baresip/ring.wav
error adding /usr/share/baresip/ring.wav: directory or file not found
或者如果我这样做:
root@OpenWrt:~/.mpd# mpc add file:///usr/share/baresip/ring.wav
error adding file:///usr/share/baresip/ring.wav: Access denied
这里正确的语法到底是什么?手册页对于 mpc/mpd 确实不是很清楚。
最佳答案
您的第二次尝试几乎是正确的。您遇到的问题是 mpd
只允许通过本地连接将 file:
URL 传递给它,它通过要求您在其 上进行连接来强制执行unix 域套接字。所以,在您的 mpd.conf
中,您需要有这样一行:
bind_to_address "/run/mpd/socket"
(根据您的系统,您可能希望将 /run
更改为 /var/run
-- 我引用的版本对于最新版本的 debian 或 ubuntu 是正确的,但是其他人可能不同)。
然后,您需要设置您的环境以指向该套接字:
export MPD_HOST=/run/mpd/socket
当你这样做时,mpc add
或 mpc insert
可以成功地接受一个 file:
URL:
$ mpc insert "file:///data/incoming/files/111_scorpions_-_the_zoo.mp3"
$ mpc next
Scorpions - The Zoo
[playing] #23/39 0:00/5:30 (0%)
volume: n/a repeat: off random: off single: off consume: off
$
关于linux - Linux 上的 mpc/mpd : how to play local wav file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15659067/