mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-04 15:12:23 -05:00
Fix for issue #946 - Adding of shows via webAPI was failing.
Improvements made to Indexer's API modules, better error handling for missing or incomplete shows, shows that don't have actor or banner info are now properly error handled as well.
This commit is contained in:
parent
a9b44a156d
commit
9a33ddf85c
@ -1,6 +1,6 @@
|
|||||||
# !/usr/bin/env python2
|
# !/usr/bin/env python2
|
||||||
# encoding:utf-8
|
# encoding:utf-8
|
||||||
#author:dbr/Ben
|
# author:dbr/Ben
|
||||||
#project:tvdb_api
|
#project:tvdb_api
|
||||||
#repository:http://github.com/dbr/tvdb_api
|
#repository:http://github.com/dbr/tvdb_api
|
||||||
#license:unlicense (http://unlicense.org/)
|
#license:unlicense (http://unlicense.org/)
|
||||||
@ -39,7 +39,7 @@ from lib.dateutil.parser import parse
|
|||||||
from lib.cachecontrol import CacheControl, caches
|
from lib.cachecontrol import CacheControl, caches
|
||||||
|
|
||||||
from tvdb_ui import BaseUI, ConsoleUI
|
from tvdb_ui import BaseUI, ConsoleUI
|
||||||
from tvdb_exceptions import (tvdb_error, tvdb_userabort, tvdb_shownotfound,
|
from tvdb_exceptions import (tvdb_error, tvdb_userabort, tvdb_shownotfound, tvdb_showincomplete,
|
||||||
tvdb_seasonnotfound, tvdb_episodenotfound, tvdb_attributenotfound)
|
tvdb_seasonnotfound, tvdb_episodenotfound, tvdb_attributenotfound)
|
||||||
|
|
||||||
|
|
||||||
@ -627,10 +627,9 @@ class Tvdb:
|
|||||||
"""Loads a URL using caching, returns an ElementTree of the source
|
"""Loads a URL using caching, returns an ElementTree of the source
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
src = self._loadUrl(url, params=params, language=language).values()[0]
|
return self._loadUrl(url, params=params, language=language).values()[0]
|
||||||
return src
|
except Exception, e:
|
||||||
except:
|
raise tvdb_error(e)
|
||||||
return []
|
|
||||||
|
|
||||||
def _setItem(self, sid, seas, ep, attrib, value):
|
def _setItem(self, sid, seas, ep, attrib, value):
|
||||||
"""Creates a new episode, creating Show(), Season() and
|
"""Creates a new episode, creating Show(), Season() and
|
||||||
@ -681,11 +680,7 @@ class Tvdb:
|
|||||||
log().debug("Searching for show %s" % series)
|
log().debug("Searching for show %s" % series)
|
||||||
self.config['params_getSeries']['seriesname'] = series
|
self.config['params_getSeries']['seriesname'] = series
|
||||||
|
|
||||||
try:
|
return self._getetsrc(self.config['url_getSeries'], self.config['params_getSeries']).values()[0]
|
||||||
seriesFound = self._getetsrc(self.config['url_getSeries'], self.config['params_getSeries']).values()[0]
|
|
||||||
return seriesFound
|
|
||||||
except:
|
|
||||||
return []
|
|
||||||
|
|
||||||
def _getSeries(self, series):
|
def _getSeries(self, series):
|
||||||
"""This searches TheTVDB.com for the series name,
|
"""This searches TheTVDB.com for the series name,
|
||||||
@ -694,13 +689,13 @@ class Tvdb:
|
|||||||
BaseUI is used to select the first result.
|
BaseUI is used to select the first result.
|
||||||
"""
|
"""
|
||||||
allSeries = self.search(series)
|
allSeries = self.search(series)
|
||||||
|
if not allSeries:
|
||||||
|
log().debug('Series result returned zero')
|
||||||
|
raise tvdb_shownotfound("Show search returned zero results (cannot find show on TVDB)")
|
||||||
|
|
||||||
if not isinstance(allSeries, list):
|
if not isinstance(allSeries, list):
|
||||||
allSeries = [allSeries]
|
allSeries = [allSeries]
|
||||||
|
|
||||||
if len(allSeries) == 0:
|
|
||||||
log().debug('Series result returned zero')
|
|
||||||
raise tvdb_shownotfound("Show-name search returned zero results (cannot find show on TVDB)")
|
|
||||||
|
|
||||||
if self.config['custom_ui'] is not None:
|
if self.config['custom_ui'] is not None:
|
||||||
log().debug("Using custom UI %s" % (repr(self.config['custom_ui'])))
|
log().debug("Using custom UI %s" % (repr(self.config['custom_ui'])))
|
||||||
CustomUI = self.config['custom_ui']
|
CustomUI = self.config['custom_ui']
|
||||||
@ -735,37 +730,38 @@ class Tvdb:
|
|||||||
"""
|
"""
|
||||||
log().debug('Getting season banners for %s' % (sid))
|
log().debug('Getting season banners for %s' % (sid))
|
||||||
bannersEt = self._getetsrc(self.config['url_seriesBanner'] % (sid))
|
bannersEt = self._getetsrc(self.config['url_seriesBanner'] % (sid))
|
||||||
|
|
||||||
|
if not bannersEt:
|
||||||
|
log().debug('Banners result returned zero')
|
||||||
|
return
|
||||||
|
|
||||||
banners = {}
|
banners = {}
|
||||||
|
for cur_banner in bannersEt['banner']:
|
||||||
|
bid = cur_banner['id']
|
||||||
|
btype = cur_banner['bannertype']
|
||||||
|
btype2 = cur_banner['bannertype2']
|
||||||
|
if btype is None or btype2 is None:
|
||||||
|
continue
|
||||||
|
if not btype in banners:
|
||||||
|
banners[btype] = {}
|
||||||
|
if not btype2 in banners[btype]:
|
||||||
|
banners[btype][btype2] = {}
|
||||||
|
if not bid in banners[btype][btype2]:
|
||||||
|
banners[btype][btype2][bid] = {}
|
||||||
|
|
||||||
try:
|
for k, v in cur_banner.items():
|
||||||
for cur_banner in bannersEt['banner']:
|
if k is None or v is None:
|
||||||
bid = cur_banner['id']
|
|
||||||
btype = cur_banner['bannertype']
|
|
||||||
btype2 = cur_banner['bannertype2']
|
|
||||||
if btype is None or btype2 is None:
|
|
||||||
continue
|
continue
|
||||||
if not btype in banners:
|
|
||||||
banners[btype] = {}
|
|
||||||
if not btype2 in banners[btype]:
|
|
||||||
banners[btype][btype2] = {}
|
|
||||||
if not bid in banners[btype][btype2]:
|
|
||||||
banners[btype][btype2][bid] = {}
|
|
||||||
|
|
||||||
for k, v in cur_banner.items():
|
k, v = k.lower(), v.lower()
|
||||||
if k is None or v is None:
|
banners[btype][btype2][bid][k] = v
|
||||||
continue
|
|
||||||
|
|
||||||
k, v = k.lower(), v.lower()
|
for k, v in banners[btype][btype2][bid].items():
|
||||||
banners[btype][btype2][bid][k] = v
|
if k.endswith("path"):
|
||||||
|
new_key = "_%s" % (k)
|
||||||
for k, v in banners[btype][btype2][bid].items():
|
log().debug("Transforming %s to %s" % (k, new_key))
|
||||||
if k.endswith("path"):
|
new_url = self.config['url_artworkPrefix'] % (v)
|
||||||
new_key = "_%s" % (k)
|
banners[btype][btype2][bid][new_key] = new_url
|
||||||
log().debug("Transforming %s to %s" % (k, new_key))
|
|
||||||
new_url = self.config['url_artworkPrefix'] % (v)
|
|
||||||
banners[btype][btype2][bid][new_key] = new_url
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
self._setShowData(sid, "_banners", banners)
|
self._setShowData(sid, "_banners", banners)
|
||||||
|
|
||||||
@ -796,21 +792,22 @@ class Tvdb:
|
|||||||
log().debug("Getting actors for %s" % (sid))
|
log().debug("Getting actors for %s" % (sid))
|
||||||
actorsEt = self._getetsrc(self.config['url_actorsInfo'] % (sid))
|
actorsEt = self._getetsrc(self.config['url_actorsInfo'] % (sid))
|
||||||
|
|
||||||
|
if not actorsEt:
|
||||||
|
log().debug('Actors result returned zero')
|
||||||
|
return
|
||||||
|
|
||||||
cur_actors = Actors()
|
cur_actors = Actors()
|
||||||
try:
|
for curActorItem in actorsEt["actor"]:
|
||||||
for curActorItem in actorsEt["actor"]:
|
curActor = Actor()
|
||||||
curActor = Actor()
|
for k, v in curActorItem.items():
|
||||||
for k, v in curActorItem.items():
|
k = k.lower()
|
||||||
k = k.lower()
|
if v is not None:
|
||||||
if v is not None:
|
if k == "image":
|
||||||
if k == "image":
|
v = self.config['url_artworkPrefix'] % (v)
|
||||||
v = self.config['url_artworkPrefix'] % (v)
|
else:
|
||||||
else:
|
v = self._cleanData(v)
|
||||||
v = self._cleanData(v)
|
curActor[k] = v
|
||||||
curActor[k] = v
|
cur_actors.append(curActor)
|
||||||
cur_actors.append(curActor)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
self._setShowData(sid, '_actors', cur_actors)
|
self._setShowData(sid, '_actors', cur_actors)
|
||||||
|
|
||||||
@ -840,18 +837,19 @@ class Tvdb:
|
|||||||
self.config['url_seriesInfo'] % (sid, getShowInLanguage)
|
self.config['url_seriesInfo'] % (sid, getShowInLanguage)
|
||||||
)
|
)
|
||||||
|
|
||||||
# get series data
|
if not seriesInfoEt:
|
||||||
try:
|
log().debug('Series result returned zero')
|
||||||
for k, v in seriesInfoEt['series'].items():
|
raise tvdb_shownotfound("Show search returned zero results (cannot find show on TVDB)")
|
||||||
if v is not None:
|
|
||||||
if k in ['banner', 'fanart', 'poster']:
|
|
||||||
v = self.config['url_artworkPrefix'] % (v)
|
|
||||||
else:
|
|
||||||
v = self._cleanData(v)
|
|
||||||
|
|
||||||
self._setShowData(sid, k, v)
|
# get series data
|
||||||
except:
|
for k, v in seriesInfoEt['series'].items():
|
||||||
return False
|
if v is not None:
|
||||||
|
if k in ['banner', 'fanart', 'poster']:
|
||||||
|
v = self.config['url_artworkPrefix'] % (v)
|
||||||
|
else:
|
||||||
|
v = self._cleanData(v)
|
||||||
|
|
||||||
|
self._setShowData(sid, k, v)
|
||||||
|
|
||||||
# get episode data
|
# get episode data
|
||||||
if getEpInfo:
|
if getEpInfo:
|
||||||
@ -865,18 +863,17 @@ class Tvdb:
|
|||||||
|
|
||||||
# Parse episode data
|
# Parse episode data
|
||||||
log().debug('Getting all episodes of %s' % (sid))
|
log().debug('Getting all episodes of %s' % (sid))
|
||||||
|
|
||||||
if self.config['useZip']:
|
if self.config['useZip']:
|
||||||
url = self.config['url_epInfo_zip'] % (sid, language)
|
url = self.config['url_epInfo_zip'] % (sid, language)
|
||||||
else:
|
else:
|
||||||
url = self.config['url_epInfo'] % (sid, language)
|
url = self.config['url_epInfo'] % (sid, language)
|
||||||
|
epsEt = self._getetsrc(url, language=language)
|
||||||
|
|
||||||
try:
|
if not epsEt:
|
||||||
epsEt = self._getetsrc(url, language=language)
|
log().debug('Series results incomplete')
|
||||||
episodes = epsEt["episode"]
|
raise tvdb_showincomplete("Show search returned incomplete results (cannot find complete show on TVDB)")
|
||||||
except:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
episodes = epsEt["episode"]
|
||||||
if not isinstance(episodes, list):
|
if not isinstance(episodes, list):
|
||||||
episodes = [episodes]
|
episodes = [episodes]
|
||||||
|
|
||||||
@ -940,7 +937,7 @@ class Tvdb:
|
|||||||
# Item is integer, treat as show id
|
# Item is integer, treat as show id
|
||||||
if key not in self.shows:
|
if key not in self.shows:
|
||||||
self._getShowData(key, self.config['language'], True)
|
self._getShowData(key, self.config['language'], True)
|
||||||
return (None, self.shows[key])[key in self.shows]
|
return self.shows[key]
|
||||||
|
|
||||||
key = str(key).lower()
|
key = str(key).lower()
|
||||||
self.config['searchterm'] = key
|
self.config['searchterm'] = key
|
||||||
@ -949,14 +946,10 @@ class Tvdb:
|
|||||||
selected_series = [selected_series]
|
selected_series = [selected_series]
|
||||||
[[self._setShowData(show['id'], k, v) for k, v in show.items()] for show in selected_series]
|
[[self._setShowData(show['id'], k, v) for k, v in show.items()] for show in selected_series]
|
||||||
return selected_series
|
return selected_series
|
||||||
#test = self._getSeries(key)
|
|
||||||
#sids = self._nameToSid(key)
|
|
||||||
#return list(self.shows[sid] for sid in sids)
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return str(self.shows)
|
return str(self.shows)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Simple example of using tvdb_api - it just
|
"""Simple example of using tvdb_api - it just
|
||||||
grabs an episode name interactively.
|
grabs an episode name interactively.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
__author__ = "dbr/Ben"
|
__author__ = "dbr/Ben"
|
||||||
__version__ = "1.9"
|
__version__ = "1.9"
|
||||||
|
|
||||||
__all__ = ["tvdb_error", "tvdb_userabort", "tvdb_shownotfound",
|
__all__ = ["tvdb_error", "tvdb_userabort", "tvdb_shownotfound", "tvdb_showincomplete",
|
||||||
"tvdb_seasonnotfound", "tvdb_episodenotfound", "tvdb_attributenotfound"]
|
"tvdb_seasonnotfound", "tvdb_episodenotfound", "tvdb_attributenotfound"]
|
||||||
|
|
||||||
class tvdb_exception(Exception):
|
class tvdb_exception(Exception):
|
||||||
@ -35,6 +35,11 @@ class tvdb_shownotfound(tvdb_exception):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class tvdb_showincomplete(tvdb_exception):
|
||||||
|
"""Show found but incomplete on thetvdb.com (incomplete show)
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
class tvdb_seasonnotfound(tvdb_exception):
|
class tvdb_seasonnotfound(tvdb_exception):
|
||||||
"""Season cannot be found on thetvdb.com
|
"""Season cannot be found on thetvdb.com
|
||||||
"""
|
"""
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# !/usr/bin/env python2
|
# !/usr/bin/env python2
|
||||||
# encoding:utf-8
|
# encoding:utf-8
|
||||||
#author:echel0n
|
# author:echel0n
|
||||||
#project:tvrage_api
|
# project:tvrage_api
|
||||||
#repository:http://github.com/echel0n/tvrage_api
|
#repository:http://github.com/echel0n/tvrage_api
|
||||||
#license:unlicense (http://unlicense.org/)
|
#license:unlicense (http://unlicense.org/)
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ from lib.dateutil.parser import parse
|
|||||||
from cachecontrol import CacheControl, caches
|
from cachecontrol import CacheControl, caches
|
||||||
|
|
||||||
from tvrage_ui import BaseUI
|
from tvrage_ui import BaseUI
|
||||||
from tvrage_exceptions import (tvrage_error, tvrage_userabort, tvrage_shownotfound,
|
from tvrage_exceptions import (tvrage_error, tvrage_userabort, tvrage_shownotfound, tvrage_showincomplete,
|
||||||
tvrage_seasonnotfound, tvrage_episodenotfound, tvrage_attributenotfound)
|
tvrage_seasonnotfound, tvrage_episodenotfound, tvrage_attributenotfound)
|
||||||
|
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ class ShowContainer(dict):
|
|||||||
if time.time() - self._lastgc > 20:
|
if time.time() - self._lastgc > 20:
|
||||||
for o in self._stack[:-100]:
|
for o in self._stack[:-100]:
|
||||||
del self[o]
|
del self[o]
|
||||||
|
|
||||||
self._stack = self._stack[-100:]
|
self._stack = self._stack[-100:]
|
||||||
|
|
||||||
self._lastgc = time.time()
|
self._lastgc = time.time()
|
||||||
@ -465,10 +465,6 @@ class TVRage:
|
|||||||
elif key == 'firstaired':
|
elif key == 'firstaired':
|
||||||
value = parse(value, fuzzy=True).date()
|
value = parse(value, fuzzy=True).date()
|
||||||
value = value.strftime("%Y-%m-%d")
|
value = value.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
#if key == 'airs_time':
|
|
||||||
# value = parse(value).time()
|
|
||||||
# value = value.strftime("%I:%M %p")
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -485,10 +481,9 @@ class TVRage:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
src = self._loadUrl(url, params).values()[0]
|
return self._loadUrl(url, params).values()[0]
|
||||||
return src
|
except Exception, e:
|
||||||
except:
|
raise tvrage_error(e)
|
||||||
return []
|
|
||||||
|
|
||||||
def _setItem(self, sid, seas, ep, attrib, value):
|
def _setItem(self, sid, seas, ep, attrib, value):
|
||||||
"""Creates a new episode, creating Show(), Season() and
|
"""Creates a new episode, creating Show(), Season() and
|
||||||
@ -518,9 +513,7 @@ class TVRage:
|
|||||||
"""
|
"""
|
||||||
if sid not in self.shows:
|
if sid not in self.shows:
|
||||||
self.shows[sid] = Show()
|
self.shows[sid] = Show()
|
||||||
|
self.shows[sid].data[key] = value
|
||||||
if not isinstance(key, dict or list) and not isinstance(value, dict or list):
|
|
||||||
self.shows[sid].data[key] = value
|
|
||||||
|
|
||||||
def _cleanData(self, data):
|
def _cleanData(self, data):
|
||||||
"""Cleans up strings returned by tvrage.com
|
"""Cleans up strings returned by tvrage.com
|
||||||
@ -544,11 +537,7 @@ class TVRage:
|
|||||||
log().debug("Searching for show %s" % series)
|
log().debug("Searching for show %s" % series)
|
||||||
self.config['params_getSeries']['show'] = series
|
self.config['params_getSeries']['show'] = series
|
||||||
|
|
||||||
try:
|
return self._getetsrc(self.config['url_getSeries'], self.config['params_getSeries']).values()[0]
|
||||||
seriesFound = self._getetsrc(self.config['url_getSeries'], self.config['params_getSeries']).values()[0]
|
|
||||||
return seriesFound
|
|
||||||
except:
|
|
||||||
return []
|
|
||||||
|
|
||||||
def _getSeries(self, series):
|
def _getSeries(self, series):
|
||||||
"""This searches tvrage.com for the series name,
|
"""This searches tvrage.com for the series name,
|
||||||
@ -557,13 +546,13 @@ class TVRage:
|
|||||||
BaseUI is used to select the first result.
|
BaseUI is used to select the first result.
|
||||||
"""
|
"""
|
||||||
allSeries = self.search(series)
|
allSeries = self.search(series)
|
||||||
|
if not allSeries:
|
||||||
|
log().debug('Series result returned zero')
|
||||||
|
raise tvrage_shownotfound("Show search returned zero results (cannot find show on TVRAGE)")
|
||||||
|
|
||||||
if not isinstance(allSeries, list):
|
if not isinstance(allSeries, list):
|
||||||
allSeries = [allSeries]
|
allSeries = [allSeries]
|
||||||
|
|
||||||
if len(allSeries) == 0:
|
|
||||||
log().debug('Series result returned zero')
|
|
||||||
raise tvrage_shownotfound("Show-name search returned zero results (cannot find show on TVRAGE)")
|
|
||||||
|
|
||||||
if self.config['custom_ui'] is not None:
|
if self.config['custom_ui'] is not None:
|
||||||
log().debug("Using custom UI %s" % (repr(self.config['custom_ui'])))
|
log().debug("Using custom UI %s" % (repr(self.config['custom_ui'])))
|
||||||
CustomUI = self.config['custom_ui']
|
CustomUI = self.config['custom_ui']
|
||||||
@ -588,54 +577,55 @@ class TVRage:
|
|||||||
self.config['params_seriesInfo']
|
self.config['params_seriesInfo']
|
||||||
)
|
)
|
||||||
|
|
||||||
# get series data
|
if not seriesInfoEt:
|
||||||
try:
|
log().debug('Series result returned zero')
|
||||||
for k, v in seriesInfoEt.items():
|
raise tvrage_shownotfound("Show search returned zero results (cannot find show on TVRAGE)")
|
||||||
if v is not None:
|
|
||||||
v = self._cleanData(v)
|
|
||||||
|
|
||||||
self._setShowData(sid, k, v)
|
# get series data
|
||||||
except:
|
for k, v in seriesInfoEt.items():
|
||||||
return False
|
if v is not None:
|
||||||
|
v = self._cleanData(v)
|
||||||
|
|
||||||
|
self._setShowData(sid, k, v)
|
||||||
|
|
||||||
# get episode data
|
# get episode data
|
||||||
if getEpInfo:
|
if getEpInfo:
|
||||||
# Parse episode data
|
# Parse episode data
|
||||||
log().debug('Getting all episodes of %s' % (sid))
|
log().debug('Getting all episodes of %s' % (sid))
|
||||||
|
|
||||||
self.config['params_epInfo']['sid'] = sid
|
self.config['params_epInfo']['sid'] = sid
|
||||||
|
epsEt = self._getetsrc(self.config['url_epInfo'], self.config['params_epInfo'])
|
||||||
|
|
||||||
try:
|
if not epsEt:
|
||||||
epsEt = self._getetsrc(self.config['url_epInfo'], self.config['params_epInfo'])
|
log().debug('Series results incomplete')
|
||||||
seasons = epsEt['episodelist']['season']
|
raise tvrage_showincomplete(
|
||||||
except:
|
"Show search returned incomplete results (cannot find complete show on TVRAGE)")
|
||||||
return False
|
|
||||||
|
|
||||||
|
seasons = epsEt['episodelist']['season']
|
||||||
if not isinstance(seasons, list):
|
if not isinstance(seasons, list):
|
||||||
seasons = [seasons]
|
seasons = [seasons]
|
||||||
|
|
||||||
for season in seasons:
|
for season in seasons:
|
||||||
seas_no = int(season['@no'])
|
seas_no = int(season['@no'])
|
||||||
|
|
||||||
episodes = season['episode']
|
episodes = season['episode']
|
||||||
if not isinstance(episodes, list):
|
if not isinstance(episodes, list):
|
||||||
episodes = [episodes]
|
episodes = [episodes]
|
||||||
|
|
||||||
for episode in episodes:
|
for episode in episodes:
|
||||||
ep_no = int(episode['episodenumber'])
|
ep_no = int(episode['episodenumber'])
|
||||||
self._setItem(sid, seas_no, ep_no, 'seasonnumber', seas_no)
|
|
||||||
|
|
||||||
for k, v in episode.items():
|
for k, v in episode.items():
|
||||||
try:
|
k = k.lower()
|
||||||
k = k.lower()
|
|
||||||
if v is not None:
|
if v is not None:
|
||||||
if k == 'link':
|
if k == 'link':
|
||||||
v = v.rsplit('/', 1)[1]
|
v = v.rsplit('/', 1)[1]
|
||||||
k = 'id'
|
k = 'id'
|
||||||
|
else:
|
||||||
v = self._cleanData(v)
|
v = self._cleanData(v)
|
||||||
|
|
||||||
self._setItem(sid, seas_no, ep_no, k, v)
|
self._setItem(sid, seas_no, ep_no, k, v)
|
||||||
except:
|
|
||||||
continue
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _nameToSid(self, name):
|
def _nameToSid(self, name):
|
||||||
@ -663,9 +653,9 @@ class TVRage:
|
|||||||
# Item is integer, treat as show id
|
# Item is integer, treat as show id
|
||||||
if key not in self.shows:
|
if key not in self.shows:
|
||||||
self._getShowData(key, True)
|
self._getShowData(key, True)
|
||||||
return (None, self.shows[key])[key in self.shows]
|
return self.shows[key]
|
||||||
|
|
||||||
key = key.lower()
|
key = str(key).lower()
|
||||||
self.config['searchterm'] = key
|
self.config['searchterm'] = key
|
||||||
selected_series = self._getSeries(key)
|
selected_series = self._getSeries(key)
|
||||||
if isinstance(selected_series, dict):
|
if isinstance(selected_series, dict):
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
#encoding:utf-8
|
# encoding:utf-8
|
||||||
#author:echel0n
|
#author:echel0n
|
||||||
#project:tvrage_api
|
#project:tvrage_api
|
||||||
#repository:http://github.com/echel0n/tvrage_api
|
#repository:http://github.com/echel0n/tvrage_api
|
||||||
@ -10,40 +10,53 @@
|
|||||||
__author__ = "echel0n"
|
__author__ = "echel0n"
|
||||||
__version__ = "1.0"
|
__version__ = "1.0"
|
||||||
|
|
||||||
__all__ = ["tvrage_error", "tvrage_userabort", "tvrage_shownotfound",
|
__all__ = ["tvrage_error", "tvrage_userabort", "tvrage_shownotfound", "tvrage_showincomplete",
|
||||||
"tvrage_seasonnotfound", "tvrage_episodenotfound", "tvrage_attributenotfound"]
|
"tvrage_seasonnotfound", "tvrage_episodenotfound", "tvrage_attributenotfound"]
|
||||||
|
|
||||||
|
|
||||||
class tvrage_exception(Exception):
|
class tvrage_exception(Exception):
|
||||||
"""Any exception generated by tvrage_api
|
"""Any exception generated by tvrage_api
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class tvrage_error(tvrage_exception):
|
class tvrage_error(tvrage_exception):
|
||||||
"""An error with tvrage.com (Cannot connect, for example)
|
"""An error with tvrage.com (Cannot connect, for example)
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class tvrage_userabort(tvrage_exception):
|
class tvrage_userabort(tvrage_exception):
|
||||||
"""User aborted the interactive selection (via
|
"""User aborted the interactive selection (via
|
||||||
the q command, ^c etc)
|
the q command, ^c etc)
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class tvrage_shownotfound(tvrage_exception):
|
class tvrage_shownotfound(tvrage_exception):
|
||||||
"""Show cannot be found on tvrage.com (non-existant show)
|
"""Show cannot be found on tvrage.com (non-existant show)
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class tvrage_showincomplete(tvrage_exception):
|
||||||
|
"""Show found but incomplete on tvrage.com (incomplete show)
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class tvrage_seasonnotfound(tvrage_exception):
|
class tvrage_seasonnotfound(tvrage_exception):
|
||||||
"""Season cannot be found on tvrage.com
|
"""Season cannot be found on tvrage.com
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class tvrage_episodenotfound(tvrage_exception):
|
class tvrage_episodenotfound(tvrage_exception):
|
||||||
"""Episode cannot be found on tvrage.com
|
"""Episode cannot be found on tvrage.com
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class tvrage_attributenotfound(tvrage_exception):
|
class tvrage_attributenotfound(tvrage_exception):
|
||||||
"""Raised if an episode does not have the requested
|
"""Raised if an episode does not have the requested
|
||||||
attribute (such as a episode name)
|
attribute (such as a episode name)
|
||||||
|
@ -45,8 +45,8 @@ from sickbeard import naming
|
|||||||
from sickbeard import dailysearcher
|
from sickbeard import dailysearcher
|
||||||
from sickbeard import scene_numbering, scene_exceptions, name_cache
|
from sickbeard import scene_numbering, scene_exceptions, name_cache
|
||||||
from indexers.indexer_api import indexerApi
|
from indexers.indexer_api import indexerApi
|
||||||
from indexers.indexer_exceptions import indexer_shownotfound, indexer_exception, indexer_error, indexer_episodenotfound, \
|
from indexers.indexer_exceptions import indexer_shownotfound, indexer_showincomplete, indexer_exception, indexer_error, \
|
||||||
indexer_attributenotfound, indexer_seasonnotfound, indexer_userabort, indexerExcepts
|
indexer_episodenotfound, indexer_attributenotfound, indexer_seasonnotfound, indexer_userabort, indexerExcepts
|
||||||
from sickbeard.common import SD, SKIPPED, NAMING_REPEAT
|
from sickbeard.common import SD, SKIPPED, NAMING_REPEAT
|
||||||
from sickbeard.databases import mainDB, cache_db, failed_db
|
from sickbeard.databases import mainDB, cache_db, failed_db
|
||||||
|
|
||||||
@ -466,10 +466,12 @@ TRAKT_API_KEY = 'abd806c54516240c76e4ebc9c5ccf394'
|
|||||||
|
|
||||||
__INITIALIZED__ = False
|
__INITIALIZED__ = False
|
||||||
|
|
||||||
|
|
||||||
def get_backlog_cycle_time():
|
def get_backlog_cycle_time():
|
||||||
cycletime = DAILYSEARCH_FREQUENCY * 2 + 7
|
cycletime = DAILYSEARCH_FREQUENCY * 2 + 7
|
||||||
return max([cycletime, 720])
|
return max([cycletime, 720])
|
||||||
|
|
||||||
|
|
||||||
def initialize(consoleLogging=True):
|
def initialize(consoleLogging=True):
|
||||||
with INIT_LOCK:
|
with INIT_LOCK:
|
||||||
|
|
||||||
@ -548,7 +550,8 @@ def initialize(consoleLogging=True):
|
|||||||
|
|
||||||
# git_remote
|
# git_remote
|
||||||
GIT_REMOTE = check_setting_str(CFG, 'General', 'git_remote', 'origin')
|
GIT_REMOTE = check_setting_str(CFG, 'General', 'git_remote', 'origin')
|
||||||
GIT_REMOTE_URL = check_setting_str(CFG, 'General', 'git_remote_url', 'https://github.com/SiCKRAGETV/SickRage.git')
|
GIT_REMOTE_URL = check_setting_str(CFG, 'General', 'git_remote_url',
|
||||||
|
'https://github.com/SiCKRAGETV/SickRage.git')
|
||||||
|
|
||||||
# current commit hash
|
# current commit hash
|
||||||
CUR_COMMIT_HASH = check_setting_str(CFG, 'General', 'cur_commit_hash', '')
|
CUR_COMMIT_HASH = check_setting_str(CFG, 'General', 'cur_commit_hash', '')
|
||||||
@ -659,7 +662,8 @@ def initialize(consoleLogging=True):
|
|||||||
NAMING_ABD_PATTERN = check_setting_str(CFG, 'General', 'naming_abd_pattern', '%SN - %A.D - %EN')
|
NAMING_ABD_PATTERN = check_setting_str(CFG, 'General', 'naming_abd_pattern', '%SN - %A.D - %EN')
|
||||||
NAMING_CUSTOM_ABD = bool(check_setting_int(CFG, 'General', 'naming_custom_abd', 0))
|
NAMING_CUSTOM_ABD = bool(check_setting_int(CFG, 'General', 'naming_custom_abd', 0))
|
||||||
NAMING_SPORTS_PATTERN = check_setting_str(CFG, 'General', 'naming_sports_pattern', '%SN - %A-D - %EN')
|
NAMING_SPORTS_PATTERN = check_setting_str(CFG, 'General', 'naming_sports_pattern', '%SN - %A-D - %EN')
|
||||||
NAMING_ANIME_PATTERN = check_setting_str(CFG, 'General', 'naming_anime_pattern', 'Season %0S/%SN - S%0SE%0E - %EN')
|
NAMING_ANIME_PATTERN = check_setting_str(CFG, 'General', 'naming_anime_pattern',
|
||||||
|
'Season %0S/%SN - S%0SE%0E - %EN')
|
||||||
NAMING_ANIME = check_setting_int(CFG, 'General', 'naming_anime', 3)
|
NAMING_ANIME = check_setting_int(CFG, 'General', 'naming_anime', 3)
|
||||||
NAMING_CUSTOM_SPORTS = bool(check_setting_int(CFG, 'General', 'naming_custom_sports', 0))
|
NAMING_CUSTOM_SPORTS = bool(check_setting_int(CFG, 'General', 'naming_custom_sports', 0))
|
||||||
NAMING_CUSTOM_ANIME = bool(check_setting_int(CFG, 'General', 'naming_custom_anime', 0))
|
NAMING_CUSTOM_ANIME = bool(check_setting_int(CFG, 'General', 'naming_custom_anime', 0))
|
||||||
@ -1466,7 +1470,7 @@ def save_config():
|
|||||||
new_config['General']['keep_processed_dir'] = int(KEEP_PROCESSED_DIR)
|
new_config['General']['keep_processed_dir'] = int(KEEP_PROCESSED_DIR)
|
||||||
new_config['General']['process_method'] = PROCESS_METHOD
|
new_config['General']['process_method'] = PROCESS_METHOD
|
||||||
new_config['General']['move_associated_files'] = int(MOVE_ASSOCIATED_FILES)
|
new_config['General']['move_associated_files'] = int(MOVE_ASSOCIATED_FILES)
|
||||||
new_config['General']['postpone_if_sync_files'] = int (POSTPONE_IF_SYNC_FILES)
|
new_config['General']['postpone_if_sync_files'] = int(POSTPONE_IF_SYNC_FILES)
|
||||||
new_config['General']['nfo_rename'] = int(NFO_RENAME)
|
new_config['General']['nfo_rename'] = int(NFO_RENAME)
|
||||||
new_config['General']['process_automatically'] = int(PROCESS_AUTOMATICALLY)
|
new_config['General']['process_automatically'] = int(PROCESS_AUTOMATICALLY)
|
||||||
new_config['General']['unpack'] = int(UNPACK)
|
new_config['General']['unpack'] = int(UNPACK)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
#encoding:utf-8
|
# encoding:utf-8
|
||||||
#author:echel0n
|
#author:echel0n
|
||||||
#project:indexer_api
|
#project:indexer_api
|
||||||
#repository:http://github.com/echel0n/Sick-Beard
|
#repository:http://github.com/echel0n/Sick-Beard
|
||||||
@ -12,19 +12,20 @@ __version__ = "1.0"
|
|||||||
|
|
||||||
from lib.tvrage_api.tvrage_exceptions import \
|
from lib.tvrage_api.tvrage_exceptions import \
|
||||||
tvrage_exception, tvrage_attributenotfound, tvrage_episodenotfound, tvrage_error, \
|
tvrage_exception, tvrage_attributenotfound, tvrage_episodenotfound, tvrage_error, \
|
||||||
tvrage_seasonnotfound, tvrage_shownotfound, tvrage_userabort
|
tvrage_seasonnotfound, tvrage_shownotfound, tvrage_showincomplete, tvrage_userabort
|
||||||
|
|
||||||
from lib.tvdb_api.tvdb_exceptions import \
|
from lib.tvdb_api.tvdb_exceptions import \
|
||||||
tvdb_exception, tvdb_attributenotfound, tvdb_episodenotfound, tvdb_error, \
|
tvdb_exception, tvdb_attributenotfound, tvdb_episodenotfound, tvdb_error, \
|
||||||
tvdb_seasonnotfound, tvdb_shownotfound, tvdb_userabort
|
tvdb_seasonnotfound, tvdb_shownotfound, tvdb_showincomplete, tvdb_userabort
|
||||||
|
|
||||||
indexerExcepts = ["indexer_exception", "indexer_error", "indexer_userabort", "indexer_shownotfound",
|
indexerExcepts = ["indexer_exception", "indexer_error", "indexer_userabort", "indexer_shownotfound",
|
||||||
|
"indexer_showincomplete",
|
||||||
"indexer_seasonnotfound", "indexer_episodenotfound", "indexer_attributenotfound"]
|
"indexer_seasonnotfound", "indexer_episodenotfound", "indexer_attributenotfound"]
|
||||||
|
|
||||||
tvdbExcepts = ["tvdb_exception", "tvdb_error", "tvdb_userabort", "tvdb_shownotfound",
|
tvdbExcepts = ["tvdb_exception", "tvdb_error", "tvdb_userabort", "tvdb_shownotfound", "tvdb_showincomplete",
|
||||||
"tvdb_seasonnotfound", "tvdb_episodenotfound", "tvdb_attributenotfound"]
|
"tvdb_seasonnotfound", "tvdb_episodenotfound", "tvdb_attributenotfound"]
|
||||||
|
|
||||||
tvrageExcepts = ["tvdb_exception", "tvrage_error", "tvrage_userabort", "tvrage_shownotfound",
|
tvrageExcepts = ["tvdb_exception", "tvrage_error", "tvrage_userabort", "tvrage_shownotfound", "tvrage_showincomplete",
|
||||||
"tvrage_seasonnotfound", "tvrage_episodenotfound", "tvrage_attributenotfound"]
|
"tvrage_seasonnotfound", "tvrage_episodenotfound", "tvrage_attributenotfound"]
|
||||||
|
|
||||||
# link API exceptions to our exception handler
|
# link API exceptions to our exception handler
|
||||||
@ -34,4 +35,5 @@ indexer_userabort = tvdb_userabort, tvrage_userabort
|
|||||||
indexer_attributenotfound = tvdb_attributenotfound, tvrage_attributenotfound
|
indexer_attributenotfound = tvdb_attributenotfound, tvrage_attributenotfound
|
||||||
indexer_episodenotfound = tvdb_episodenotfound, tvrage_episodenotfound
|
indexer_episodenotfound = tvdb_episodenotfound, tvrage_episodenotfound
|
||||||
indexer_seasonnotfound = tvdb_seasonnotfound, tvrage_seasonnotfound
|
indexer_seasonnotfound = tvdb_seasonnotfound, tvrage_seasonnotfound
|
||||||
indexer_shownotfound = tvdb_shownotfound, tvrage_shownotfound
|
indexer_shownotfound = tvdb_shownotfound, tvrage_shownotfound
|
||||||
|
indexer_showincomplete = tvdb_showincomplete, tvrage_showincomplete
|
@ -73,7 +73,6 @@ class Api(webserve.MainHandler):
|
|||||||
intent = 4
|
intent = 4
|
||||||
|
|
||||||
def index(self, *args, **kwargs):
|
def index(self, *args, **kwargs):
|
||||||
|
|
||||||
self.apiKey = sickbeard.API_KEY
|
self.apiKey = sickbeard.API_KEY
|
||||||
access, accessMsg, args, kwargs = self._grand_access(self.apiKey, args, kwargs)
|
access, accessMsg, args, kwargs = self._grand_access(self.apiKey, args, kwargs)
|
||||||
|
|
||||||
@ -373,7 +372,7 @@ class ApiCall(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# auto-select indexer
|
# auto-select indexer
|
||||||
if key == "indexerid":
|
if key in indexer_ids:
|
||||||
if "tvdbid" in kwargs:
|
if "tvdbid" in kwargs:
|
||||||
key = "tvdbid"
|
key = "tvdbid"
|
||||||
elif "tvrageid" in kwargs:
|
elif "tvrageid" in kwargs:
|
||||||
@ -1132,6 +1131,7 @@ class CMD_Exceptions(ApiCall):
|
|||||||
# required
|
# required
|
||||||
# optional
|
# optional
|
||||||
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, False, "int", [])
|
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, False, "int", [])
|
||||||
|
|
||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, handler, args, kwargs)
|
ApiCall.__init__(self, handler, args, kwargs)
|
||||||
|
|
||||||
@ -1642,7 +1642,6 @@ class CMD_SickBeardSearchIndexers(ApiCall):
|
|||||||
self.lang, args = self.check_params(args, kwargs, "lang", "en", False, "string", self.valid_languages.keys())
|
self.lang, args = self.check_params(args, kwargs, "lang", "en", False, "string", self.valid_languages.keys())
|
||||||
|
|
||||||
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, False, "int", [])
|
self.indexerid, args = self.check_params(args, kwargs, "indexerid", None, False, "int", [])
|
||||||
self.indexer, args = self.check_params(args, kwargs, "indexer", self.indexer, False, "int", [])
|
|
||||||
|
|
||||||
# super, missing, help
|
# super, missing, help
|
||||||
ApiCall.__init__(self, handler, args, kwargs)
|
ApiCall.__init__(self, handler, args, kwargs)
|
||||||
@ -1654,42 +1653,45 @@ class CMD_SickBeardSearchIndexers(ApiCall):
|
|||||||
lang_id = self.valid_languages[self.lang]
|
lang_id = self.valid_languages[self.lang]
|
||||||
|
|
||||||
if self.name and not self.indexerid: # only name was given
|
if self.name and not self.indexerid: # only name was given
|
||||||
for self.indexer in sickbeard.indexerApi().indexers if not self.indexer else [int(self.indexer)]:
|
for _indexer in sickbeard.indexerApi().indexers if self.indexer == 0 else [int(self.indexer)]:
|
||||||
lINDEXER_API_PARMS = sickbeard.indexerApi(self.indexer).api_params.copy()
|
lINDEXER_API_PARMS = sickbeard.indexerApi(_indexer).api_params.copy()
|
||||||
lINDEXER_API_PARMS['language'] = self.lang
|
|
||||||
|
if self.lang and not self.lang == 'en':
|
||||||
|
lINDEXER_API_PARMS['language'] = self.lang
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['actors'] = False
|
||||||
lINDEXER_API_PARMS['custom_ui'] = classes.AllShowsListUI
|
lINDEXER_API_PARMS['custom_ui'] = classes.AllShowsListUI
|
||||||
|
|
||||||
t = sickbeard.indexerApi(self.indexer).indexer(**lINDEXER_API_PARMS)
|
t = sickbeard.indexerApi(_indexer).indexer(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
apiData = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
apiData = t[str(self.name).encode()]
|
apiData = t[str(self.name).encode()]
|
||||||
except Exception, e:
|
except (sickbeard.indexer_shownotfound, sickbeard.indexer_showincomplete, sickbeard.indexer_error):
|
||||||
pass
|
logger.log(u"API :: Unable to find show with id " + str(self.indexerid), logger.WARNING)
|
||||||
|
return _responds(RESULT_SUCCESS, {"results": [], "langid": lang_id})
|
||||||
|
|
||||||
for curSeries in apiData:
|
for curSeries in apiData:
|
||||||
results.append({indexer_ids[self.indexer]: int(curSeries['id']),
|
results.append({indexer_ids[_indexer]: int(curSeries['id']),
|
||||||
"name": curSeries['seriesname'],
|
"name": curSeries['seriesname'],
|
||||||
"first_aired": curSeries['firstaired'],
|
"first_aired": curSeries['firstaired'],
|
||||||
"indexer": self.indexer})
|
"indexer": int(_indexer)})
|
||||||
|
|
||||||
return _responds(RESULT_SUCCESS, {"results": results, "langid": lang_id})
|
return _responds(RESULT_SUCCESS, {"results": results, "langid": lang_id})
|
||||||
|
|
||||||
elif self.indexerid:
|
elif self.indexerid:
|
||||||
for self.indexer in sickbeard.indexerApi().indexers if not self.indexer > 0 else [int(self.indexer)]:
|
for _indexer in sickbeard.indexerApi().indexers if self.indexer == 0 else [int(self.indexer)]:
|
||||||
lINDEXER_API_PARMS = sickbeard.indexerApi(self.indexer).api_params.copy()
|
lINDEXER_API_PARMS = sickbeard.indexerApi(_indexer).api_params.copy()
|
||||||
|
|
||||||
if self.lang and not self.lang == 'en':
|
if self.lang and not self.lang == 'en':
|
||||||
lINDEXER_API_PARMS['language'] = self.lang
|
lINDEXER_API_PARMS['language'] = self.lang
|
||||||
|
|
||||||
lINDEXER_API_PARMS['actors'] = False
|
lINDEXER_API_PARMS['actors'] = False
|
||||||
|
|
||||||
t = sickbeard.indexerApi(self.indexer).indexer(**lINDEXER_API_PARMS)
|
t = sickbeard.indexerApi(_indexer).indexer(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
myShow = t[int(self.indexerid)]
|
myShow = t[int(self.indexerid)]
|
||||||
except (sickbeard.indexer_shownotfound, sickbeard.indexer_error):
|
except (sickbeard.indexer_shownotfound, sickbeard.indexer_showincomplete, sickbeard.indexer_error):
|
||||||
logger.log(u"API :: Unable to find show with id " + str(self.indexerid), logger.WARNING)
|
logger.log(u"API :: Unable to find show with id " + str(self.indexerid), logger.WARNING)
|
||||||
return _responds(RESULT_SUCCESS, {"results": [], "langid": lang_id})
|
return _responds(RESULT_SUCCESS, {"results": [], "langid": lang_id})
|
||||||
|
|
||||||
@ -1699,9 +1701,12 @@ class CMD_SickBeardSearchIndexers(ApiCall):
|
|||||||
self.indexerid) + ", however it contained no show name", logger.DEBUG)
|
self.indexerid) + ", however it contained no show name", logger.DEBUG)
|
||||||
return _responds(RESULT_FAILURE, msg="Show contains no name, invalid result")
|
return _responds(RESULT_FAILURE, msg="Show contains no name, invalid result")
|
||||||
|
|
||||||
results = [{indexer_ids[self.indexer]: self.indexerid,
|
# found show
|
||||||
|
results = [{indexer_ids[_indexer]: int(myShow.data['id']),
|
||||||
"name": unicode(myShow.data['seriesname']),
|
"name": unicode(myShow.data['seriesname']),
|
||||||
"first_aired": myShow.data['firstaired']}]
|
"first_aired": myShow.data['firstaired'],
|
||||||
|
"indexer": int(_indexer)}]
|
||||||
|
break
|
||||||
|
|
||||||
return _responds(RESULT_SUCCESS, {"results": results, "langid": lang_id})
|
return _responds(RESULT_SUCCESS, {"results": results, "langid": lang_id})
|
||||||
else:
|
else:
|
||||||
@ -1711,29 +1716,27 @@ class CMD_SickBeardSearchIndexers(ApiCall):
|
|||||||
class CMD_SickBeardSearchTVDB(CMD_SickBeardSearchIndexers):
|
class CMD_SickBeardSearchTVDB(CMD_SickBeardSearchIndexers):
|
||||||
_help = {"desc": "search for show on theTVDB with a given string and language",
|
_help = {"desc": "search for show on theTVDB with a given string and language",
|
||||||
"optionalParameters": {"name": {"desc": "name of the show you want to search for"},
|
"optionalParameters": {"name": {"desc": "name of the show you want to search for"},
|
||||||
"tvdbid": {
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
"desc": "thetvdb.com unique id of a show"},
|
|
||||||
"lang": {"desc": "the 2 letter abbreviation lang id"}
|
"lang": {"desc": "the 2 letter abbreviation lang id"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, handler, args, kwargs):
|
def __init__(self, handler, args, kwargs):
|
||||||
self.indexer = 1
|
self.indexerid, args = self.check_params(args, kwargs, "tvdbid", None, False, "int", [])
|
||||||
CMD_SickBeardSearchIndexers.__init__(self, handler, args, kwargs)
|
CMD_SickBeardSearchIndexers.__init__(self, handler, args, kwargs)
|
||||||
|
|
||||||
|
|
||||||
class CMD_SickBeardSearchTVRAGE(CMD_SickBeardSearchIndexers):
|
class CMD_SickBeardSearchTVRAGE(CMD_SickBeardSearchIndexers):
|
||||||
_help = {"desc": "search for show on TVRage with a given string and language",
|
_help = {"desc": "search for show on TVRage with a given string and language",
|
||||||
"optionalParameters": {"name": {"desc": "name of the show you want to search for"},
|
"optionalParameters": {"name": {"desc": "name of the show you want to search for"},
|
||||||
"tvrageid": {
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
"desc": "tvrage.com unique id of a show"},
|
|
||||||
"lang": {"desc": "the 2 letter abbreviation lang id"}
|
"lang": {"desc": "the 2 letter abbreviation lang id"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, handler, args, kwargs):
|
def __init__(self, handler, args, kwargs):
|
||||||
self.indexer = 2
|
self.indexerid, args = self.check_params(args, kwargs, "tvrageid", None, False, "int", [])
|
||||||
CMD_SickBeardSearchIndexers.__init__(self, handler, args, kwargs)
|
CMD_SickBeardSearchIndexers.__init__(self, handler, args, kwargs)
|
||||||
|
|
||||||
|
|
||||||
@ -1835,8 +1838,9 @@ class CMD_Show(ApiCall):
|
|||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid": {"desc": "unique id of a show"},
|
"indexerid": {"desc": "unique id of a show"},
|
||||||
},
|
},
|
||||||
"optionalParameters": {"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
"optionalParameters": {
|
||||||
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1910,13 +1914,16 @@ class CMD_Show(ApiCall):
|
|||||||
|
|
||||||
class CMD_ShowAddExisting(ApiCall):
|
class CMD_ShowAddExisting(ApiCall):
|
||||||
_help = {"desc": "add a show in sickrage with an existing folder",
|
_help = {"desc": "add a show in sickrage with an existing folder",
|
||||||
"requiredParameters": {"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com id"},
|
"requiredParameters": {"indexerid": {"desc": "unique id of a show"},
|
||||||
"location": {"desc": "full path to the existing folder for the show"}
|
"location": {"desc": "full path to the existing folder for the show"}
|
||||||
},
|
},
|
||||||
"optionalParameters": {"initial": {"desc": "initial quality for the show"},
|
"optionalParameters": {
|
||||||
"archive": {"desc": "archive quality for the show"},
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
"flatten_folders": {"desc": "flatten subfolders for the show"},
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
"subtitles": {"desc": "allow search episode subtitle"}
|
"initial": {"desc": "initial quality for the show"},
|
||||||
|
"archive": {"desc": "archive quality for the show"},
|
||||||
|
"flatten_folders": {"desc": "flatten subfolders for the show"},
|
||||||
|
"subtitles": {"desc": "allow search episode subtitle"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1963,6 +1970,9 @@ class CMD_ShowAddExisting(ApiCall):
|
|||||||
if not indexerName:
|
if not indexerName:
|
||||||
return _responds(RESULT_FAILURE, msg="Unable to retrieve information from indexer")
|
return _responds(RESULT_FAILURE, msg="Unable to retrieve information from indexer")
|
||||||
|
|
||||||
|
# set indexer so we can pass it along when adding show to SR
|
||||||
|
indexer = indexerResult['data']['results'][0]['indexer']
|
||||||
|
|
||||||
quality_map = {'sdtv': Quality.SDTV,
|
quality_map = {'sdtv': Quality.SDTV,
|
||||||
'sddvd': Quality.SDDVD,
|
'sddvd': Quality.SDDVD,
|
||||||
'hdtv': Quality.HDTV,
|
'hdtv': Quality.HDTV,
|
||||||
@ -1989,7 +1999,7 @@ class CMD_ShowAddExisting(ApiCall):
|
|||||||
if iqualityID or aqualityID:
|
if iqualityID or aqualityID:
|
||||||
newQuality = Quality.combineQualities(iqualityID, aqualityID)
|
newQuality = Quality.combineQualities(iqualityID, aqualityID)
|
||||||
|
|
||||||
sickbeard.showQueueScheduler.action.addShow(int(self.indexer), int(self.indexerid), self.location, SKIPPED,
|
sickbeard.showQueueScheduler.action.addShow(int(indexer), int(self.indexerid), self.location, SKIPPED,
|
||||||
newQuality, int(self.flatten_folders))
|
newQuality, int(self.flatten_folders))
|
||||||
|
|
||||||
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")
|
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")
|
||||||
@ -1997,17 +2007,20 @@ class CMD_ShowAddExisting(ApiCall):
|
|||||||
|
|
||||||
class CMD_ShowAddNew(ApiCall):
|
class CMD_ShowAddNew(ApiCall):
|
||||||
_help = {"desc": "add a new show to sickrage",
|
_help = {"desc": "add a new show to sickrage",
|
||||||
"requiredParameters": {"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com id"}
|
"requiredParameters": {"indexerid": {"desc": "unique id of a show"}
|
||||||
},
|
},
|
||||||
"optionalParameters": {"initial": {"desc": "initial quality for the show"},
|
"optionalParameters": {
|
||||||
"location": {"desc": "base path for where the show folder is to be created"},
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
"archive": {"desc": "archive quality for the show"},
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
"flatten_folders": {"desc": "flatten subfolders for the show"},
|
"initial": {"desc": "initial quality for the show"},
|
||||||
"status": {"desc": "status of missing episodes"},
|
"location": {"desc": "base path for where the show folder is to be created"},
|
||||||
"lang": {"desc": "the 2 letter lang abbreviation id"},
|
"archive": {"desc": "archive quality for the show"},
|
||||||
"subtitles": {"desc": "allow search episode subtitle"},
|
"flatten_folders": {"desc": "flatten subfolders for the show"},
|
||||||
"anime": {"desc": "set show to anime"},
|
"status": {"desc": "status of missing episodes"},
|
||||||
"scene": {"desc": "show searches episodes by scene numbering"}
|
"lang": {"desc": "the 2 letter lang abbreviation id"},
|
||||||
|
"subtitles": {"desc": "allow search episode subtitle"},
|
||||||
|
"anime": {"desc": "set show to anime"},
|
||||||
|
"scene": {"desc": "show searches episodes by scene numbering"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2123,6 +2136,9 @@ class CMD_ShowAddNew(ApiCall):
|
|||||||
if not indexerName:
|
if not indexerName:
|
||||||
return _responds(RESULT_FAILURE, msg="Unable to retrieve information from indexer")
|
return _responds(RESULT_FAILURE, msg="Unable to retrieve information from indexer")
|
||||||
|
|
||||||
|
# set indexer for found show so we can pass it along
|
||||||
|
indexer = indexerResult['data']['results'][0]['indexer']
|
||||||
|
|
||||||
# moved the logic check to the end in an attempt to eliminate empty directory being created from previous errors
|
# moved the logic check to the end in an attempt to eliminate empty directory being created from previous errors
|
||||||
showPath = ek.ek(os.path.join, self.location, helpers.sanitizeFileName(indexerName))
|
showPath = ek.ek(os.path.join, self.location, helpers.sanitizeFileName(indexerName))
|
||||||
|
|
||||||
@ -2138,7 +2154,7 @@ class CMD_ShowAddNew(ApiCall):
|
|||||||
else:
|
else:
|
||||||
helpers.chmodAsParent(showPath)
|
helpers.chmodAsParent(showPath)
|
||||||
|
|
||||||
sickbeard.showQueueScheduler.action.addShow(int(self.indexer), int(self.indexerid), showPath, newStatus,
|
sickbeard.showQueueScheduler.action.addShow(int(indexer), int(self.indexerid), showPath, newStatus,
|
||||||
newQuality,
|
newQuality,
|
||||||
int(self.flatten_folders), self.lang, self.subtitles, self.anime,
|
int(self.flatten_folders), self.lang, self.subtitles, self.anime,
|
||||||
self.scene) # @UndefinedVariable
|
self.scene) # @UndefinedVariable
|
||||||
@ -2149,7 +2165,11 @@ class CMD_ShowAddNew(ApiCall):
|
|||||||
class CMD_ShowCache(ApiCall):
|
class CMD_ShowCache(ApiCall):
|
||||||
_help = {"desc": "check sickrage's cache to see if the banner or poster image for a show is valid",
|
_help = {"desc": "check sickrage's cache to see if the banner or poster image for a show is valid",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"}
|
"indexerid": {"desc": "unique id of a show"}
|
||||||
|
},
|
||||||
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2185,7 +2205,11 @@ class CMD_ShowCache(ApiCall):
|
|||||||
class CMD_ShowDelete(ApiCall):
|
class CMD_ShowDelete(ApiCall):
|
||||||
_help = {"desc": "delete a show in sickrage",
|
_help = {"desc": "delete a show in sickrage",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"},
|
"indexerid": {"desc": "unique id of a show"},
|
||||||
|
},
|
||||||
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2213,7 +2237,11 @@ class CMD_ShowDelete(ApiCall):
|
|||||||
class CMD_ShowGetQuality(ApiCall):
|
class CMD_ShowGetQuality(ApiCall):
|
||||||
_help = {"desc": "get quality setting for a show in sickrage",
|
_help = {"desc": "get quality setting for a show in sickrage",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"}
|
"indexerid": {"desc": "unique id of a show"}
|
||||||
|
},
|
||||||
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2238,7 +2266,11 @@ class CMD_ShowGetQuality(ApiCall):
|
|||||||
class CMD_ShowGetPoster(ApiCall):
|
class CMD_ShowGetPoster(ApiCall):
|
||||||
_help = {"desc": "get the poster stored for a show in sickrage",
|
_help = {"desc": "get the poster stored for a show in sickrage",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"}
|
"indexerid": {"desc": "unique id of a show"}
|
||||||
|
},
|
||||||
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2257,7 +2289,11 @@ class CMD_ShowGetPoster(ApiCall):
|
|||||||
class CMD_ShowGetBanner(ApiCall):
|
class CMD_ShowGetBanner(ApiCall):
|
||||||
_help = {"desc": "get the banner stored for a show in sickrage",
|
_help = {"desc": "get the banner stored for a show in sickrage",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"}
|
"indexerid": {"desc": "unique id of a show"}
|
||||||
|
},
|
||||||
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2276,9 +2312,12 @@ class CMD_ShowGetBanner(ApiCall):
|
|||||||
class CMD_ShowPause(ApiCall):
|
class CMD_ShowPause(ApiCall):
|
||||||
_help = {"desc": "set a show's paused state in sickrage",
|
_help = {"desc": "set a show's paused state in sickrage",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"},
|
"indexerid": {"desc": "unique id of a show"},
|
||||||
},
|
},
|
||||||
"optionalParameters": {"pause": {"desc": "set the pause state of the show"}
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
|
"pause": {"desc": "set the pause state of the show"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2309,7 +2348,11 @@ class CMD_ShowPause(ApiCall):
|
|||||||
class CMD_ShowRefresh(ApiCall):
|
class CMD_ShowRefresh(ApiCall):
|
||||||
_help = {"desc": "refresh a show in sickrage",
|
_help = {"desc": "refresh a show in sickrage",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"},
|
"indexerid": {"desc": "unique id of a show"},
|
||||||
|
},
|
||||||
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2337,9 +2380,12 @@ class CMD_ShowRefresh(ApiCall):
|
|||||||
class CMD_ShowSeasonList(ApiCall):
|
class CMD_ShowSeasonList(ApiCall):
|
||||||
_help = {"desc": "display the season list for a given show",
|
_help = {"desc": "display the season list for a given show",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"},
|
"indexerid": {"desc": "unique id of a show"},
|
||||||
},
|
},
|
||||||
"optionalParameters": {"sort": {"desc": "change the sort order from descending to ascending"}
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
|
"sort": {"desc": "change the sort order from descending to ascending"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2376,9 +2422,12 @@ class CMD_ShowSeasonList(ApiCall):
|
|||||||
class CMD_ShowSeasons(ApiCall):
|
class CMD_ShowSeasons(ApiCall):
|
||||||
_help = {"desc": "display a listing of episodes for all or a given season",
|
_help = {"desc": "display a listing of episodes for all or a given season",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"},
|
"indexerid": {"desc": "unique id of a show"},
|
||||||
},
|
},
|
||||||
"optionalParameters": {"season": {"desc": "the season number"},
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
|
"season": {"desc": "the season number"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2445,10 +2494,13 @@ class CMD_ShowSetQuality(ApiCall):
|
|||||||
_help = {
|
_help = {
|
||||||
"desc": "set desired quality of a show in sickrage. if neither initial or archive are provided then the config default quality will be used",
|
"desc": "set desired quality of a show in sickrage. if neither initial or archive are provided then the config default quality will be used",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"}
|
"indexerid": {"desc": "unique id of a show"}
|
||||||
},
|
},
|
||||||
"optionalParameters": {"initial": {"desc": "initial quality for the show"},
|
"optionalParameters": {
|
||||||
"archive": {"desc": "archive quality for the show"}
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
|
"initial": {"desc": "initial quality for the show"},
|
||||||
|
"archive": {"desc": "archive quality for the show"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2510,7 +2562,11 @@ class CMD_ShowSetQuality(ApiCall):
|
|||||||
class CMD_ShowStats(ApiCall):
|
class CMD_ShowStats(ApiCall):
|
||||||
_help = {"desc": "display episode statistics for a given show",
|
_help = {"desc": "display episode statistics for a given show",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"},
|
"indexerid": {"desc": "unique id of a show"},
|
||||||
|
},
|
||||||
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2615,7 +2671,11 @@ class CMD_ShowStats(ApiCall):
|
|||||||
class CMD_ShowUpdate(ApiCall):
|
class CMD_ShowUpdate(ApiCall):
|
||||||
_help = {"desc": "update a show in sickrage",
|
_help = {"desc": "update a show in sickrage",
|
||||||
"requiredParameters": {
|
"requiredParameters": {
|
||||||
"indexerid or tvdbid or tvrageid": {"desc": "thetvdb.com or tvrage.com unique id of a show"},
|
"indexerid": {"desc": "unique id of a show"},
|
||||||
|
},
|
||||||
|
"optionalParameters": {
|
||||||
|
"tvdbid": {"desc": "thetvdb.com unique id of a show"},
|
||||||
|
"tvrageid": {"desc": "tvrage.com unique id of a show"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user