From fea411617435f5e92399b82ac00d8c65b36fa829 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 23 Aug 2014 11:53:31 +0800 Subject: [PATCH 1/6] Fixes anime exceptions being cleared when editing the exceptions on editShow page --- sickbeard/scene_exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sickbeard/scene_exceptions.py b/sickbeard/scene_exceptions.py index 0a94de06..1febcbbc 100644 --- a/sickbeard/scene_exceptions.py +++ b/sickbeard/scene_exceptions.py @@ -258,7 +258,7 @@ def update_scene_exceptions(indexer_id, scene_exceptions, season=-1): """ global exceptionsCache myDB = db.DBConnection('cache.db') - myDB.action('DELETE FROM scene_exceptions WHERE indexer_id=?', [indexer_id]) + myDB.action('DELETE FROM scene_exceptions WHERE indexer_id=? and season=?', [indexer_id, season]) logger.log(u"Updating scene exceptions", logger.MESSAGE) From 4b6602797fe71c7396c30fc0e980c2fe09da67f0 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sat, 23 Aug 2014 14:39:10 -0700 Subject: [PATCH 2/6] Fix for newznab provider searches unicode issues --- sickbeard/providers/generic.py | 14 ++++++++++---- sickbeard/providers/newznab.py | 5 +---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index e3f19e69..2f82e811 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -221,16 +221,22 @@ class GenericProvider: Returns: A tuple containing two strings representing title and URL respectively """ - title = item.title if item.title else None + title = None + url = None + + if 'title' in item: + title = item.title + if title: - title = u'' + title title = title.replace(' ', '.') - url = item.link if item.link else None + if 'link' in item: + url = item.link + if url: url = url.replace('&', '&') - return (title, url) + return title, url def findSearchResults(self, show, season, episodes, search_mode, manualSearch=False): diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index cf8289c0..ce676425 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -206,7 +206,6 @@ class NewznabProvider(generic.NZBProvider): params['apikey'] = self.key results = [] - keep_searching = 1 while True: search_url = self.url + 'api?' + urllib.urlencode(params) @@ -219,7 +218,7 @@ class NewznabProvider(generic.NZBProvider): (title, url) = self._get_title_and_url(item) if title and url: - results.append(item) + results.append(title,url) else: logger.log( u"The data returned from the " + self.name + " is incomplete, this result is unusable", @@ -247,8 +246,6 @@ class NewznabProvider(generic.NZBProvider): return results - - def findPropers(self, search_date=None): search_terms = ['.proper.', '.repack.'] From fc6fe9e777751a571b3aad5cba96e129284a6974 Mon Sep 17 00:00:00 2001 From: sammy2142 Date: Sun, 24 Aug 2014 19:46:26 +0100 Subject: [PATCH 3/6] Should fix some utorrent, rtorrent and deluge problems. This commit essentially undoes https://github.com/echel0n/SickRage/commit/54afca04725be05a73b4ab009e60cb5b146768cb The utorrent, rtorrent and deluge methods were still using result.hash to set label, seed ratio and priority etc (instead of torrent_hash which the commit referenced above changed it to). I've changed it back to result.hash in this commit. Reference problem posts: https://sickrage.tv/forums/forum/help-support/bug-issue-reports/7493-utorrent-unable-to-send-torrent https://sickrage.tv/forums/forum/help-support/bug-issue-reports/7533-sickrage-not-sending-tv-label-to-utorrent https://sickrage.tv/forums/forum/help-support/bug-issue-reports/7541-bug-rtorrent-unable-to-send-torrent --- sickbeard/clients/generic.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sickbeard/clients/generic.py b/sickbeard/clients/generic.py index d9c6fd20..6e47f101 100644 --- a/sickbeard/clients/generic.py +++ b/sickbeard/clients/generic.py @@ -143,14 +143,15 @@ class GenericClient(object): def _get_torrent_hash(self, result): if result.url.startswith('magnet'): - torrent_hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0] - if len(torrent_hash) == 32: - torrent_hash = b16encode(b32decode(torrent_hash)).lower() + result.hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0] + if len(result.hash) == 32: + result.hash = b16encode(b32decode(torrent_hash)).lower() else: + result.content = result.provider.getURL(result.url) info = bdecode(result.content)["info"] - torrent_hash = sha1(bencode(info)).hexdigest() + result.hash = sha1(bencode(info)).hexdigest() - return torrent_hash + return result def sendTORRENT(self, result): From ba5e5478e02b83045348ca5a83a495c4d8a00c70 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 25 Aug 2014 11:32:41 +0800 Subject: [PATCH 4/6] Fixes typo in previous commit --- sickbeard/clients/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sickbeard/clients/generic.py b/sickbeard/clients/generic.py index 6e47f101..a3465719 100644 --- a/sickbeard/clients/generic.py +++ b/sickbeard/clients/generic.py @@ -145,7 +145,7 @@ class GenericClient(object): if result.url.startswith('magnet'): result.hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0] if len(result.hash) == 32: - result.hash = b16encode(b32decode(torrent_hash)).lower() + result.hash = b16encode(b32decode(result.hash)).lower() else: result.content = result.provider.getURL(result.url) info = bdecode(result.content)["info"] From 58ff85d0305b29c2401f61d2a7f1c45b620fb1d7 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 25 Aug 2014 11:49:00 +0800 Subject: [PATCH 5/6] Fix for utorrent label setting Fix for transmission client --- sickbeard/clients/generic.py | 3 +++ sickbeard/clients/transmission.py | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sickbeard/clients/generic.py b/sickbeard/clients/generic.py index a3465719..2b4f1209 100644 --- a/sickbeard/clients/generic.py +++ b/sickbeard/clients/generic.py @@ -167,6 +167,9 @@ class GenericClient(object): # Sets per provider seed ratio result.ratio = result.provider.seedRatio() + # lazy fix for now, I'm sure we already do this somewhere else too + result = self._get_torrent_hash(result) + if result.url.startswith('magnet'): r_code = self._add_torrent_uri(result) else: diff --git a/sickbeard/clients/transmission.py b/sickbeard/clients/transmission.py index a684c6c6..100f3d19 100644 --- a/sickbeard/clients/transmission.py +++ b/sickbeard/clients/transmission.py @@ -84,8 +84,6 @@ class TransmissionAPI(GenericClient): if result.ratio: ratio = result.ratio - torrent_id = self._get_torrent_hash(result) - mode = 0 if ratio: if float(ratio) == -1: @@ -95,7 +93,7 @@ class TransmissionAPI(GenericClient): ratio = float(ratio) mode = 1 # Stop seeding at seedRatioLimit - arguments = {'ids': [torrent_id], + arguments = {'ids': [result.hash], 'seedRatioLimit': ratio, 'seedRatioMode': mode } @@ -108,9 +106,7 @@ class TransmissionAPI(GenericClient): def _set_torrent_priority(self, result): - torrent_id = self._get_torrent_hash(result) - - arguments = {'ids': [torrent_id]} + arguments = {'ids': [result.hash]} if result.priority == -1: arguments['priority-low'] = [] From 905b41c46a22d52701615a06fcf68c4f021d9a55 Mon Sep 17 00:00:00 2001 From: adam111316 Date: Mon, 25 Aug 2014 12:41:36 +0800 Subject: [PATCH 6/6] Fixes issues with newznab providers --- sickbeard/providers/newznab.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index ce676425..9065efc5 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -212,13 +212,13 @@ class NewznabProvider(generic.NZBProvider): logger.log(u"Search url: " + search_url, logger.DEBUG) data = self.cache.getRSSFeed(search_url) - if data and self._checkAuthFromData(data): - for item in data: + if data and 'entries' in data and self._checkAuthFromData(data): + for item in data.entries: (title, url) = self._get_title_and_url(item) if title and url: - results.append(title,url) + results.append(item) else: logger.log( u"The data returned from the " + self.name + " is incomplete, this result is unusable",