From fb0339a274154deb3fb41c7dcf3d8a39f88d8303 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 27 Apr 2014 06:46:08 -0700 Subject: [PATCH] Fix for sql mass add issues. Fix for KAT and TPB providers. Fix for Newznab providers. --- sickbeard/providers/generic.py | 2 +- sickbeard/providers/kat.py | 7 +++++++ sickbeard/providers/thepiratebay.py | 6 +++++- sickbeard/webserve.py | 5 ++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index 3181e619..47fd1e5c 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -381,4 +381,4 @@ class TorrentProvider(GenericProvider): def __init__(self, name): GenericProvider.__init__(self, name) - self.providerType = GenericProvider.TORRENT \ No newline at end of file + self.providerType = GenericProvider.TORRENT diff --git a/sickbeard/providers/kat.py b/sickbeard/providers/kat.py index c25750f9..74a643ea 100644 --- a/sickbeard/providers/kat.py +++ b/sickbeard/providers/kat.py @@ -172,6 +172,8 @@ class KATProvider(generic.TorrentProvider): if not show: return [] + self.show = show + for show_name in set(allPossibleShowNames(show)): ep_string = show_name + ' S%02d' % int(season) + ' -S%02d' % int(season) + 'E' + ' category:tv' #1) ShowName SXX -SXXE search_string['Season'].append(ep_string) @@ -184,6 +186,11 @@ class KATProvider(generic.TorrentProvider): def _get_episode_search_strings(self, show, season, episode, abd=False, add_string=''): search_string = {'Episode': []} + if not show: + return [] + + self.show = show + if abd: for show_name in set(allPossibleShowNames(show)): ep_string = sanitizeSceneName(show_name) + ' ' + \ diff --git a/sickbeard/providers/thepiratebay.py b/sickbeard/providers/thepiratebay.py index 2dcd2797..5e5e7ba6 100644 --- a/sickbeard/providers/thepiratebay.py +++ b/sickbeard/providers/thepiratebay.py @@ -177,6 +177,8 @@ class ThePirateBayProvider(generic.TorrentProvider): if not show: return [] + self.show = show + search_string = {'Season': [], 'Episode': []} for show_name in set(allPossibleShowNames(show)): ep_string = show_name + ' S%02d' % int(season) #1) ShowName SXX @@ -193,9 +195,11 @@ class ThePirateBayProvider(generic.TorrentProvider): search_string = {'Episode': []} - if not episode: + if not show: return [] + self.show = show + if abd: for show_name in set(allPossibleShowNames(show)): ep_string = sanitizeSceneName(show_name) + ' ' + \ diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 6fe6e71e..dcaa146c 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -3166,7 +3166,10 @@ class Home: continue epObj.status = int(status) - sql_l.append(epObj.get_sql()) + + # mass add to database + if epObj.dirty: + sql_l.append(epObj.get_sql()) if len(sql_l) > 0: myDB = db.DBConnection()