Table of Contents
Getting MPD Running
Part 1: mpd
The daemon needs to run on the fileserver. This machine has speakers plugged in and running. Here's a brief list of the steps that we had to go through
- apt-get install mpd mpc
- change it to listen on ip `0.0.0.0` so that you can connect remotely
- change the path for the music to `/filestorage/music/music`
- restart mpd
- force updates with mpc update
Part 2: ncmpc
This is to be installed and controlled on the control device. In my case the laptop
- install ncmpc
- add the following to the .bashrc
alias ncmpc="ncmpc --host=lawton --port=6600"
Part 3: dealing with podcasts
Podcasts are located in a directory `/filestorage/music/music/Podcasts`
- download peapod and set it up with the feeds you want to get and have them saved to the podcasts directory
- once that runs we now have to update our playlist we created in mpd. The following script will read the Podcasts directory and update the m3u playlist with the podcasts in the directory
#!/usr/bin/env python import os podcast_dir = '/filestorage/music/music/Podcasts/' playlist_file = '/var/lib/mpd/playlists/podcasts.m3u' playlist = [] def find_mp3s(root, file_list): for name in file_list: if name[-3:] == 'mp3': part = root.lstrip('/').partition('/') playlist.append(os.path.join(part[2], name)) def create_playlist(podcasts): # now output these files to a playlist file out = open(playlist_file, 'w') podcasts.sort() for path in podcasts: out.writelines("%s\n" % path) for root, dirs, files in os.walk(podcast_dir): # if files are .mp3 files then add them to the playlist find_mp3s(root, files) # now check the directories for dir in dirs: for root, dir, files in os.walk(os.path.join(root, dir)): find_mp3s(root, files) create_playlist(playlist) print 'Playlist created with %s mp3 files' % len(playlist)
- Now we need to force mpd to update the library with the new podcasts downloaded
mpc update
- I combined these steps with the following cron job I run once a day
python /home/rharding/peapod/peapod.py && /home/rharding/podlister.py && mpc update
Still remaining
There is still a couple of issues
- You still have to manually clear the current playlist and reload the podcast playlist to see the updates
- There is no method of marking which ones you've read and cleaning up old podcasts we don't want any more
software/mpd.txt · Last modified: 21:06 26/07/2007 by rharding



