Jump to content

MPD/ncmpcpp Could not connect to MPD Connection refused


ichase

Recommended Posts

Josh and Fran introduced me to ncmpcpp. As a suggestion, I installed these 2 packages on the headless server. I have been doing a lot of reading and up to this point I have configured ~/.ncmpcpp/config and /etc/mpd.conf I also created all the necessary directories that I read about

touch /home/ichase/.mpd/{database,log,pid,state} 

 

Using Gnuscreen I wanted to have a shell for MPD and added it

/etc/screenrc

screen -M -t shell 1 ssh -p 5555 ichase@192.168.0.10
screen -t weechat 2 weechat-curses
screen -t mpd	 3 ncmpcpp
screen -t htop	 4 htop
screen -t atop	 5 atop
screen -t mc	 6 mc
#select 0

altscreen on
term screen-256color
bindkey -k k7 next # F9
bindkey -k k9 prev # F8

hardstatus off
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%=$
#hardstatus alwayslastline
#hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%$
startup_message off

First off and this is more or less a gnuscreen issue, the tab for MPD and Midnight Commander do not display but will get to that at a later time

 

This is my mpd.conf file under /etc/mpd.conf

port				 "6600"
music_directory		 "/home/storage/Music/"
playlist_directory	 "/home/ichase/.mpd/playlists"
db_file				 "/home/ichase/.mpd/database"
log_file			 "/home/ichase/.mpd/log"
pid_file			 "/home/ichase/.mpd/pid"
state_file			 "/home/ichase/.mpd/state"
audio_buffer_size	 "4096"
#user				 "ichase"
mixer_type			 "software"
#bind_to_address	 "0.0.0.0"
#bind_to_address	 "127.0.0.1"
bind_to_address		 "localhost"
audio_output {
 type				 "pulse"
 name				 "pulse audio"
 format				 "48000:32:2"
}
samplerate_converter "0"
#audio_output_format				 "44100:16:2"

 

All of my music is in the /home/storage/Music folder. All the music (about 100GB) is chronicalized by genre's in their own folders. This is all on an additional 500 GB hard drive that I have mounted to /home/storage

 

Here is my config file for ncmpcpp located at ~/.ncmpcpp/config

####################################################
## this is example configuration file, copy it to ##
## ~/.ncmpcpp/config and set up your preferences ##
####################################################
#
##### connection settings #####
#
## set it in order to make tag editor and renaming files work properly
#
mpd_host = "127.0.0.1"
#
mpd_port = "6600"
#
mpd_music_dir = "/home/storage/Music/"

mpd_connection_timeout = "5"

mpd_crossfade_time = "5"
#
##### delays #####
#
## delay after playlist highlighting will be disabled (0 = don't disable)
#
playlist_disable_highlight_delay = "0"
#
## defines how long various messages are supposed to be visible
#
#message_delay_time = "4"
#
##### song format #####
##
## for song format you can use:
##
## %l - length
## %f - short filename
## %F - full filename
## %a - artist
## %t - title
## %b - album
## %y - year
## %n - track number
## %g - genre
## %c - composer
## %p - performer
## %d - disc
## %C - comment
## %r - begin right align
##
## you can also put them in { } and then it will be displayed
## only if all requested values are available and/or define alternate
## value with { }|{ } eg. {%a - %t}|{%f}
##
## text can also have different color than the main window has,
## eg. if you want length to be green, write $3%l$9
##
## available values:
##
## - 0 - default window color
## - 1 - black
## - 2 - red
## - 4 - green
## - 4 - yellow
## - 5 - blue
## - 6 - magenta
## - 7 - cyan
## - 8 - white
## - 9 - end of current color
##
## Note: colors can be nested.
##

song_list_format = "{$8(%l)$9 }{%a - }{%t}|{$8%f$9}"

song_library_format = "{%n - }{%t}|{%f}"

media_library_album_format = "{(%y) }%b"

tag_editor_album_format = "{(%y) }%b"

browser_playlist_prefix = "$7playlist$9 "

selected_item_prefix = "$8"

selected_item_suffix = "$9"
#
## colors are not supported for below veriables
#
#song_status_format = "{(%l) }{%a - }{%t}|{%f}"
#
#song_window_title_format = "{%a - }{%t}|{%f}"
#
##### columns settings #####
##
## syntax of song columns list format is "column column etc."
##
## - syntax for each column is:
##
## (width of column in %)[column's color]{displayed tag}
##
## - color is optional (if you want the default one, type [])
##
#
song_columns_list_format = "(6)[white]{l} (15)[blue]{a} (35)[white]{b} (53)[blue]{t}"
#
##### various settings #####
#
playlist_display_mode = "columns"
#
browser_display_mode = "columns"
#
#search_engine_display_mode = "classic" (classic/columns)
#
incremental_seeking = "yes"
#
#seek_time = "1"
#
autocenter_mode = "yes"
#
#repeat_one_mode = "no"
#
#default_place_to_search_in = "database" (database/playlist)
#
#media_library_left_column = "a" (possible values: a,y,g,c,p, legend above)
#
#default_find_mode = "wrapped" (wrapped/normal)
#
#default_space_mode = "add" (add/select)
#
#default_tag_editor_left_col = "albums" (albums/dirs)
#
#default_tag_editor_pattern = "%n - %t"
#
header_visibility = "yes"
#
statusbar_visibility = "yes"
#
fancy_scrolling = "yes"
#
follow_now_playing_lyrics = "yes"
#
#ncmpc_like_songs_adding = "no" (enabled - add/remove, disabled - always add)
#
display_screens_numbers_on_start = "yes"
#
#clock_display_seconds = "no"
#
##
## Note: If below is enabled, ncmpcpp will ignore leading
## "The" word while sorting items in browser, tags in
## media library, etc.
##
ignore_leading_the = "yes"
#
#enable_window_title = "yes"
#
##### lyrics support #####
##
## supported lyrics databases:
##
## - 1 - lyricwiki.org
## - 2 - lyricsplugin.com
##
#
lyrics_database = "1"
#
##### colors definitions #####
#
colors_enabled = "yes"
#
empty_tag_color = "white"
#
header_window_color = "white"
#
volume_color = "white"
#
state_line_color = "blue"
#
state_flags_color = "blue"
#
main_window_color = "blue"
#
color1 = "blue"
#
color2 = "cyan"
#
main_window_highlight_color = "white"
#
progressbar_color = "blue"
#
statusbar_color = "white"
#
active_column_color = "white"
#
window_border_color = "white"
#
active_window_border = "magenta"
#

I then attempt to launch ncmpcpp and get the following

[ichase@homeserver ~]$ ncmpcpp
Couldn't connect to MPD (host = localhost, port = 6600): Connection refused

I read the wiki, along with another thread on the arch forums and can't seem to find my answer

 

I know Josh and Fran are up and running with ncmpcpp and even streaming audio from the internet.

 

I am obviously doing something wrong but can't seem to figure out what

 

Thanks as always in advance,

 

Ian

Edited by ichase
Link to comment
Share on other sites

Guest LilBambi

There is a special directory under /usr/lib/mpd/music -- From what JL said, that is the folder it expects to see music. Jim created shortcuts/soft links to files he wanted in there - within that expected structure.

 

I just copied the files I wanted to the structure they are expecting. Then I did an mpc update so it would find all and add to the it's database. Then ncmpcpp will find what I put in there, or JL linked to.

 

Maybe it only does songs that are added, not folders? I have not added folders; just songs. And JL has added only song softlinks.

Link to comment
Share on other sites

Thanks Fran, that is above and beyond my relm of expertise, hense the reason it's still not up and running yet. LOL

I have deadbeef and smplayer so I can always listen to music that way. Just liked the idea of having multiple tabs with gnuscreen while ssh'd into my headless server that does not have a GUI. Not that I am trying to be like Josh, I like that concept he introduced to me and wanted to learn how to do it on my end. :)

 

Maybe if I break down my setup, what I am trying to do might make more sense.

I have a headless server upstairs. It has 2 hard drives

sda1 20 GB, holds Arch Linux with no gui, my SAMBA config files and CUPS config files reside there

sda2 is a 500 GB HDD, that has my music, pictures from all of the computers in the house, some work files, all things you may expect to find on a file server. sda2 is mounted to sda1 /home/storage

In storage is a folder that is titled "Music" I have it broken down into MULTIPLE folders that house all of our music by genre. So none of the music is; for lack of a better word free floating in the folder titled Music.

I installed weechat, gnuscreen, mpd, ncmpcpp, midnight commander, htop, atop and a few other curses typed applications to sda1

From the laptop downstairs I secure shell into the server and run screen to bring up gnuscreen. I know have shell, htop, atop and weechat showing up on the bottom of the screen where I can hit F7 / F9 to toggle between them. Thanks for introducing that to me Josh, very handy.

So at this point as I am secure shelled into the server, I try to run ncmpcpp from terminal and get the

Couldn't connect to MPD (host = localhost, port = 6600): Connection refused 

error.

 

Sorry about all the additional info, but have found over the years it's always better to provide TO MUCH info than NOT ENOUGH

 

Thanks again,

 

Ian

Edited by ichase
Link to comment
Share on other sites

In mc, you can create softlinks to files on your server maybe?

 

 

 

An Introduction to the Midnight Commander

 

I use mc to do many things like that.

 

For some strange reason, I can't get Midnight Commander to run, I should be able to work through that.

 

I now have MPD/ncmpcpp up and running, not only that, it recognizes every folder in my Music folder, allows me to open each folder and displays the music within those folders so that is good. What is bad is, I have no volume. Volume is set to 100. The server itself does not have a sound card installed nor does it have on board audio on the MOBO. With that being said, would I need to install a sound card to the MOBO in order to get the volume to work? I have a couple of old sound cards in my box of old scraps, hopefully not so old that they do not fit in the PCI slots. LOL

This may also be why when I try to run alsamixer I get an error. Running lspci shows nothing to do with sound so the question is, in order to run MPD directly from the server with gnuscreen would I have to install a sound card to the server's MOBO?

 

Thanks for the help,

 

Ian

Link to comment
Share on other sites

Guest LilBambi

If you are running them on the server, the sound would be from the server.

 

If the player is trying to play directly on the server, I wonder if using a shoutcast server with an icecast streamer that you could run in xmms or other player from other computers would do just as well and give you the ability to play the music even though no sound card in the server?

 

My Jim is doing that from his Raspberry Pi.

Link to comment
Share on other sites

Thanks for the response Fran. Using SMPlayer or Deadbeef, I am able to play the music that resides on the server but that is programs installed directly on the laptop and desktop so they are using sound from their own source. I will put a sound card on the MOBO and hopefully that will resolve the issue. :)

  • Like 1
Link to comment
Share on other sites

That's definitely a thought Josh. I have 3 pci sound cards I found in my parts stash but I am wondering if even installing the sound card in the server is going to allow for sound on the host computer. I have winamp installed on the server and have a short cut link on my wife's and my work computer (windows 7) and it plays just fine. It also will play through my Linux machines via WINE.

 

Well, I guess there is only one way to find out, install the sound card and see what happens. ;)

I would certainly like everything working directly from the server and for the most part via SSH all is except for Midnight Commander which I have not taken the time to research yet. Probably some setting I have off.

Edited by ichase
  • Like 1
Link to comment
Share on other sites

securitybreach

That's definitely a thought Josh. I have 3 pci sound cards I found in my parts stash but I am wondering if even installing the sound card in the server is going to allow for sound on the host computer. I have winamp installed on the server and have a short cut link on my wife's and my work computer (windows 7) and it plays just fine. It also will play through my Linux machines via WINE.

 

Well, I guess there is only one way to find out, install the sound card and see what happens. ;)

I would certainly like everything working directly from the server and for the most part via SSH all is except for Midnight Commander which I have not taken the time to research yet. Probably some setting I have off.

 

I thought you wanted to play music from your server and output it to other machines over the network? The reason I ask is because you can run MPD perfectly without any audio output setup on your server. Then you just connect to the server on any machine and play music over the speakers on those machines. http://mpd.wikia.com...i/Configuration

Link to comment
Share on other sites

securitybreach

HTTP Streaming

 

Since version 0.15 there is a built-in HTTP streaming daemon/server that comes with MPD. To activate this server simply set it as output device in mpd.conf:

 

audio_output {	
type		"httpd"	
name		"My HTTP Stream"	
encoder		"vorbis"		# optional, vorbis or lame	
port		"8000"	
#	quality		"5.0"			# do not define if bitrate is defined	
bitrate		"128"			# do not define if quality is defined	
format		"44100:16:1"	
}

 

Then to listen to this stream simply open the URL of your mpd server (along with the specified port) in your favorite music player.

Note: You may have to specify the file format of the stream using an appropriate file extension in the URL. For example, using Winamp 5.5, You would use http://192.168.1.2:8000/mpd.ogg rather than http://192.168.1.2:8000/.

 

To use mpd to connect to the stream from another computer.

mpc add 192.168.1.2:8000 

 

https://wiki.archlin...#HTTP_Streaming

Link to comment
Share on other sites

securitybreach

Hehe, pretty neat. I just downloaded an Android app Droid MPD Client that acts like a remote and lets you control MPD over the network. I just entered my server address/port and it automatically showed my playlist and all of my music library. Pretty neat considering I did not configure anything at all.

Link to comment
Share on other sites

I thought you wanted to play music from your server and output it to other machines over the network? The reason I ask is because you can run MPD perfectly without any audio output setup on your server. Then you just connect to the server on any machine and play music over the speakers on those machines. http://mpd.wikia.com...i/Configuration

That is what I wanted to do. In theory it is no big deal. I can start smplayer, set up playlist (which I have done) and play the music that resides on the server with no problem. I was just trying to see if while secure shelled to my server if the sound card on my laptop would pick up the sound when I choose music to play via mpd. Adding a sound card to the server will only source the sound to "that" sound card and would have no baring on the sound card on the client machines.

 

Thanks for the links :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...