One of the things, I always wanted to be able to do, was playing files from outside of MPD
music_directory. Normally, when you want to play such a file, MPD will return Not found error – it means, that file was not found in MPD database. In other words MPD only plays files which are in its
music_directory and are indexed (are in MPD database).
First approach to achieve my goal was adding Play to… function in O!MPD v1.02. This let to play any file from O!MPD database on any MPD in the network (even if this file was not indexed by MPD, i.e. it could be outside of MPD
music_directory). O!MPD v1.03 extends this feature – it lets to play any track that www server has access to: both outside of O!MPD and MPD media directories. All you need is properly installed MPD – no need to worry about updating or even configuring its database.
How it works
Just add your MPD to O!MPD Player profile and select it as active player. Next choose any album or track from O!MPD library and play it. That’s it! Rest is done in the background: O!MPD sends command to play these tracks to MPD. When chosen tracks are in MPD database, they are played in normal way – as files. But when the tracks are not found in MPD DB, MPD sends
Not found error to O!MPD. Then O!MPD prepares http streams, sends them back to MPD and MPD plays them just like streams from Internet. In Now playing everything looks and works as usual – you can see all information about track, jump to album, look for lyrics, seek track, etc. The only difference that lets you distinguish whether MPD is playing file or stream is text (stream) added next to file type:
What’s more, in v1.03 you can even play files outside of O!MPD library, i.e. files outside of directory defined in
$cfg['media_dir'] and not indexed by O!MPD. For this purpose File browser was added. It is available from Library -> File or from album view (Browse…). By default file browser has access only to directory defined in
$cfg['media_dir']. If you want it to have access to files outside of this dir, you need:
- give access to this files to your web server (if not granted already)
In file browser you can navigate to any directory (e.g. just plugged-in usb drive) and play files or whole directories:
Since files outside of
$cfg['media_dir'] are not indexed by O!MPD, informations displayed in Now Playing come directly from MPD. Depending on MPD version you use, these informations can be more or less limited – not all tags can be available. Anyway, O!MPD will try to read as much tags from MPD as possible, so Now Playing can look like this:
Clicking artist name, genre, year will bring you to search results for this items, while clicking album title will open file browser with directory containing this file.
This feature is very useful for MPDs not powered up all the time: in my case it’s for example MPD in my bedroom. I don’t turn it on everyday – just from time to time. Before I had developed this feature, when I wanted to listen to new albums in my bedroom, I had to update this MPD – it was so inconvenient. Now this player is always ready to play any album, right after turning on.
I also use it to play music on my smartphone – I just installed MPD on it, didn’t have to worry about giving access to music directory on NAS.
And, of course, I use it to quick play files from external sources (like usb drives) – that was main goal.
I hope you find it useful, too.