Category

ShowAds

Tuesday, October 27, 2009

Installing rutorrent on your AppleTV

My AppleTV experience started in June ‘09 with a 40gb version I bought used from craigslist.  I’ve made many hacks on it already, like installing XBMC and Boxee. I’ve set up samba filesharing service, installed rtorrent, fought a lot with python and rssdler, created special cron jobs, and expanded its capacity to 1.5TB via network streaming.  Rssdler allows it to watch RSS feeds and download torrents automatically via rtorrent.  I like rtorrent because it is very stable and utilizes little system resources.  With only 1.0Ghz and 256mb of ram, resources are always a concern.  So when I started to look for an easier way to control rtorrent, a small footprint was a factor.

My original plan was to install wtorrent, a web based client that allows you to view rtorrent’s information and control it in your web browser.  This requires a web server like apache or lighttpd running on the AppleTV, and uses memory.  wtorrent’s system requirements were pretty high actually, needing not only httpd, but also php, scgi, ajax, etc…  I looked for alternative web clients and came across rutorrent.

rutorrent has many good features, the best of which are a light footprint, easy install, and nice interface.  I want it to be easy to use so Alison can benefit from it.  It doesn’t have multi-user support or password protection, but my AppleTV isn’t accessible from the outside world so I don’t have much use for that.  You can set up passwords with .htaccess if you need it though.  I spent many hours trying several different combinations of web servers and rtorrent frontends, finding information spread widely around the internet.  I ended up using the following configuration which is working out quite nicely.  I’ll detail it here in hopes that someone else who is interested can save some time and effort as well.

In this tutorial, I assume that you’ve hacked your AppleTV with the patchstick already, and you’re familiar with ssh, nano, unix filesystems, apache httpd, and copying files to your AppleTV.  I’ll still try to make it easy to follow for those of you who just type what you are told.  Items in bold should be typed into the console.

  1. Install rtorrent.
    • This has been documented pretty well already by a few different sites.  Try
      http://dyve.posterous.com/a-proper-rtorrent-install-for-apple-tv and come back when you’re done.
    • Enable scgi in your rtorrent configuration file
      nano ~/.rtorrent.rc
      type scgi_port = 127.0.0.1:5000 in the global section (just make it the first line if you’re unsure)
    •  
  2. Install XAMPP 0.7.4.
    XAMPP is an all-in-one apache http/php/perl/mysql solution for linux and mac os x.

    • Goto http://sourceforge.net/projects/xampp/files/ and download xampp-macosx-0.7.4.tar.gz.
      I used the newest version that was available as a tar file because you’ll need to extract it with the -p option to preserve file permissions.  If someone verifies that the files from the .dmg files work, I will make an update.
    • Copy the tar file over to the AppleTV via scp or samba.  I copied it to /Users/frontrow/xampp-macosx-0.7.4.tar.gz
    • Login to the AppleTV with SSH and navigate to the folder you uploaded it to and type:
      sudo tar xfvpz xampp-macosx-0.7.4.tar.gz -C /Users/frontrow/
      • This will install the app to /Users/frontrow/Applications/xampp.  Other sites will tell you to extract it to / so it installs in /Applications/xampp, but the 40gb AppleTV will give you an error saying “Cannot write: No space left on device.”  This is because /Applications is in a separate partition on the hard drive.
    • Creating a symbolic link in /Applications will give you the same functionality as if it was installed in /Applications.  Type
      sudo ln -s /Users/frontrow/Applications/xampp /Applications/xampp

    • Set up your httpd.conf
      sudo nano /Applications/xampp/etc/httpd.conf

      • Set up the httpd.conf however you like.  Other sites like this can explain it better than I can. You can also skip this and come back at the end.
    • Start the xampp services
      sudo /Applications/xampp/xamppfiles/mampp start

      • If you get php errors, it’s because you didn’t use the -p flag when extracting the tar file contents.  If/When this completes successfully, you should be able to type http://the-ip-address-of-your-AppleTV in your web browser and get a page.
    • Setup XAMPP security
      sudo /Applications/xampp/xamppfiles/mampp security

      • Creating a password for mysql will cause the demo html page to not work.  Not that that is a big deal, you’ll be replacing it with rutorrent later
    • Create a LaunchAgent to start the program automatically on boot.  You can download my launchagent here.  Copy it over to the AppleTV and then copy it to /Library/LaunchAgents/ by typing
      mv org.awkwardtv.httpd.plist /Library/LaunchAgents/

      • Congratulations, at this point your web server is installed and will start automatically with the AppleTV.  Now it’s time to install the http frontend for rtorrent.
  3. Installing rutorrent.
    • Download the latest version from the homepage: http://code.google.com/p/rutorrent/ and extract the files to the directory your xampp httpd.conf file uses as default for web pages.  If you didn’t change it, this folder will be /Applications/xampp/htdocs/
      • I found it easiest to extract the files on a desktop computer, and then move them over to the AppleTV via samba.
        Alternatively:
        • Copy the tar.gz file via scp
        • Navigate to the folder in SSH
        • gunzip rtorrent-2.7.tar.gz
        • tar -xf rtorrent-2.7
        • cd rtorrent
        • mv * /Applications/xampp/htdocs/
    • Download the RPC plugin (rpc-1.0.tar.gz) from http://code.google.com/p/rutorrent/downloads/list.  Copy it over to the AppleTV.
      • gunzip rpc-1.0.tar.gz
      • tar -xf rpc-1.0.tar -C /Applications/xampp/htdocs/plugins/
    • Make sure it works by going to http://the-ip-address-of-your-AppleTV

Posted by eclipse on 10/27/2009 at 12:52 AM
TechApple • (6) CommentsLink to this entry

Sunday, July 12, 2009

The AppleTV Experiment Continued

It’s no secret that the AppleTV, just a pet project by Apple, has some drawbacks.  It’s got some pretty unimpressive hardware specs, it’s not compatible with a lot of file formats, and the little remote can be a pain to use.  Fortunately, I’ve spent the last few weeks tweaking and hacking the system to make it quite usable and powerful.  The Playstation 3 is still around obviously for games, bluray, and DVD discs, but in every other area, we’ve switched over to the AppleTV and it’s been great.  I bought the AppleTV because I knew it had potential, and it was pretty cheap.  Sure, a mac mini can do anything the AppleTV can do without much of the hacking, but it still doesn’t play Bluray and it costs at least twice as much.  So how did I overcome the AppleTV’s shortcomings and just how awesome is it?

The first step in the AppleTV’s new life was to create the USB Patchstick and boot the AppleTV up with it.  This installs several useful tools, such as XBox Media Center, Boxee, and SSH (dropbear).  I already went over XBMC and Boxee in the last post, but it was extremely helpful for the patchstick to install SSH for me, as being able to access the AppleTV’s command line paved the way for the rest of the “upgrades”.

With XMBC, I could now play all the video files on my computer like I did before with the PS3.  But I figured I have 40gb of wasted space sitting here on the AppleTV if all I’m going to do is stream video.  Wouldn’t it be nice to have some TV eps or movies available to be played without having my desktop powered on all the time?  Sure, at this point is was possible to copy files to the AppleTV’s hard drive with the scp or ftp command, but that’s not exactly user-friendly, or fast.  I should install Samba service!  There is a nice walkthrough here, which is pretty much what I did.  It still needed some work with the config file but after a night of messing with it I was able to finally connect to the AppleTV’s hard drive, easily drag and drop a file into its Movies folder, and watch it without needing my desktop anymore.  It’s pretty cool to have it just working by itself now…

But it didn’t stay that way for long.  Now, the AppleTV isn’t really like a desktop computer that gets turned off or put to sleep when you’re done.  It’s more like a server, which stays on all the time.  The only way to turn it off (other than the console), is to unplug it.  If this thing is going to be on all the time, eating my power, shouldn’t it be doing something?  Enter rtorrent.  rtorrent is an awesome unix torrent downloading program that uses little system resources and is really simple to use.  You set it up to monitor a folder, and whenever it sees a new torrent file there it will start to download.  When it’s done it will delete the torrent file and move the downloaded video to your Movies directory for you.  This way it just downloads for me all the time until shows are ready and they just pop up ready and waiting for me when they complete.  And with the easy-to-use samba service, Alison or I can just drop a torrent file into the AppleTV’s folder and forget about it until it’s ready.

And for a few days the AppleTV was set in its ways, but isn’t it so much work to download and look for torrent files yourself?  Why do all that when the computer can do it for you!  I knew I was so close now to having a Tivo-like setup.  How nice would it be to come home after work and find new episodes of your shows waiting for you?  Ludicrous, I know!  For this I turned to rssdler.  Rssdler can scan an rss feed and look for whatever Regular Expression guidelines you give it.  It’s a pretty nifty thing, but it’s a python script and so I had to figure out how to install python first.  Getting rssdler to work took the longest time of anything I did to the AppleTV, about an entire week of messing with it.  Python didn’t give me too much trouble, but the rssdler wouldn’t work and I still don’t remember exactly why, but it was essentially due to a space character in one of the files.  Grrrr unix…  Also had lots of permission issues and it sure doesn’t like to be run as root.  Rssdler works when it wants to.  I still have to check up on it a lot these days..

One of the biggest gripes I had with the new system was that damn little white remote.  It doesn’t have a lot of features, and I lose it all the time.  I carry it around the apartment for no reason and forget where I leave it.  Then it’s hard to find because it’s so small.  Plus, 3 remotes now for the system?  I stumbled upon a solution in the MacRumors forums.  A universal remote by Logitech, the Harmony 550.  Unlike most shitty universal remotes where one or two buttons might work, this remote plugs into your computer and downloads all the instructions off the internets from Logitech.  The remote actually does change the way you watch your TV.  I can press the LCD Button “Watch TV” and it’ll turn on the TV and the stereo, set the stereo to Aux, switch to the right TV inputs, and even go to your favorite channel.  Press “AppleTV” and it’ll do the same, switching to the AppleTV input.  It even turns off unnecessary equipment.  Now we are back to one remote and it’s even easier than before to use.  The harmony retails around $90-120, but I got it refurbished off Amazon for $55.  I totally recommend the Harmony series universal remote to anyone.

Now the AppleTV is great at downloading shows and stuff for me, but all these videos are taking up room on the puny 40gb internal hard drive!  It would be great to just be able to plug an external drive into the USB port on the AppleTV, but since that would actually be useful, Apple says no.  But I got another idea.  My Airport Extreme wireless base station has a USB port for sharing printers and external hard drives over the network.  Acting as a little NAS server, it was fairly simple to plug in an external USB SATA drive into the wireless station.  I got a 1.5 TB Hard Disk from Fry’s and started moving all the video over to it.  It’s great because now all the files are available to all computers on the network, including the TV without my computer needing to be on.  View the TV network diagram.

With the Harmony remote making the experience so much easier, the external drive storing everything and anything, and rssdler turning the AppleTV into a Tivo, I am definately happy I got it.  It’s a lot easier to use than the PS3, much quieter, and more flexible.  But I’m still not done yet!  What’s on the horizon for the little overworked, underpaid 1GHz HTPC?  Well since it’s always on, I’ve written a little cron job (and installed cron) that updates my site with my home ip address.  With this I will be able to log in remotely (say during an overnight at a hotel) and maybe start a download, get around crappy hotel wireless plans by tunneling through SSH, remote start my desktop, etc…who knows..  Also planning on trying wtorrent, which gives a web client to rtorrent which would make it easier to see the status of current downloads.  And lastly, it would be nice to have the option to download straight to the external hard drive for some of those larger files.  I’m always thinking of more I can do with it, which is awesome.  I knew it had lots of potential!

Posted by eclipse on 07/12/2009 at 10:08 PM
TechApple • (1) CommentLink to this entry

Thursday, June 04, 2009

The Apple TV Experiment

A few days ago I picked up a used 40gb Apple TV off craigslist for $150 (retail price $230+tax).  I talked to the seller for a few minutes as we did the transaction, I looked it over and he counted the moneys.  He said it was a good device but he just found himself never using it.  He didn’t have a lot invested in iTunes and he just preferred using his computer to use Hulu and view his divx files.  I neglected to mention the hacks available for the apple TV, but he owns a PS3 and so I told him to look up Tversity as a way to view his divx videos on his TV.  So is the Apple TV a good enough product to stay in my living room, or will I follow in this seller’s footsteps and put it right back on craigslist?

First of all, let’s take a look at my TV setup.  It’s pretty simple, just a 40” Samsung LN40A550 HDTV and a Playstation 3.  The PS3 takes care of DVD, Bluray, games, and can even stream media served by the Tversity service running on my computer.  It looks neat, has a nice bluetooth remote, and is pretty good at being an all-in-one device.  However, the user interface takes some time to get used to, it can’t access iTunes content (which is most of my good music), and most importantly: it’s loud!  We have it in a TV stand with closing doors and the PS3 will heat up quickly and start blasting fans to cool itself.  This interrupts a lot when trying to watch a movie, especially quiet ones.  And while Tversity is a great product, it does have some downfalls.

Tversity is a service that will re-encode your divx/xvid/whatever files on your computer into a DLNA-compatible format, which is what the PS3, Xbox360, and others look for in a media server.  It’s nice because you can have a file in almost any format and not have to convert them all into another format to view them.  But it’s not perfect.  While I can use it to play about 95% of the files I have, there are videos that don’t work.  The files have to be indexed similar to iTunes, which means folders have to be scanned and this pwns my computer when the process begins.  So basically, keeping the service running on my computer is a hassle. 

The Apple TV in its original state, is self-admittingly, a “pet-project” of Apple.  It’s designed to be an iPod for your TV.  It syncs the same, holds your music and movies on the internal hard drive, and with the 2.0 software, you can download and rent movies right from the box itself without a computer.  The 1.0 software was better at this concept, and was very similar to Frontrow on the mac.  With the “Take Two” (2.0) software, the focus is more on buying shit from iTunes.  For example, in the Movies menu, “Top Movies”, “Genres”, “All HD”, “Search”, and “Trailers” all refer to online streaming movies and your actual content is all the way at the bottom.  It makes for extra scrolling and makes the menus annoying.  It’s the same in the Music, TV shows, and all the rest.  It’s kind of neat to have the Apple Movie Trailers at your disposal any time you want, but I haven’t tried the movie rentals or purchasing content from it yet. 

Streaming content looks really good over the Apple TV.  It has good vertical sync and high detail even on low resolution shows.  It can do up to 720p.  It will choke on 1080p.  Maybe if a new version which can handle 1080p is released I will update to that.  The Apple TV’s best feature is that it’s whisper quiet.  It is always on and always warm, but it never gets hot and we can keep the TV stand doors closed while using it.

What I don’t like about Apple TV is, of course, that little tiny remote.  I have a hard enough time keeping track of the Samsung and PS3 remotes and not only is this another one to keep track of, but it’s tiny.  I’ve gotten used to the bluetooth remote of the PS3, and the Apple TV being infrared is like a step backwards.  The display when playing music is annoying to me as well.  In an effort to avoid screen-burn, the display flips the cover art from the right side to the left and back every 30 seconds or so.  The screensaver does this too.  I find it highly annoying and even unnecessary with modern TVs.  Since the Apple TV doesn’t even work with non-HDTV sets, this is a feature I hate.

So the Apple TV is great if you have a lot invested in iTunes.  I keep my music organized with iTunes so it works with my iPhone, but my movies and TV shows are in xvid format stored in a directory format.  To play these, the Apple TV must be hacked.  Hacking the Apple TV is pretty easy these days.  You simply create a “Patchstick” USB drive using a simple program and restart the Apple TV.  It boots into Linux and writes over some files and installs others.  About 300 megabytes of downloading later, you have the XBMC Media Center and Boxee.  XBMC was originally created to turn the first Xbox into a media center similar to the 360, and now the project is open source and cross-platform.  It allows you to play media of almost any format (xvid included) and does NOT require the Tversity software.  It uses plain and simple Windows Samba service, which is great because my computer no longer has to re-encode video on the fly.  Boxee builds on this by adding social networking to the software.  You can see what your friends are watching and view recommendations.  Previously, hulu.com content was available but that has been taken off due to legal requests.

Boxee’s problem is that it’s too intense for the Apple TV’s 1.0GHz processor to handle it.  It’s too slow on the Apple TV and so I find myself using XBMC to watch divx video on the TV.  XBMC is also better than the Tversity/PS3 combo I was using before on the PS3.  It plays anything that’s shared on samba, including DVD iso’s.  So now I can play video without having to worry about opening the TV stand doors and everything I have can be played.  And since it’s not being re-encoded, it looks even sharper.  With a little bit more time, I can probably get a bittorrent script working to download in its idle time. 

There’s still room for a lot more hacking and messing around with the Apple TV.  I need to get SSH working and it would be pretty cool to get a complete installation of OS X installed on it.  I think it would be neat to have the 40” TV as another PC in the living room.  I don’t think it will run very fast though, after looking at Boxee.  Still would be fun to try it though, and there’s enough functionality with XBMC to justify keeping it around.  I don’t think there is a perfect Home Theater PC setup without a lot of cash.  The PS3 had a nice remote and features at the expense of the user interface and noise.  A HTPC is usually similarly loud, and expensive.  The Apple TV is cheap, quiet, and has enough features to justify its cost.  After it’s hacked, of course…

Posted by eclipse on 06/04/2009 at 10:18 PM
TechApple • (2) CommentsLink to this entry
Page 2 of 2 pages  <  1 2