WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: mpd  (Read 4751 times)

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
mpd
« on: March 04, 2010, 07:49:46 AM »
Thanks to Davor Serfez for:

Code: [Select]
Title: mpd.tcz
Description: Music Player Daemon.
Version: 0.15.8
Author: Max Kellermann
Original-site: http://mpd.wikia.com/
Copying-policy: GPL
Size: 2.1M
Extension_by: Davor Serfez
Comments: Clients: IPv6, TCP, Unix domain socket
Playback: ALSA, FIFO, HTTP daemon, libao, OSS
Streaming Encoder: Ogg Vorbis
File Format: AAC, FLAC, MAD mp3, MP4 , OggFLAC (FLAC 1.1.3), Ogg Vorbis
Streaming: libcurl, libmms
Other features: ID3 tag, libsamplerate
Change-log:     
Current:        2010/03/02 - 1st version: 0.15.8


Offline yoshi314

  • Full Member
  • ***
  • Posts: 135
Re: mpd
« Reply #1 on: March 06, 2010, 06:44:34 AM »
cool. i assume it's supposed to run per-user and keep the song database in home directory, for persistence?

Offline eltheos

  • Newbie
  • *
  • Posts: 4
Re: mpd
« Reply #2 on: March 27, 2010, 09:35:32 PM »
Somehow after installing mpd tcz, it is started automagically. However, that happens before alsa is setup properly. Therefore, mpd needs to be killed (mpd --kill does not work by the way, as we don't have a pid with no config file), and then started after alsa is set up.

do you launch mpd intentionally somewhere, or is this something specific to my setup you presume?


Offline hamsterjam

  • Newbie
  • *
  • Posts: 2
Re: mpd
« Reply #3 on: May 06, 2010, 01:30:57 PM »
Further to the last posting...

I am setting up an old Neoware thin client as a music streamer for a triumphantly non-technical friend. It needs to work as an appliance. At the moment there is one last thing that I haven't been able to figure out.

I have succeeded in:

- automating nfs-mounting of the music on boot-up
- saving/restoring the /etc/mpd.conf file with the correct parameters

Also, I didn't experience the phenomenon mentioned by eltheos. It worked for me immediately.

So everything is in place, except that the "automagic" startup of mpd runs it as root. Right now, in order to make it work I need to sudo kill the mpd process running as root and then restart it as tc.

Both on general principles, and to conform to the best practices listed on the mpd wiki I would prefer mpd not to run as root. How can I change it to run as tc? All help appreciated...



Offline lucky13

  • Jr. Member
  • **
  • Posts: 76
    • my mostly linux-related blog
Re: mpd
« Reply #4 on: May 06, 2010, 03:49:07 PM »
@hamsterjam (and eltheos): I haven't looked at this extension for TC but in other distros you start and stop from /etc/init.d. So as root or via sudo:
Code: [Select]
/etc/init.d/mpd stop
Or whatever the path to ...init.d/mpd in this case. You can stop, start, restart, etc., based on that script so that it behaves as intended. Dittos for other daemons (cupsd, httpd, sshd, hald, etc.; some of these have more options for modifying behavior).

I just looked and saw this extension still has man pages, documentation, etc., included with it so you should be able to read all the setup information online when you load the extension:
Code: [Select]
usr/local/bin/mpd
usr/local/share/doc/mpd/AUTHORS
usr/local/share/doc/mpd/COPYING
usr/local/share/doc/mpd/NEWS
usr/local/share/doc/mpd/README
usr/local/share/doc/mpd/UPGRADING
usr/local/share/doc/mpd/mpdconf.example
usr/local/share/man/man1/mpd.1
usr/local/share/man/man5/mpd.conf.5
usr/local/tce.installed/mpd

Quickly, though, your mpd.conf (whether you set it up in ~/ or in /etc or wherever) includes which user is running the daemon (line with: user "username"; default is: user "mpd"). The recommendation is to set up a separate user mpd to run the service but you could use tc. If you have that set that in your mpd.conf (and that's persistent) and mpd starts after alsa, you shouldn't have any issues with it running. I just restarted mine (Debian Lenny) after changing user from mpd to my-login and now I own it.

Edit: If you have a persistent mpd.conf set up for user "tc" and mpd starts as any other user, you should only need to issue "/etc/init.d/mpd restart" after it's already loaded to change it to user tc. You could add that to /opt/bootlocal.sh and it should be taken care of by the time you'd do anything with it.
« Last Edit: May 06, 2010, 03:56:58 PM by lucky13 »

Offline hamsterjam

  • Newbie
  • *
  • Posts: 2
Re: mpd
« Reply #5 on: May 07, 2010, 05:53:14 AM »
Thanks for that. The mpd daemon can indeed be started from /etc/init.d/ in Ubuntu (for example), but not in TCL :(

I have arrived at a solution, which involves adding "sudo killall mpd" followed by "mpd /etc/mpd.conf" to /opt/bootlocal.sh.

This then starts the service as "tc" which is what I want, and mpd is then available to the clients (Sonata/Ubuntu and Ario/Windows). If I don't do this then even with the modified /etc/mpd.conf the clients respond with "No read permission".

I think that the service is being started before /opt/bootlocal.sh starts, but for the life of me I can't find from which location. However, I've only been using TCL for a week or so.

Anyway, I now have my Neoware music streaming appliance that "just works" when you start it up. These Neowares can be had for practically nothing. I got two for 30 euros each and another 8 from a skip (US: dumpster). VIA Nehemiah processor (=900MHz PIII), 192MB DOM, and a PCI slot for a disk controller if you're unlucky to get one that won't boot from USB or LAN (not all of them do). Plus no fans, which makes them ideal for this. Attach it to your stereo and control it from your lappy or iPhone/iPod...

Offline eltheos

  • Newbie
  • *
  • Posts: 4
Re: mpd
« Reply #6 on: May 22, 2010, 09:50:54 AM »
I am using the same solution as you, hamsterjam. That is the only way for me to mount some shares before I start mpd to read from them. I have to kill mpd once, as it seems to get started when the tcz is mounted - which is too early as alsa and mountings are not available yet.

I think I will go back to my own build...which does not have all these issues.