我有一个家庭服务器,音乐文件本地存储在该服务器上。
我已经在此家庭服务器上安装了 MPD 和 ncmpcpp。
我正在尝试对此进行原型设计,以便我可以执行转发端口的额外琐碎步骤,以便可以在任何地方访问它,但即使让它在本地工作,我也遇到了很多麻烦。我正在远程计算机上工作,但是我今天早上所做的所有工作都是在远程 shell 中进行的里面家庭服务器...
我已经杀死并禁用了 mpd 的守护进程,然后像这样启动它:
mpd --stdout --no-daemon --verbose ~/.config/mpd/mpd.conf
并得到以下输出:
config_file: loading file .config/mpd/mpd.conf
path: SetFSCharset: fs charset is:
libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
vorbis: Xiph.Org libVorbis 1.3.5
opus: libopus 1.1.4
sndfile: libsndfile-1.0.27
simple_db: reading DB
curl: version 7.52.1
curl: with OpenSSL/1.0.2k
avahi: Initializing interface
avahi: Client changed to state 101
avahi: Client is CONNECTING
state_file: Loading state file /home/dale/.config/mpd/state
该端口似乎正在做一些事情,或者至少准备好为 MPD 做一些事情:
~ ➭ sudo netstat -lnp | sudo grep 8002
tcp 0 0 127.0.0.1:8002 0.0.0.0:* LISTEN 21596/mpd
然而,当我运行 ncmpcpp (从运行 MPD 的同一台机器,即家庭服务器......记住,我是通过 ssh 进入的)时,我收到以下投诉:
ncmpcpp: Failed to resolve host name
我有以下~/.config/mpd/mpd.conf
文件:
music_directory "/mnt/media/Music"
playlist_directory "~/.config/mpd/playlists"
db_file "~/.config/mpd/database"
log_file "~/.config/mpd/log"
pid_file "~/.config/mpd/pid"
state_file "~/.config/mpd/state"
sticker_file "~/.config/mpd/sticker.sql"
#mixer_type "software"
#█▓▒░ opts
bind_to_address "127.0.0.1"
port "6601"
log_level "default"
gapless_mp3_playback "yes"
filesystem_charset "UTF-8"
#█▓▒░ io
input {
plugin "curl"
}
audio_output {
type "alsa"
name "My ALSA Device"
device "hw:0,0" # optional
mixer_type "hardware" # optional
mixer_device "default" # optional
mixer_control "PCM" # optional
mixer_index "0" # optional
}
#audio_output {
# type "alsa"
# name "audio"
#}
audio_output {
type "fifo"
name "visualizer"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
audio_output {
type "httpd"
name "My HTTP Stream"
encoder "vorbis" # optional
bind_to_address "127.0.0.1"
port "8002"
# quality "5.0" # do not define if bitrate is defined
bitrate "128" # do not define if quality is defined
format "44100:16:1"
always_on "yes" # prevent MPD from disconnecting all listeners when playback is stopped.
tags "yes" # httpd supports sending tags to listening streams.
}
`
我的文件中有这个~/.ncmpcpp/config
:
ncmpcpp_directory = "~/.ncmpcpp"
#lyrics_directory = "~/.lyrics"
external_editor = "/usr/bin/vim"
# █▓▒░ MPD Settings
mpd_crossfade_time = "3"
mpd_music_dir = "/mnt/media/Music"
mpd_host = "127.0.0.1:8002"
mpd_port = "8002"
有什么想法我配置错误了哪些属性吗?
谢谢
答案1
您误解了您配置的端口的用途。
6601(MPD 配置文件中的“端口”)由打算说话的应用程序使用MPD协议MPD - 即控制播放、音乐数据库等的应用程序。
8002(MPD 配置文件中“audio_output”部分中的“端口”)是 MPD 通过 HTTP 发出 vorbis 音频流的端口。
由于 ncmpcpp 是控制MPD,不适合倾听对于它发出的音频流,您需要配置 ncmpcpp 连接到端口 6601(在设置中mpd_port
)。