How to use your ATV as an UPnP server
This guide will make you use your Apple TV as an UPnP server, not a client. This will allow you to stream the music, pictures and video confined to your Apple TV's hard drive to i.e. a PS3. This is very useful if you want to listen to music from your ATV while playing a game on your PS3, or send media across your home network to devices that support UPnP, and you don't have a computer that is always-on. Great. Let's get started.
The UPnP server i will use in this guide is TwonkyMedia, as it runs silently in the background, and is 100% configurable from a web browser.
The first thing we have to do is to download the Mac OS X build of TwonkyServer, available at http://www.twonkymedia.com/support/downloads.aspx . Once you have downloaded the TwonkyMediaServer_MOSX_6.0.28.zip file, you need to upload it to your Apple TV using ftp or sftp.
Uploading the TwonkyMedia Server zip
Remember the default username and password for the AppleTV user is frontrow. To upload the file, you can can use FileZilla or sftp using the following commands.
$ sftp firstname.lastname@example.org's.ip.address
Enter the frontrow password
$ put TwonkyMediaServer_MOSX_6.0.28.zip $ quit
That is it, now to install TwonkyMedia Server.
Installing TwonkyMedia Server
Open Terminal and ssh into your Apple TV. Firstly we have to unzip the installer, this can be done using the following command:
This will create a directory called 'TwonkyMediaServer_MOSX_6.0.28.mpkg', this is an installer package directory. To install it we need to switch to root to install and run the following commands:
$ sudo -s $ DYLD_FRAMEWORK_PATH='/System/Library/Frameworks/OSXFrames/' installer -pkg TwonkyMediaServer_MOSX_6.0.28.mpkg/ -target /Users/frontrow/ $ exit
Hopefully all is well and it has installed successfully, but it has installed the Application in the /mnt/Application directory, we need to move it (well we might not have to, but I got it working by moving it)
$ cp -r /mnt/Applications/TwonkyMedia.app /Users/frontrow
The next thing we have to do before running it is to get the required package arp. You need to have arp installed, or else Twonky will keep being mad that it's not there. You can either get arp from a Darwin build, or grab it from http://bjarkebech.com/etc/arp. Safari will probably screw up the download, so use Firefox :)
When you have downloaded arp, just transfer that into your home directory (/Users/frontrow/), and all the files we will need are there.
Getting it to work
First, make sure you have both the MediaServer directory and the arp file in your home directory (/Users/frontrow/). If you do, head into your Terminal, and ssh into your Apple TV. It should already be in your home directory. Start by running these commands to make sure that arp is executable by the system, and that it runs as root, and lastly move it to /usr/sbin
$ sudo chmod +x ~frontrow/MediaServer/twonkymedia $ sudo chown root:wheel arp $ sudo chmod +x arp $ sudo mv arp /usr/sbin/arp
If an error appears that says something like "read-only file system" you'll need to mount the boot drive as read/write before entering the last line of the above commands:
$ sudo mount -uw /
Great. Now all we need to do is get TwonkyMedia to run on startup. I do this by editing the rc.local file, but some will probably say it's better to use launchd. Use whatever you like, this is what worked for me. To edit rc.local, the easiest thing to do is to install nano. When you have installed nano using the guide on this wiki, open rc.local in nano by typing
$ sudo nano /etc/rc.local
Then, at the bottom of the file, type
And quit and save by pressing Ctrl+X.
The last thing you need to do is to modify the TwonkyMedia Server config file to enable remote web access from another computer on the network, unless you want to keep access to the Apple TV only and use your nitoTV Browser to configure the server.
add the following just under the 'HTTP server port'
# httpremoteport httpremoteport=9000
And quit and save by pressing Ctrl+X.
Then, you should be all set. Try to reboot your Apple TV by typing
$ sudo reboot
And when it turns back on, try to go to the web page http://your.apple.tv's.ip.address:9000/, and, if it worked, you should see the TwonkyMedia start page.
Setting up TwonkyMedia
Now, all we have to do is specify the directory our media is in. Head to the TwonkyMedia configuration page at http://your.apple.tv's.ip.address:9000/config, and you should see the list of indexed directories. Change the first one on the list to
and save settings, and then reboot the ATV. Then you're finished, but it takes some time before it has indexed all your music. Enjoy!