Saturday, June 18, 2011

Installing MyMedia on Synology NAS

One of the main reasons for buying the combination of a Roku DVP and Synology NAS was to stream music from the mp3's on my NAS to my living room, where the Roku is located.  There are a few options, but MyMedia is the only completely open-source and free one, so I decided to give that a try.

Installation of the MyMedia app onto your Roku is well documented elsewhere.  This article will focus on installing the MyMedia server application onto a Synology NAS.  I have a DS210j, but the steps should be the same or similar for other models.

Note:  This requires nominal comfort with the command line.

Here is what I did:
1) Bootstrap your device, and install the IPKG Package Management System.  You can follow my previous instructions on this.

2) After installation, make sure you "ipkg update" and "ipkg upgrade" as directed in the instructions

3) Next we install Python-2.6.  This will download and install all necessary files and may take a bit of time
ipkg python2.6

4) Next up is the Python Imaging Library (PIL)
ipkg install py26-pil

5) Find the URL of the tarball of the MyMedia release you wish to use.  Documentation is a bit sparse on the difference between releases, but in general you should use the latest one.  At time of writing, the latest version was "AngyAvacado" from March 19, 2010.  You want the TGZ version of the archive.

6) Pick an install folder (I use "/opt/local/opt") and fetch/expand the server tarball there
cd /opt/local/opt
wget http://full-url-to-the-version-of-the-server-you-want.tgz
tar zxf name-of-the-file-you-downloaded.tgz
rm name-of-the-file-you-downloaded.tgz

6) I created a symlink to the server folder so I wouldn't have to change any scripts that reference it later
ln -s folder-created-by-tar-command mymedia

7) Start the server, and see if you can connect to it from your Roku MyMedia channel
/opt/bin/python26 /opt/local/opt/mymedia/server/mymedia.py


8) If it is not working, you can check for errors in the log
more /opt/local/opt/mymedia/server/my_media_log.txt

If you see this error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128) it means you have non-ASCII characters (accents or what-not) in some of you folders and/or filenames.  Unfortunately, you'll have to rename your folders/files as there seems to be a bug in the Python libraries themselves.

UPDATE:  User "renojim" from the Roku Forum suggests this fix for the character issue. I'll try it soon and report back.
"One thing, try setting $LANG to en_US.UTF-8 before starting the server. The only platform I haven't been able to get accented characters in file names to work is Ubuntu 10.04 and I'm still looking into the problem."

UPDATE:  If you get a error from wget complaining of bad certificates, try adding the "--no-check-certificate" option, which will ignore SSL certificate issues. 

If everything is working, check my next article on how to have your server start automatically on NAS power-up.

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I have a question about the install. I managed to get things working, but I'm not sure if it's right. I have the DS207 system and a PC. In order to stream movies to my Roku, once the DS207 is fired up, I have to go on my PC, start Python, log into the NAS, start the server, ensure the Server Settings are correct, and then I can stream anything that's on my NAS. Would would be terrific is if I did not have to have a PC on at all and if my MAS was fired up, then I would be able to stream off of it to my Roku. Is this possible? Did I miss something in your instructions that tells me how to do this? Any advice would be great. Thanks.

    ReplyDelete
  3. @Terron: Follow the link in the article or sidebar to "MyMedia Automatic Startup on Synology NAS" which will explain how to have MyMedia start up automatically when your NAS does.

    ReplyDelete
  4. I have a relatively simple fix for that and submitted it to the maintainer of the code on github. The problem that I was encountering was that the mymedia server (on my ubuntu box) was crashing on Russian, Japanese, and Spanish names - anything with a UTF-8 encoded file name. Digging through the files and fixing the names wasn't really an option for me, so I fixed the code.

    ReplyDelete