Exploiting the Teac H380DNT Media Player
I bought one of these a few weeks back:
It's a Teac H380DNT combined FM/AM, DAB, Internet radio and media player unit - £130 from Superfi. In essence, this was to replace my original DAB tuner which failed after we moved house - no idea why and a tad dissapointing because it was only about 5 years old. Anyway, in the replacement I also wanted Internet radio capability but also the ability to play music (MP3 etc) over the WiFi from a networked PC. I've not bought into the whole iPod dockable idea, our music is all on a backed up Linux box where we copy music onto our MP3 players as and when we want them. The closest thing I found to this which wasn't in the £500 bracket is the Roberts Stream 83i which I came close to buyinge except I really wanted a traditional hifi separate style unit which would go with the rest of my system. This unit as actually half the width of a standard separate but it was close enough for me.
This article focuses on the media player aspect of this unit - the FM, DAB and Internet radio side of things are all fairly self explanatory and work pretty much as you'd expect.
Before going too much further though, let me just say this isn't the most reliable unit in the world (well mine isn't anyway) and I came close to sending it back after discovering a key feature didn't work (more on that in a bit). I've managed to lock it up a number of times navigating the menus however once it's playing I've not had any trouble. Realistically, it's fairly cheap so you can't expect perfection for that sort of money.
The media player component is fairly basic. I can confirm it will play MP3 & MP4a audio without issue. Once you kick it off playing a file, it will continue to step through all the files in the folder, alphabetically and loop back to the beginning once it has completed them all. The ability to display metadata information also seems to be fairly limited.
Modes of operation
The unit has two wifi modes of operation - "Media Sharing" relies on having your audio library available through Windows Media Player (not overly helpful if you've got all your files on a Linux platform) and "File Sharing". This latter mode of operation utilises the standard Windows/Samba file sharing we all know and love and it was this that I intended to use with this unit.
The instructions are fairly straightforward - after you configure your wifi network settings, enter your Samba username/password and then just browse to the folders on your server holding your audio. That's the theory anyway. What I discovered after a frustrating half hour - including several lockups, is that the unit did not remember the username/password I entered and most of the time would just access the network using a guest account. For a Windows PC running file sharing in it's most basic mode of operation, that would work but on a Linux box where you almost always have some level of user control in place, utterly useless. I think I managed to get it to work once before losing the username again. It was at this point I seriously considered sending the thing back.
Before reaching for the packing tape though, I thought it worth a quick look at the Media Sharing option the unit supported. Recall that I mentioned this relied on Windows Media Player sharing out your media library which this unit could then access. A quick Google showed that this protocol is something Microsoft call Windows Media Connect which is a UPnP Audio/Video server protocol. Further Googling then threw up a Linux package called uShare which is a free UPnP A/V media server for Linux. This is a simple command line tool which you simply invoke by pointing it at the folder holding your media files - as per the example:
ushare -c /shares
You need the Linux SDK for UPnP (libupnp) for this to work however you don't need the DLNA libraries. Once I fired this up, selected the Media Sharing menu option on the unit, I immediately got an entry called uShare:1 in the display. Selecting this link then brought up the list of files and folders passed to the ushare app. For my finished system, I created a ushare.conf file and had the thing launch at boot time.
UPnP A/V utilise multicast (broadcast) packets on the network to annouce their presence and one annoyance with this app is that by default - after it has performed an initial set of broadcasts - it only re-announces itself at half hour intervals. This means you may have to wait for this period of time before the Teac Unit sees your server. Having built my ushare app from source, I altered this to be a more realistic 3 minute interval. It's in the src/ushare.c file - look for the UpnpSendAdvertisement call. The numeric parameter is the multicast interval in seconds.
I specifically didn't mention the unit's support for playlists earlier - in the form of .pls or .m3u files which is because it doesn't. Which is a little annoying because we have our music organised in many cases by album with an accompanying playlist and in some cases I create dedicated playlists. Ideally we'd like to run them through the unit.
This got me thinking - all you really need to accomplish this is the ability to make the contents of a playlist file appear as a file system. It sounded a perfect candidate for a FUSE file system and could prove an interesting little project to work on. However before doing that, I had a quick check to see if someone else had already done something similar - they had. Enter playlistfs.
So again, a simple app to setup. You point playlistfs at a folder where you keep your physical playlist files and where you want the actual audio files to appear mounted eg.
playlistfs /music/playlists /music/playlist-music
then point ushare at the mount point:
ushare -c /music/playlist-music/playlists
What the Teac unit then "sees" is a set of folders (each represented by an indivual playlist file), into which appear the actual audio files from the playlist.
There is but one issue though and that is you have no control over the order tracks appear in the directory and even if the playlistfs application did try to enforce this, the fact that the Teac unit always presents them alphabetically would negate that. So to work around this, I've done a bit of a hack job on the playlistfs application and it is a hack in as much as it probably breaks some of the additional functionality this application offers (for example the ability to add/delete items from playlists and have them update on the fly) but I don't need that functionality so it's fine for my purposes.
What it now does is prefix each item with an incrementing number such that the items will always be presented in the correct order eg.
000 - Some track
there you have it. You can download my severely hacked version of playlistfs here.