From 23348e0bd0d26f6ab258c113de8925733c9b582a Mon Sep 17 00:00:00 2001 From: echel0n Date: Tue, 1 Apr 2014 22:44:47 -0700 Subject: [PATCH] Fixed bug for returning requests object exceptions --- lib/tvdb_api/tvdb_api.py | 1 + lib/tvrage_api/tvrage_api.py | 1 + sickbeard/clients/generic.py | 2 +- sickbeard/helpers.py | 1 + sickbeard/indexers/test/test.py | 19 ++++--------------- sickbeard/postProcessor.py | 8 ++++---- sickbeard/providers/hdtorrents.py | 1 + sickbeard/providers/iptorrents.py | 1 + sickbeard/providers/kat.py | 1 + sickbeard/providers/nextgen.py | 1 + sickbeard/providers/publichd.py | 1 + sickbeard/providers/rsstorrent.py | 1 + sickbeard/providers/scc.py | 1 + sickbeard/providers/thepiratebay.py | 1 + sickbeard/providers/torrentday.py | 1 + sickbeard/providers/torrentleech.py | 1 + sickbeard/scene_numbering.py | 1 + 17 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index 19be0196..14c74412 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -37,6 +37,7 @@ except ImportError: gzip = None from lib import requests +from lib.requests import exceptions from lib import cachecontrol from lib.cachecontrol import caches diff --git a/lib/tvrage_api/tvrage_api.py b/lib/tvrage_api/tvrage_api.py index 549ecd8a..1e7128d2 100644 --- a/lib/tvrage_api/tvrage_api.py +++ b/lib/tvrage_api/tvrage_api.py @@ -32,6 +32,7 @@ except ImportError: from lib.dateutil.parser import parse from lib import requests +from lib.requests import exceptions from lib import cachecontrol from lib.cachecontrol import caches diff --git a/sickbeard/clients/generic.py b/sickbeard/clients/generic.py index d7585a1e..253ca07e 100644 --- a/sickbeard/clients/generic.py +++ b/sickbeard/clients/generic.py @@ -9,7 +9,7 @@ from sickbeard.exceptions import ex from sickbeard.clients import http_error_code from lib.bencode import bencode, bdecode from lib import requests - +from lib.requests import exceptions class GenericClient(object): def __init__(self, name, host=None, username=None, password=None): diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 0297e42e..e9b61bfc 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -34,6 +34,7 @@ import base64 import string from lib import requests +from lib.requests import exceptions from itertools import izip, cycle try: diff --git a/sickbeard/indexers/test/test.py b/sickbeard/indexers/test/test.py index c0690a22..f1b279e0 100644 --- a/sickbeard/indexers/test/test.py +++ b/sickbeard/indexers/test/test.py @@ -16,21 +16,10 @@ class APICheck(unittest.TestCase): indexer_id = 2930 lang = "en" - for indexer in sickbeard.indexerApi.indexers(): - print indexer - print sickbeard.indexerApi().config['langabbv_to_id'][lang] - print sickbeard.indexerApi(indexer).cache - print sickbeard.indexerApi(indexer).name - print sickbeard.indexerApi(indexer).config['scene_url'] - print sickbeard.indexerApi().config['valid_languages'] - - lINDEXER_API_PARMS = sickbeard.indexerApi(indexer).api_params.copy() - lINDEXER_API_PARMS['cache'] = True - t = sickbeard.indexerApi(indexer).indexer(**lINDEXER_API_PARMS) - epObj = t[indexer_id].airedOn(1)[0] - - season = int(epObj["seasonnumber"]) - episodes = [int(epObj["episodenumber"])] + lINDEXER_API_PARMS = sickbeard.indexerApi(2).api_params.copy() + t = sickbeard.indexerApi(2).indexer(**lINDEXER_API_PARMS) + epObj = t[2930] + print epObj if __name__ == "__main__": unittest.main() \ No newline at end of file diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index 6e290721..fa561465 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -988,16 +988,16 @@ class PostProcessor(object): try: # move the episode and associated files to the show dir - if self.process_method == "copy": + if self.process_method is "copy": self._copy(self.file_path, dest_path, new_base_name, sickbeard.MOVE_ASSOCIATED_FILES, sickbeard.USE_SUBTITLES and ep_obj.show.subtitles) - elif self.process_method == "move": + elif self.process_method is "move": self._move(self.file_path, dest_path, new_base_name, sickbeard.MOVE_ASSOCIATED_FILES, sickbeard.USE_SUBTITLES and ep_obj.show.subtitles) - elif self.process_method == "hardlink": + elif self.process_method is "hardlink": self._hardlink(self.file_path, dest_path, new_base_name, sickbeard.MOVE_ASSOCIATED_FILES, sickbeard.USE_SUBTITLES and ep_obj.show.subtitles) - elif self.process_method == "symlink": + elif self.process_method is "symlink": self._moveAndSymlink(self.file_path, dest_path, new_base_name, sickbeard.MOVE_ASSOCIATED_FILES, sickbeard.USE_SUBTITLES and ep_obj.show.subtitles) else: diff --git a/sickbeard/providers/hdtorrents.py b/sickbeard/providers/hdtorrents.py index 00991dc1..41056a5f 100644 --- a/sickbeard/providers/hdtorrents.py +++ b/sickbeard/providers/hdtorrents.py @@ -34,6 +34,7 @@ from sickbeard.common import Overview from sickbeard.exceptions import ex from sickbeard import clients from lib import requests +from lib.requests import exceptions from bs4 import BeautifulSoup from lib.unidecode import unidecode diff --git a/sickbeard/providers/iptorrents.py b/sickbeard/providers/iptorrents.py index 17e847f5..005695db 100644 --- a/sickbeard/providers/iptorrents.py +++ b/sickbeard/providers/iptorrents.py @@ -33,6 +33,7 @@ from sickbeard.common import Overview from sickbeard.exceptions import ex from sickbeard import clients from lib import requests +from lib.requests import exceptions from bs4 import BeautifulSoup from lib.unidecode import unidecode diff --git a/sickbeard/providers/kat.py b/sickbeard/providers/kat.py index a3e82536..4530037f 100644 --- a/sickbeard/providers/kat.py +++ b/sickbeard/providers/kat.py @@ -42,6 +42,7 @@ from sickbeard import clients from sickbeard import tv from lib import requests +from lib.requests import exceptions from bs4 import BeautifulSoup from lib.unidecode import unidecode diff --git a/sickbeard/providers/nextgen.py b/sickbeard/providers/nextgen.py index 0e3dc9e6..8a7f2888 100644 --- a/sickbeard/providers/nextgen.py +++ b/sickbeard/providers/nextgen.py @@ -36,6 +36,7 @@ from sickbeard.common import Overview from sickbeard.exceptions import ex from sickbeard import clients from lib import requests +from lib.requests import exceptions from bs4 import BeautifulSoup diff --git a/sickbeard/providers/publichd.py b/sickbeard/providers/publichd.py index 19378524..a81c4e8d 100644 --- a/sickbeard/providers/publichd.py +++ b/sickbeard/providers/publichd.py @@ -41,6 +41,7 @@ from sickbeard import encodingKludge as ek from sickbeard import clients from lib import requests +from lib.requests import exceptions from bs4 import BeautifulSoup from lib.unidecode import unidecode diff --git a/sickbeard/providers/rsstorrent.py b/sickbeard/providers/rsstorrent.py index 1b21ae90..0b417fde 100644 --- a/sickbeard/providers/rsstorrent.py +++ b/sickbeard/providers/rsstorrent.py @@ -32,6 +32,7 @@ from sickbeard import clients from sickbeard.exceptions import ex from lib import requests +from lib.requests import exceptions from bs4 import BeautifulSoup from lib.bencode import bdecode diff --git a/sickbeard/providers/scc.py b/sickbeard/providers/scc.py index b87d519c..bd6ca57f 100644 --- a/sickbeard/providers/scc.py +++ b/sickbeard/providers/scc.py @@ -34,6 +34,7 @@ from sickbeard.common import Overview from sickbeard.exceptions import ex from sickbeard import clients from lib import requests +from lib.requests import exceptions from bs4 import BeautifulSoup from lib.unidecode import unidecode diff --git a/sickbeard/providers/thepiratebay.py b/sickbeard/providers/thepiratebay.py index 721dc5f3..26fe5b07 100644 --- a/sickbeard/providers/thepiratebay.py +++ b/sickbeard/providers/thepiratebay.py @@ -38,6 +38,7 @@ from sickbeard.common import Overview from sickbeard.exceptions import ex from sickbeard import encodingKludge as ek from lib import requests +from lib.requests import exceptions from lib.unidecode import unidecode proxy_dict = { diff --git a/sickbeard/providers/torrentday.py b/sickbeard/providers/torrentday.py index c0a46352..565a1872 100644 --- a/sickbeard/providers/torrentday.py +++ b/sickbeard/providers/torrentday.py @@ -33,6 +33,7 @@ from sickbeard.common import Overview from sickbeard.exceptions import ex from sickbeard import clients from lib import requests +from lib.requests import exceptions from bs4 import BeautifulSoup from lib.unidecode import unidecode diff --git a/sickbeard/providers/torrentleech.py b/sickbeard/providers/torrentleech.py index 45a095c3..b1d2c8db 100644 --- a/sickbeard/providers/torrentleech.py +++ b/sickbeard/providers/torrentleech.py @@ -33,6 +33,7 @@ from sickbeard.common import Overview from sickbeard.exceptions import ex from sickbeard import clients from lib import requests +from lib.requests import exceptions from bs4 import BeautifulSoup from lib.unidecode import unidecode diff --git a/sickbeard/scene_numbering.py b/sickbeard/scene_numbering.py index 48056906..6b9d29db 100644 --- a/sickbeard/scene_numbering.py +++ b/sickbeard/scene_numbering.py @@ -34,6 +34,7 @@ from sickbeard import db from sickbeard import helpers from sickbeard.exceptions import ex from lib import requests +from lib.requests import exceptions MAX_XEM_AGE_SECS = 86400 # 1 day