mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Change no longer fetch xml and zip and adjust code inline with library updates.
This commit is contained in:
parent
3ab45e19d5
commit
837265b6f6
4 changed files with 17 additions and 16 deletions
|
@ -563,7 +563,7 @@ class Tvdb:
|
|||
|
||||
# get response from TVDB
|
||||
if self.config['cache_enabled']:
|
||||
session = CacheControl(cache=caches.FileCache(self.config['cache_location']))
|
||||
session = CacheControl(requests.session(), cache=caches.FileCache(self.config['cache_location']))
|
||||
if self.config['proxy']:
|
||||
log().debug("Using proxy for URL: %s" % url)
|
||||
session.proxies = {
|
||||
|
@ -571,7 +571,7 @@ class Tvdb:
|
|||
"https": self.config['proxy'],
|
||||
}
|
||||
|
||||
resp = session.get(url, cache_auto=True, params=params)
|
||||
resp = session.get(url, params=params)
|
||||
else:
|
||||
resp = requests.get(url, params=params)
|
||||
except requests.exceptions.HTTPError, e:
|
||||
|
@ -836,15 +836,14 @@ class Tvdb:
|
|||
|
||||
# Parse show information
|
||||
log().debug('Getting all series data for %s' % (sid))
|
||||
seriesInfoEt = self._getetsrc(
|
||||
self.config['url_seriesInfo'] % (sid, getShowInLanguage)
|
||||
)
|
||||
url = self.config['url_epInfo%s' % ('', '_zip')[self.config['useZip']]] % (sid, language)
|
||||
show_data = self._getetsrc(url, language=getShowInLanguage)
|
||||
|
||||
# check and make sure we have data to process and that it contains a series name
|
||||
if not len(seriesInfoEt) or (isinstance(seriesInfoEt, dict) and 'seriesname' not in seriesInfoEt['series']):
|
||||
if not len(show_data) or (isinstance(show_data, dict) and 'seriesname' not in show_data['series']):
|
||||
return False
|
||||
|
||||
for k, v in seriesInfoEt['series'].items():
|
||||
for k, v in show_data['series'].items():
|
||||
if v is not None:
|
||||
if k in ['banner', 'fanart', 'poster']:
|
||||
v = self.config['url_artworkPrefix'] % (v)
|
||||
|
@ -865,16 +864,10 @@ class Tvdb:
|
|||
# Parse episode data
|
||||
log().debug('Getting all episodes of %s' % (sid))
|
||||
|
||||
if self.config['useZip']:
|
||||
url = self.config['url_epInfo_zip'] % (sid, language)
|
||||
else:
|
||||
url = self.config['url_epInfo'] % (sid, language)
|
||||
|
||||
epsEt = self._getetsrc(url, language=language)
|
||||
if 'episode' not in epsEt:
|
||||
if 'episode' not in show_data:
|
||||
return False
|
||||
|
||||
episodes = epsEt['episode']
|
||||
episodes = show_data['episode']
|
||||
if not isinstance(episodes, list):
|
||||
episodes = [episodes]
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ class TVRage:
|
|||
"https": self.config['proxy'],
|
||||
}
|
||||
|
||||
resp = session.get(url.strip(), cache_auto=True, params=params)
|
||||
resp = session.get(url.strip(), params=params)
|
||||
else:
|
||||
resp = requests.get(url.strip(), params=params)
|
||||
|
||||
|
|
|
@ -1154,6 +1154,8 @@ def getURL(url, post_data=None, params=None, headers=None, timeout=30, session=N
|
|||
"""
|
||||
|
||||
# request session
|
||||
if None is session:
|
||||
session = requests.session()
|
||||
cache_dir = sickbeard.CACHE_DIR or _getTempDir()
|
||||
session = CacheControl(sess=session, cache=caches.FileCache(os.path.join(cache_dir, 'sessions')))
|
||||
|
||||
|
@ -1224,6 +1226,8 @@ def getURL(url, post_data=None, params=None, headers=None, timeout=30, session=N
|
|||
|
||||
def download_file(url, filename, session=None):
|
||||
# create session
|
||||
if None is session:
|
||||
session = requests.session()
|
||||
cache_dir = sickbeard.CACHE_DIR or _getTempDir()
|
||||
session = CacheControl(sess=session, cache=caches.FileCache(os.path.join(cache_dir, 'sessions')))
|
||||
|
||||
|
|
|
@ -485,6 +485,10 @@ class TVShow(object):
|
|||
cachedShow = t[self.indexerid]
|
||||
cachedSeasons = {}
|
||||
|
||||
if None is cachedShow:
|
||||
logger.log(u'No cache showdata to parse from %s' % sickbeard.indexerApi(self.indexer).name)
|
||||
return scannedEps
|
||||
|
||||
for curResult in sqlResults:
|
||||
|
||||
deleteEp = False
|
||||
|
|
Loading…
Reference in a new issue