2011-04-07, 19:40
Hey everyone,
I've created a small open-source tool to automatically download new episodes of TV programs and update my XBMC library - so what this basically means is that new episodes of shows that I'm watching automatically appear in my XBMC library (plus I get an email notification). I created it for my own personal use and it's still in very early stages of development, but it actually works so I thought that it might be of use to others.
You can find it on GitHub (at the moment I'm pushing changes quite frequently, so it could well be a lot better in a week's time!): https://github.com/mrkipling/Auto-NZB-downloader
...and here's a screenshot of the web interface: http://i.imgur.com/QMuqm.png
It's a bit clunky, but like I said, it's something that started life as a personal project for my own use. It's a Django/Python web app and you deploy it on your download server or HTPC using nginx or whichever web server you prefer. This then exposes a few URLs - one is the web-based interface, another ("/check") checks for new episodes and download NZBs as appropriate, and another ("/organise") scans the extracted folder, moves files into your library, and remotely triggers XBMC to update your library. You set up a cron job to query /check and /organise however frequently you want (perhaps check every hour, then next hour organise, and so on).
It works as follows:
* It takes an RSS feed from MyEpisodes.com, which contains information for upcoming shows that you watch. MyEpisodes provides a web interface to keep track of air dates for upcoming shows, and the ability to mark shows as acquired or watched.
* It picks up new shows and episodes and stores them in a local database. You can choose for each episode whether you want to download in HD or standard def.
* When you check for new episodes via the /check URL, it performs a search on NZBMatrix.com (this requires an API key, which requires becoming a premium member for a one-time payment of £7). If it finds the episode in English and HD/non-HD as appropriate, then downloads the NZB file and places it in you're newsreader's "watched" folder.
* I use SABNZBD+, so at this point it picks up the NZB, downloads, repairs and extracts it.
* When the /organise URL is queried it scans the newsreader's extracted folder for files that Auto NZB Downloader added. If it finds any then it parses the directory name to get show and season info. It finds the episode (the biggest file in the directory), moves it into the correct subfolder in your media library (Show Name/Season N/filename.whatever), and deletes the leftover crap that was also extracted.
* It then send a query to XBMC over the network which prompts it to update the library. The new episode is added and should appear in your library.
* It also sends you an email upon acquiring an episode, should you enable this setting. There is a log file so that you can keep an eye on things. There is also a web interface which shows upcoming shows, acquired shows, shows which it is having problems searching for, and more features as I (or others, since it is open source) add them.
I'm planning on adding some new features... priorities are a snappier name, friendlier configuration and the ability to use different services (so that you're not tied to MyEpisodes or NZBMatrix.com, for example - the £7 premium membership thing is slightly annoying but I wanted to create something quickly that worked, and access to an API was too tempting).
It's provided "as is" but I'm happy to help if you decide to play around with it yourself and need assistance. As I keep saying, it's open source, so feel free to commit some changes and improve on the admittedly rather basic start that I've made!
I've created a small open-source tool to automatically download new episodes of TV programs and update my XBMC library - so what this basically means is that new episodes of shows that I'm watching automatically appear in my XBMC library (plus I get an email notification). I created it for my own personal use and it's still in very early stages of development, but it actually works so I thought that it might be of use to others.
You can find it on GitHub (at the moment I'm pushing changes quite frequently, so it could well be a lot better in a week's time!): https://github.com/mrkipling/Auto-NZB-downloader
...and here's a screenshot of the web interface: http://i.imgur.com/QMuqm.png
It's a bit clunky, but like I said, it's something that started life as a personal project for my own use. It's a Django/Python web app and you deploy it on your download server or HTPC using nginx or whichever web server you prefer. This then exposes a few URLs - one is the web-based interface, another ("/check") checks for new episodes and download NZBs as appropriate, and another ("/organise") scans the extracted folder, moves files into your library, and remotely triggers XBMC to update your library. You set up a cron job to query /check and /organise however frequently you want (perhaps check every hour, then next hour organise, and so on).
It works as follows:
* It takes an RSS feed from MyEpisodes.com, which contains information for upcoming shows that you watch. MyEpisodes provides a web interface to keep track of air dates for upcoming shows, and the ability to mark shows as acquired or watched.
* It picks up new shows and episodes and stores them in a local database. You can choose for each episode whether you want to download in HD or standard def.
* When you check for new episodes via the /check URL, it performs a search on NZBMatrix.com (this requires an API key, which requires becoming a premium member for a one-time payment of £7). If it finds the episode in English and HD/non-HD as appropriate, then downloads the NZB file and places it in you're newsreader's "watched" folder.
* I use SABNZBD+, so at this point it picks up the NZB, downloads, repairs and extracts it.
* When the /organise URL is queried it scans the newsreader's extracted folder for files that Auto NZB Downloader added. If it finds any then it parses the directory name to get show and season info. It finds the episode (the biggest file in the directory), moves it into the correct subfolder in your media library (Show Name/Season N/filename.whatever), and deletes the leftover crap that was also extracted.
* It then send a query to XBMC over the network which prompts it to update the library. The new episode is added and should appear in your library.
* It also sends you an email upon acquiring an episode, should you enable this setting. There is a log file so that you can keep an eye on things. There is also a web interface which shows upcoming shows, acquired shows, shows which it is having problems searching for, and more features as I (or others, since it is open source) add them.
I'm planning on adding some new features... priorities are a snappier name, friendlier configuration and the ability to use different services (so that you're not tied to MyEpisodes or NZBMatrix.com, for example - the £7 premium membership thing is slightly annoying but I wanted to create something quickly that worked, and access to an API was too tempting).
It's provided "as is" but I'm happy to help if you decide to play around with it yourself and need assistance. As I keep saying, it's open source, so feel free to commit some changes and improve on the admittedly rather basic start that I've made!