RuudBurger/CouchPotatoServer — Issue #58: Feature request - adding list of scene releases to be downloaded
Author: bwq
Created: 2011-10-13 23:15:31+00:00
State: open

Here's some sample code:

def filmtestje(self, movies):
for movie in movies:
newmovie = []
releasename = movie['releasename']
nfo = self.urlopen('http://www.srrdb.com/showfile.php?release='+releasename)
nfo = nfo.decode('iso-8859-1').encode('ascii', 'ignore')
imdbId = re.search('imdb.com/title/(tt[0-9]{7})', nfo)
#newmovie['library']['identifier'] = imdbId
#newmovie['library']['titles'][0] = releasename
try:
imdbID = imdbId.group(1)
moviedata = {
'identifier': imdbID,
'title': releasename,
'profile_id': 1,
}
library = fireEvent('library.add', single = True, attrs = moviedata)
except:
print 'fail'

def testje(self):
movies = []
releases = ['Freerunner.2011.720p.BluRay.x264-Japhson', 'Pride.and.Glory.720p.BluRay.x264-SEPTiC']
for release in releases:
newItem = {
'releasename': release,
}
movies.append(newItem)
self.filmtestje(movies)

I know I'm probably firing the wrong event and not populating all the needed fields, but I hope the idea is clear :). Basically, the user enters a number of scene releases, seperated by a comma or other seperator and then this function will get the nfo for each of them and grab the imdb id from there. It should then create a proper movie object for the release and download that exact release name. This should be very handy for adding a list of movies you want but don't want to add one by one in CouchPotato. This is also great for when a user has a HDD failure and wants to redownload the exact same releases and letting CouchPotato do all the work.

Workflow:

User adds list of scene releases -> releases get parsed to proper movie objects -> system starts looking for those releases on the providers by doing a strict search for releasename

Example (just 1 movie):

User adds Frequency.2000.1080p.BluRay.x264-PSYCHD -> gets parsed to Frequency (2000) with proper imdb info and whatnot -> system issues an exact search for Frequency.2000.1080p.BluRay.x264-PSYCHD