I spent the last few hours working on a cool idea I have had since iTunes Match came out.
My idea: Set up SABnzbd on a machine that is always on (Server/Old PC) and install iTunes and activate iTunes Match, then use myNZB (iOS) or some other iOS app that talks to SABnzbd to start a download for some music album (Obviously one that is not represented by a label/Copy-written) and set up SABnzbd to move the completed download into the iTunes Mp3 watch folder which forces iTunes to add it to the library and then upload it to iCloud.
To make this easier here is the work flow I had in mind:
* Start download via iOS device (Not needed but this is the cool part)
* Download finishes and gets added to iTunes
* iTunes adds music to iCloud (Via "Uploaded" or "Matched", which should not happen because you are not downloading songs that you should pay for, right?)
* Song is available for download on iOS device
Originally I was going to use an old desktop computer of mine but I was having problems with it so decided to look elsewhere. Then I decided to use a VPS on cloud hosting so that I didn't have to maintain any hardware and I would be able to scale my work for more people (ie. my Friends/Family). The first VPS hosting I paid for I had a lot of problems (Windows hosting is ALWAYS a pain but I needed it for iTunes) but I was able to get my initial proof-of-concept working and then I turned to Amazon EC2. I was excited to use EC2 because I had never used it and wanted a project to learn more.
I had MANY roadblocks along the way including:
* iTunes refusing to start without an error because their was no sound card (Duh, it's a headless server)
* Problems getting SABnzbd to run as a system service
* Problems getting the DynDNS update to work
but after about 17 hours (Yea, it's been a long day) I am writing this post.
My bigest reason for wanting to go with EC2 is the ability to turn off/on the server to save costs and AWS has a free tier that I am taking advantage of. Here is my final workflow:
* Run a small webapp (Bookmarked to the homescreen, in the picture it's called "Launch Server", don't judge me for my complete lack of designing skills)
* Webapp is hosted on a shared host I have and makes API calls over to EC2 to start up the server and then API calls to DynDNS to update the DNS records (This is needed because every time you start/stop a EC2 instance you lose the dynamic IP address you were assigned so I used DynDNS so that I could point myNZB to Hostname-here.dyndns.org and let DynDNS tell myNZB where SABnzbd is running)
(Again don't judge me by my lack of design skills)
* Once the server is started up and the DNS is updated (Approx. 2mins on a micro windows 2008 instance) the webapp is done and now it's time to move on to myNZB
**** At this point I would love to use URL Schemes (http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html
) to open myNZB immediately after the DNS resolves yet myNZB does not have a URL Scheme
* Now I just open myNZB
* Download something and it's pushed to itunes which is opened up by SABnzbd on completion of download
* Song shows up in iTunes (iOS or desktop) available for download
* 30 mins after the VPS is powered on it shuts it's self down to save $$$$
This whole process takes ~6mins, the download is insanely fast due to it sitting on Amazon's network (Average of 7-12MB/s, yes MegaBytes not bits <- That is how fast SABnzbd reports, here is a speed test
). Yes it's not instantaneous download-to-iOS solution but it works for me and I would guess the majority of people.
Now the important question, how much does it cost?
iTunes Match: $25/yr
Amazon EC2: (Not as straight forward)
For this I had to make some guesstimates, I way over estimated so that it was worst-case
For each hour the VPS is on it cost money, and from what I can tell even if you turn on your VPS for a few minutes it will count as 1 hour so I will assume for every album you want to download it will "cost" you one hour. Here are the assumptions I am going to make, and yes I know they are high:
# of Albums/month: 20 albums (Way high I know but I threw extra in there just in case)
Average size of album: 100mb
So about 2GB of data will be downloaded/month and 2GB will be uploaded (to iTunes Servers assuming none are "matched")
When you plug this all into the EC2 calculator you get the SUPER HIGH price of $0.72/month
(This is BEFORE the free tier discount which brings mine down to $0.57/month)Total: $33.69/Year
Step 2 is to expand to Friends/Family and write more code that talks to the EC2 API to better manage and track everything. This is very simple to do as I can simply clone my instance over and over and just RDP in to each one to enter the iTunes login details of Friends/Family. My small webapp will also be worked on to provide more than dumb-startup and actually be able to manage the VM. A possibility is using Titanium Mobile to write a mobile app (Which I have done before) so that it is a little more stable and has more access to the device.
I am more than happy to answer any/all of your questions on how I did it and I can also provide you with access to the most of the code I wrote to make this possible. I just spent/wasted 17hrs when I should have been studying for my exams so I hope at least someone takes something away from this. I look forward to continuing to work on this and find new and interesting ways to bend awesome technologies to do awesome (at least in my mind) things. Thanks for your time!