This weeks project in c# came from the idea that when I download movies (only legal stuff ofc!) off of the internetz,
I want it to automagically unpack and transcode to mp4 and add it to iTunes so that I can stream from my computer to my AppleTV.
Pretty good use-case for a project if I say so myself 🙂
So, I created an application in c# which does the job for me.
It relies heavily on unrar (included in winrar (www.rarlab.com) and a damn nifty program called Handbrake (http://handbrake.fr/downloads.php).
You can find the source to my application here: http://nummersex.se/AutoUnpackAndConvert.rar
The code is somewhat quick-and-dirty. If you find ways to improve it, by all means: do so 🙂 There is a do-whatever-the-fuck-you-want license on this, choose one (thanks Patrik).
To make this work you need to edit the app.config file and specify where unrar and handbrakecli resides, since I think I would be in violation of copyright laws if I included them in the package.
If you want to use this with your torrent-application the way I did (using uTorrent) go to Settings and under Advanced you will find that you can enter a command to run when the torrent is complete. Set this to the program and “%D”. i.e. “c:\temp\AutoUnpackAndConvert.exe” “%D”
I also included a .regfile you can edit and run in order to integrate it with explorer.
There is really not that much error-detection in this code, so chances are there are some ways this application will throw exceptions left and right during some circumstances. Just a heads up.
I hope this was useful to someone (it is for me :). Leave a comment if you’d like.
/Gabe