From 4aae3c45eadc76ee276a305d26e9e862ace2eff2 Mon Sep 17 00:00:00 2001 From: mano3m <-> Date: Wed, 1 Aug 2012 02:38:00 +0200 Subject: [PATCH] Bug fixes, it should actually restart the download now --- couchpotato/core/downloaders/base.py | 4 ++-- couchpotato/core/downloaders/sabnzbd/main.py | 4 ++-- couchpotato/core/plugins/renamer/main.py | 20 +++++++++++++++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/couchpotato/core/downloaders/base.py b/couchpotato/core/downloaders/base.py index e0dad913..07536a49 100644 --- a/couchpotato/core/downloaders/base.py +++ b/couchpotato/core/downloaders/base.py @@ -15,10 +15,10 @@ class Downloader(Plugin): addEvent('download', self.download) addEvent('getdownloadfailed', self.getdownloadfailed) - def download(self, data = {}): + def download(self, data = {}, movie = {}, manual = False, filedata = None): pass - def getdownloadfailed(self, data = {}): + def getdownloadfailed(self, data = {}, movie = {}): pass def createNzbName(self, data, movie): diff --git a/couchpotato/core/downloaders/sabnzbd/main.py b/couchpotato/core/downloaders/sabnzbd/main.py index 10180991..010c1be2 100644 --- a/couchpotato/core/downloaders/sabnzbd/main.py +++ b/couchpotato/core/downloaders/sabnzbd/main.py @@ -65,8 +65,8 @@ class Sabnzbd(Downloader): log.error("Unknown error: " + result[:40]) return False - def getdownloadfailed(self, data = {}, movie = {}, manual = False): - if self.isDisabled(manual) or not self.isCorrectType(data.get('type')): + def getdownloadfailed(self, data = {}, movie = {}): + if self.isDisabled(manual = True) or not self.isCorrectType(data.get('type')): return log.info('Checking download status of "%s" at SABnzbd.', data.get('name')) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index f0887acf..8855df4d 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -482,7 +482,13 @@ class Renamer(Plugin): rels = db.query(Relea).filter_by(status_id = snatched_status.get('id')) for rel in rels: - log.debug('Checking snatched release: %s' , rel.movie.library.titles[0].title) + + # Get current selected title + default_title = '' + for title in rel.movie.library.titles: + if title.default: default_title = title.title + + log.debug('Checking snatched movie: %s' , default_title) item = {} for info in rel.info: @@ -506,6 +512,18 @@ class Renamer(Plugin): db.commit() # search/download again + # if downloaded manually: # this is currently not stored... + # log.info('Download of %s failed...', item['name']) + # return + + #update movie to reflect release status update + mov = rel.movie.to_dict({ + 'profile': {'types': {'quality': {}}}, + 'releases': {'status': {}, 'quality': {}}, + 'library': {'titles': {}, 'files':{}}, + 'files': {} + }) + log.info('Download of %s failed, trying next release...', item['name']) fireEvent('searcher.single', mov)