0

I've got a home server with music files stored locally on said server.

I've got MPD & ncmpcpp installed on this home server.

I'm trying to prototype this so I can go the extra trivial step of forwarding ports so this can be accessed anywhere, but I'm having quite a bit of trouble even getting this to work locally. I'm working on a remote machine, but all the work I've done this morning has been in a remote shell inside the home server...

I've killed and disabled the daemon for mpd, and started it like so: mpd --stdout --no-daemon --verbose ~/.config/mpd/mpd.conf and gotten this output:

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

The port appears to be doing something, or at least ready to do something for MPD:

~ ➭ sudo netstat -lnp | sudo grep 8002
tcp        0      0 127.0.0.1:8002          0.0.0.0:*               LISTEN      21596/mpd     

However, when I run ncmpcpp (from within the same machine that is running MPD, the home server....remember, I'm ssh'ed in), I get the following complaint:

ncmpcpp: Failed to resolve host name

I've got the following ~/.config/mpd/mpd.conf file:

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.
}

`

I've got this in my ~/.ncmpcpp/config file:

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"

Any ideas which property(ies) I've misconfigured?

Thanks

3
  • 1
    If in your ncmpcpp config, you set mpd_host to just the host (127.0.0.1), without the port, does that work?
    – derobert
    Commented Jan 31, 2017 at 18:09
  • Ah, that's interesting...OK, that yields ncmpcpp: Connection closed by the server. That's progress...In that, it's a different error. Commented Jan 31, 2017 at 19:17
  • Different error, yes. Now I see you've got mpd listening on 6601 (at least according to the config file), but ncmpcpp connecting on 8002. I bet it'll work if you change them to match.
    – derobert
    Commented Jan 31, 2017 at 22:52

1 Answer 1

0

You're misunderstanding what the ports you've configured are used for.

6601 ("port" in your MPD config file) is used by applications that intend to speak the MPD protocol with MPD - that is, applications that control playback, the music database etc.

8002, ("port" in the "audio_output" section in your MPD config file) is the port on which MPD emits a vorbis audio stream over HTTP.

Since ncmpcpp is a client for controlling MPD, not for listening to the audio stream emitted by it, you need to configure ncmpcpp to connect on port 6601 (in the mpd_port setting).

2
  • OK, if that works, how do I route audio to my local mpd instance via the server's mpd HTTP output? I'll control the remote instance of mpd with ncmpcpp if the server's mpd will feed my local mpd Commented Feb 1, 2017 at 18:20
  • You can add that like any other HTTP stream. Either press 'A' in an ncmpcpp connected to your local mpd instance and then paste the URL or manually via the add command in from the MPD protocol.
    – Wieland
    Commented Feb 1, 2017 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .