mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 11:58:01 -05:00
Auto-detection of indexer code added in for adding existing shows along with TV Cache lookups, few bugfixes as well.
This commit is contained in:
parent
a4b11a0c95
commit
056b266613
@ -24,12 +24,12 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#tvdbLangSelect').html(resultStr);
|
$('#tvdbLangSelect').html(resultStr);
|
||||||
$('#tvdbLangSelect').change(function () { searchTvdb(); });
|
$('#tvdbLangSelect').change(function () { searchIndexers(); });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchTvdb() {
|
function searchIndexers() {
|
||||||
if (!$('#nameToSearch').val().length) {
|
if (!$('#nameToSearch').val().length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#searchName').click(function () { searchTvdb(); });
|
$('#searchName').click(function () { searchIndexers(); });
|
||||||
|
|
||||||
if ($('#nameToSearch').length && $('#nameToSearch').val().length) {
|
if ($('#nameToSearch').length && $('#nameToSearch').val().length) {
|
||||||
$('#searchName').click();
|
$('#searchName').click();
|
||||||
|
1
lib/dateutil/zoneinfo/.gitignore
vendored
Normal file
1
lib/dateutil/zoneinfo/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.tar.gz
|
@ -80,8 +80,8 @@ multiEpStrings[NAMING_LIMITED_EXTEND] = "Extend (Limited)"
|
|||||||
multiEpStrings[NAMING_LIMITED_EXTEND_E_PREFIXED] = "Extend (Limited, E-prefixed)"
|
multiEpStrings[NAMING_LIMITED_EXTEND_E_PREFIXED] = "Extend (Limited, E-prefixed)"
|
||||||
|
|
||||||
### Notification Types
|
### Notification Types
|
||||||
INDEXER_TVDB = 'Tvdb'
|
INDEXER_TVDB = "Tvdb"
|
||||||
INDEXER_TVRAGE = 'TVRage'
|
INDEXER_TVRAGE = "TVRage"
|
||||||
|
|
||||||
indexerStrings = {}
|
indexerStrings = {}
|
||||||
indexerStrings[INDEXER_TVDB] = "TheTVDB"
|
indexerStrings[INDEXER_TVDB] = "TheTVDB"
|
||||||
|
@ -58,7 +58,7 @@ import sickbeard
|
|||||||
|
|
||||||
from sickbeard.exceptions import MultipleShowObjectsException, ex
|
from sickbeard.exceptions import MultipleShowObjectsException, ex
|
||||||
from sickbeard import logger, classes
|
from sickbeard import logger, classes
|
||||||
from sickbeard.common import USER_AGENT, mediaExtensions, subtitleExtensions, XML_NSMAP
|
from sickbeard.common import USER_AGENT, mediaExtensions, subtitleExtensions, XML_NSMAP, indexerStrings
|
||||||
|
|
||||||
from sickbeard import db
|
from sickbeard import db
|
||||||
from sickbeard import encodingKludge as ek
|
from sickbeard import encodingKludge as ek
|
||||||
@ -303,7 +303,7 @@ def makeDir(path):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def searchDBForShow(regShowName):
|
def searchDBForShow(regShowName, useIndexer=False):
|
||||||
|
|
||||||
showNames = [re.sub('[. -]', ' ', regShowName),regShowName]
|
showNames = [re.sub('[. -]', ' ', regShowName),regShowName]
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ def searchDBForShow(regShowName):
|
|||||||
|
|
||||||
for showName in showNames:
|
for showName in showNames:
|
||||||
|
|
||||||
show = get_show_by_name(showName,sickbeard.showList)
|
show = get_show_by_name(showName,sickbeard.showList, useIndexer==useIndexer)
|
||||||
if show:
|
if show:
|
||||||
sqlResults = myDB.select("SELECT * FROM tv_shows WHERE show_name LIKE ? OR show_name LIKE ?", [show.name, show.name])
|
sqlResults = myDB.select("SELECT * FROM tv_shows WHERE show_name LIKE ? OR show_name LIKE ?", [show.name, show.name])
|
||||||
else:
|
else:
|
||||||
@ -339,6 +339,42 @@ def searchDBForShow(regShowName):
|
|||||||
else:
|
else:
|
||||||
return (sqlResults[0]["indexer"], int(sqlResults[0]["indexer_id"]), sqlResults[0]["show_name"])
|
return (sqlResults[0]["indexer"], int(sqlResults[0]["indexer_id"]), sqlResults[0]["show_name"])
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
def searchIndexersForShow(regShowName):
|
||||||
|
|
||||||
|
showNames = [re.sub('[. -]', ' ', regShowName),regShowName]
|
||||||
|
|
||||||
|
yearRegex = "([^()]+?)\s*(\()?(\d{4})(?(2)\))$"
|
||||||
|
|
||||||
|
for name in showNames:
|
||||||
|
for indexer in indexerStrings:
|
||||||
|
logger.log(u"Trying to find the " + name + " on " + indexer, logger.DEBUG)
|
||||||
|
|
||||||
|
# try each indexer till we find a match
|
||||||
|
sickbeard.INDEXER_API_PARMS['indexer'] = indexer
|
||||||
|
|
||||||
|
try:
|
||||||
|
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **sickbeard.INDEXER_API_PARMS)
|
||||||
|
showObj = t[name]
|
||||||
|
return indexer
|
||||||
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
|
# if none found, search on all languages
|
||||||
|
try:
|
||||||
|
# There's gotta be a better way of doing this but we don't wanna
|
||||||
|
# change the language value elsewhere
|
||||||
|
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
||||||
|
|
||||||
|
lINDEXER_API_PARMS['search_all_languages'] = True
|
||||||
|
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **lINDEXER_API_PARMS)
|
||||||
|
showObj = t[name]
|
||||||
|
return indexer
|
||||||
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
continue
|
||||||
|
except (IOError):
|
||||||
|
continue
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -908,7 +944,7 @@ def _check_against_names(name, show):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_show_by_name(name, showList, useTvdb=False):
|
def get_show_by_name(name, showList, useIndexer=False):
|
||||||
logger.log(u"Trying to get the indexerid for "+name, logger.DEBUG)
|
logger.log(u"Trying to get the indexerid for "+name, logger.DEBUG)
|
||||||
|
|
||||||
if showList:
|
if showList:
|
||||||
@ -917,30 +953,35 @@ def get_show_by_name(name, showList, useTvdb=False):
|
|||||||
logger.log(u"Matched "+name+" in the showlist to the show "+show.name, logger.DEBUG)
|
logger.log(u"Matched "+name+" in the showlist to the show "+show.name, logger.DEBUG)
|
||||||
return show
|
return show
|
||||||
|
|
||||||
if useTvdb:
|
if useIndexer:
|
||||||
try:
|
showResult = None
|
||||||
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **sickbeard.INDEXER_API_PARMS)
|
for indexer in indexerStrings:
|
||||||
showObj = t[name]
|
# try each indexer till we find a match
|
||||||
except (indexer_exceptions):
|
sickbeard.INDEXER_API_PARMS['indexer'] = indexer
|
||||||
# if none found, search on all languages
|
|
||||||
try:
|
|
||||||
# There's gotta be a better way of doing this but we don't wanna
|
|
||||||
# change the language value elsewhere
|
|
||||||
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
|
||||||
|
|
||||||
lINDEXER_API_PARMS['search_all_languages'] = True
|
try:
|
||||||
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **lINDEXER_API_PARMS)
|
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **sickbeard.INDEXER_API_PARMS)
|
||||||
showObj = t[name]
|
showObj = t[name]
|
||||||
except (indexer_exceptions.indexer_exception, IOError):
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
pass
|
# if none found, search on all languages
|
||||||
|
try:
|
||||||
|
# There's gotta be a better way of doing this but we don't wanna
|
||||||
|
# change the language value elsewhere
|
||||||
|
lINDEXER_API_PARMS = sickbeard.INDEXER_API_PARMS.copy()
|
||||||
|
|
||||||
return None
|
lINDEXER_API_PARMS['search_all_languages'] = True
|
||||||
except (IOError):
|
t = indexer_api.indexerApi(custom_ui=classes.ShowListUI, **lINDEXER_API_PARMS)
|
||||||
return None
|
showObj = t[name]
|
||||||
else:
|
except (indexer_exceptions.indexer_exception, IOError):
|
||||||
show = findCertainShow(sickbeard.showList, int(showObj["id"]))
|
pass
|
||||||
if show:
|
|
||||||
return show
|
continue
|
||||||
|
except (IOError):
|
||||||
|
continue
|
||||||
|
|
||||||
|
showResult = findCertainShow(sickbeard.showList, int(showObj["id"]))
|
||||||
|
if showResult is not None:
|
||||||
|
return showResult
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -21,17 +21,11 @@ from lib.tvrage_api.tvrage_api import TVRage
|
|||||||
|
|
||||||
class indexerApi:
|
class indexerApi:
|
||||||
def __new__(self, indexer):
|
def __new__(self, indexer):
|
||||||
cls = type(eval(indexer))
|
cls = type(indexer)
|
||||||
new_type = type(cls.__name__ + '_wrapped', (indexerApi, cls), {})
|
new_type = type(cls.__name__ + '_wrapped', (indexerApi, cls), {})
|
||||||
return object.__new__(new_type)
|
return object.__new__(new_type)
|
||||||
|
|
||||||
def __init__(self, indexer=None, language=None, *args, **kwargs):
|
def __init__(self, indexer=None, language=None, custom_ui=None, *args, **kwargs):
|
||||||
if indexer is not None:
|
|
||||||
self.name = indexer
|
|
||||||
self._wrapped = eval(indexer)(*args, **kwargs)
|
|
||||||
else:
|
|
||||||
self.name = "Indexer"
|
|
||||||
|
|
||||||
self.config = {}
|
self.config = {}
|
||||||
|
|
||||||
self.config['valid_languages'] = [
|
self.config['valid_languages'] = [
|
||||||
@ -54,6 +48,12 @@ class indexerApi:
|
|||||||
else:
|
else:
|
||||||
self.config['language'] = language
|
self.config['language'] = language
|
||||||
|
|
||||||
|
if indexer is not None:
|
||||||
|
self.name = indexer
|
||||||
|
self._wrapped = eval(indexer)(custom_ui=custom_ui, language=language, *args, **kwargs)
|
||||||
|
else:
|
||||||
|
self.name = "Indexer"
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
return getattr(self._wrapped, attr)
|
return getattr(self._wrapped, attr)
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ class GenericMetadata():
|
|||||||
try:
|
try:
|
||||||
myEp = indexer_show_obj[cur_ep.season][cur_ep.episode]
|
myEp = indexer_show_obj[cur_ep.season][cur_ep.episode]
|
||||||
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
||||||
logger.log(u"Unable to find episode " + str(cur_ep.season) + "x" + str(cur_ep.episode) + " on tvdb... has it been removed? Should I delete from db?")
|
logger.log(u"Unable to find episode " + str(cur_ep.season) + "x" + str(cur_ep.episode) + " on " + ep_obj.show.indexer + ".. has it been removed? Should I delete from db?")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
thumb_url = getattr(myEp, 'filename', None)
|
thumb_url = getattr(myEp, 'filename', None)
|
||||||
@ -873,8 +873,8 @@ class GenericMetadata():
|
|||||||
+ str(showXML.findtext('id')))
|
+ str(showXML.findtext('id')))
|
||||||
return empty_return
|
return empty_return
|
||||||
|
|
||||||
indexer = None
|
|
||||||
name = showXML.findtext('title')
|
name = showXML.findtext('title')
|
||||||
|
indexer = showXML.findtext('indexer')
|
||||||
if showXML.findtext('tvdbid') != None:
|
if showXML.findtext('tvdbid') != None:
|
||||||
indexer_id = int(showXML.findtext('tvdbid'))
|
indexer_id = int(showXML.findtext('tvdbid'))
|
||||||
elif showXML.findtext('id') != None:
|
elif showXML.findtext('id') != None:
|
||||||
@ -883,11 +883,6 @@ class GenericMetadata():
|
|||||||
logger.log(u"Empty <id> or <tvdbid> field in NFO, unable to find a ID", logger.WARNING)
|
logger.log(u"Empty <id> or <tvdbid> field in NFO, unable to find a ID", logger.WARNING)
|
||||||
return empty_return
|
return empty_return
|
||||||
|
|
||||||
if indexer is None:
|
|
||||||
indexer = showXML.findtext('indexer')
|
|
||||||
if indexer is None:
|
|
||||||
indexer = 'Tvdb'
|
|
||||||
|
|
||||||
if indexer_id is None:
|
if indexer_id is None:
|
||||||
logger.log(u"Invalid indexer ID (" + str(indexer_id) + "), not using metadata file", logger.WARNING)
|
logger.log(u"Invalid indexer ID (" + str(indexer_id) + "), not using metadata file", logger.WARNING)
|
||||||
return empty_return
|
return empty_return
|
||||||
|
@ -418,17 +418,17 @@ class MediaBrowserMetadata(generic.GenericMetadata):
|
|||||||
try:
|
try:
|
||||||
myEp = myShow[curEpToWrite.season][curEpToWrite.episode]
|
myEp = myShow[curEpToWrite.season][curEpToWrite.episode]
|
||||||
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
||||||
logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str(curEpToWrite.episode) + " on tvdb... has it been removed? Should I delete from db?")
|
logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str(curEpToWrite.episode) + " on " + ep_obj.show.indexer + ".. has it been removed? Should I delete from db?")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if curEpToWrite == ep_obj:
|
if curEpToWrite == ep_obj:
|
||||||
# root (or single) episode
|
# root (or single) episode
|
||||||
|
|
||||||
# default to today's date for specials if firstaired is not set
|
# default to today's date for specials if firstaired is not set
|
||||||
if getattr(myShow, 'firstaired', None) is not None and ep_obj.season == 0:
|
if getattr(myEp, 'firstaired', None) is None and ep_obj.season == 0:
|
||||||
myEp['firstaired'] = str(datetime.date.fromordinal(1))
|
myEp['firstaired'] = str(datetime.date.fromordinal(1))
|
||||||
|
|
||||||
if getattr(myShow, 'episodename', None) is None or getattr(myShow, 'firstaired', None) is not None:
|
if getattr(myEp, 'episodename', None) is None or getattr(myEp, 'firstaired', None) is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
episode = rootNode
|
episode = rootNode
|
||||||
@ -470,7 +470,8 @@ class MediaBrowserMetadata(generic.GenericMetadata):
|
|||||||
|
|
||||||
if not ep_obj.relatedEps:
|
if not ep_obj.relatedEps:
|
||||||
Rating = etree.SubElement(episode, "Rating")
|
Rating = etree.SubElement(episode, "Rating")
|
||||||
rating_text = myEp['rating']
|
if getattr(myEp, 'rating', None) is not None:
|
||||||
|
rating_text = myEp['rating']
|
||||||
if rating_text != None:
|
if rating_text != None:
|
||||||
Rating.text = rating_text
|
Rating.text = rating_text
|
||||||
|
|
||||||
@ -518,11 +519,11 @@ class MediaBrowserMetadata(generic.GenericMetadata):
|
|||||||
Overview.text = Overview.text + "\r" + curEpToWrite.description
|
Overview.text = Overview.text + "\r" + curEpToWrite.description
|
||||||
|
|
||||||
# collect all directors, guest stars and writers
|
# collect all directors, guest stars and writers
|
||||||
if getattr(myShow, 'director', None) is not None:
|
if getattr(myEp, 'director', None) is not None:
|
||||||
persons_dict['Director'] += [x.strip() for x in myEp['director'].split('|') if x]
|
persons_dict['Director'] += [x.strip() for x in myEp['director'].split('|') if x]
|
||||||
if getattr(myShow, 'gueststars', None) is not None:
|
if getattr(myEp, 'gueststars', None) is not None:
|
||||||
persons_dict['GuestStar'] += [x.strip() for x in myEp['gueststars'].split('|') if x]
|
persons_dict['GuestStar'] += [x.strip() for x in myEp['gueststars'].split('|') if x]
|
||||||
if getattr(myShow, 'writer', None) is not None:
|
if getattr(myEp, 'writer', None) is not None:
|
||||||
persons_dict['Writer'] += [x.strip() for x in myEp['writer'].split('|') if x]
|
persons_dict['Writer'] += [x.strip() for x in myEp['writer'].split('|') if x]
|
||||||
|
|
||||||
# fill in Persons section with collected directors, guest starts and writers
|
# fill in Persons section with collected directors, guest starts and writers
|
||||||
|
@ -192,16 +192,16 @@ class TIVOMetadata(generic.GenericMetadata):
|
|||||||
try:
|
try:
|
||||||
myEp = myShow[curEpToWrite.season][curEpToWrite.episode]
|
myEp = myShow[curEpToWrite.season][curEpToWrite.episode]
|
||||||
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
||||||
logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str(curEpToWrite.episode) + " on tvdb... has it been removed? Should I delete from db?")
|
logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str(curEpToWrite.episode) + " on " + ep_obj.show.indexer + "... has it been removed? Should I delete from db?")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if myEp["firstaired"] == None and ep_obj.season == 0:
|
if getattr(myEp, 'firstaired', None) is None and ep_obj.season == 0:
|
||||||
myEp["firstaired"] = str(datetime.date.fromordinal(1))
|
myEp["firstaired"] = str(datetime.date.fromordinal(1))
|
||||||
|
|
||||||
if myEp["episodename"] == None or myEp["firstaired"] == None:
|
if getattr(myEp, 'episodename', None) is None or getattr(myEp, 'firstaired', None) is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if myShow["seriesname"] != None:
|
if getattr(myShow, 'seriesname', None) is not None:
|
||||||
data += ("title : " + myShow["seriesname"] + "\n")
|
data += ("title : " + myShow["seriesname"] + "\n")
|
||||||
data += ("seriesTitle : " + myShow["seriesname"] + "\n")
|
data += ("seriesTitle : " + myShow["seriesname"] + "\n")
|
||||||
|
|
||||||
@ -236,11 +236,11 @@ class TIVOMetadata(generic.GenericMetadata):
|
|||||||
|
|
||||||
# Usually starts with "SH" and followed by 6-8 digits.
|
# Usually starts with "SH" and followed by 6-8 digits.
|
||||||
# Tivo uses zap2it for thier data, so the series id is the zap2it_id.
|
# Tivo uses zap2it for thier data, so the series id is the zap2it_id.
|
||||||
if myShow["zap2it_id"] != None:
|
if getattr(myShow, 'zap2it_id', None) is not None:
|
||||||
data += ("seriesId : " + myShow["zap2it_id"] + "\n")
|
data += ("seriesId : " + myShow["zap2it_id"] + "\n")
|
||||||
|
|
||||||
# This is the call sign of the channel the episode was recorded from.
|
# This is the call sign of the channel the episode was recorded from.
|
||||||
if myShow["network"] != None:
|
if getattr(myShow, 'network', None) is not None:
|
||||||
data += ("callsign : " + myShow["network"] + "\n")
|
data += ("callsign : " + myShow["network"] + "\n")
|
||||||
|
|
||||||
# This must be entered as yyyy-mm-ddThh:mm:ssZ (the t is capitalized and never changes, the Z is also
|
# This must be entered as yyyy-mm-ddThh:mm:ssZ (the t is capitalized and never changes, the Z is also
|
||||||
@ -250,13 +250,13 @@ class TIVOMetadata(generic.GenericMetadata):
|
|||||||
data += ("originalAirDate : " + str(curEpToWrite.airdate) + "T00:00:00Z\n")
|
data += ("originalAirDate : " + str(curEpToWrite.airdate) + "T00:00:00Z\n")
|
||||||
|
|
||||||
# This shows up at the beginning of the description on the Program screen and on the Details screen.
|
# This shows up at the beginning of the description on the Program screen and on the Details screen.
|
||||||
if myShow["actors"]:
|
if getattr(myShow, 'actors', None) is not None:
|
||||||
for actor in myShow["actors"].split('|'):
|
for actor in myShow["actors"].split('|'):
|
||||||
if actor:
|
if actor:
|
||||||
data += ("vActor : " + actor + "\n")
|
data += ("vActor : " + actor + "\n")
|
||||||
|
|
||||||
# This is shown on both the Program screen and the Details screen.
|
# This is shown on both the Program screen and the Details screen.
|
||||||
if myEp["rating"] != None:
|
if getattr(myEp, 'rating', None) is not None:
|
||||||
try:
|
try:
|
||||||
rating = float(myEp['rating'])
|
rating = float(myEp['rating'])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@ -268,7 +268,7 @@ class TIVOMetadata(generic.GenericMetadata):
|
|||||||
|
|
||||||
# This is shown on both the Program screen and the Details screen.
|
# This is shown on both the Program screen and the Details screen.
|
||||||
# It uses the standard TV rating system of: TV-Y7, TV-Y, TV-G, TV-PG, TV-14, TV-MA and TV-NR.
|
# It uses the standard TV rating system of: TV-Y7, TV-Y, TV-G, TV-PG, TV-14, TV-MA and TV-NR.
|
||||||
if myShow["contentrating"]:
|
if getattr(myShow, 'contentrating', None) is not None:
|
||||||
data += ("tvRating : " + str(myShow["contentrating"]) + "\n")
|
data += ("tvRating : " + str(myShow["contentrating"]) + "\n")
|
||||||
|
|
||||||
# This field can be repeated as many times as necessary or omitted completely.
|
# This field can be repeated as many times as necessary or omitted completely.
|
||||||
|
@ -203,13 +203,13 @@ class WDTVMetadata(generic.GenericMetadata):
|
|||||||
try:
|
try:
|
||||||
myEp = myShow[curEpToWrite.season][curEpToWrite.episode]
|
myEp = myShow[curEpToWrite.season][curEpToWrite.episode]
|
||||||
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
||||||
logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str(curEpToWrite.episode) + " on tvdb... has it been removed? Should I delete from db?")
|
logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str(curEpToWrite.episode) + " on " + ep_obj.show.indexer + "... has it been removed? Should I delete from db?")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if myEp["firstaired"] == None and ep_obj.season == 0:
|
if getattr(myEp, 'firstaired', None) is None and ep_obj.season == 0:
|
||||||
myEp["firstaired"] = str(datetime.date.fromordinal(1))
|
myEp["firstaired"] = str(datetime.date.fromordinal(1))
|
||||||
|
|
||||||
if myEp["episodename"] == None or myEp["firstaired"] == None:
|
if getattr(myEp, 'episodename', None) is None or getattr(myEp, 'firstaired', None) is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if len(eps_to_write) > 1:
|
if len(eps_to_write) > 1:
|
||||||
@ -225,7 +225,7 @@ class WDTVMetadata(generic.GenericMetadata):
|
|||||||
title.text = ep_obj.prettyName()
|
title.text = ep_obj.prettyName()
|
||||||
|
|
||||||
seriesName = etree.SubElement(episode, "series_name")
|
seriesName = etree.SubElement(episode, "series_name")
|
||||||
if myShow["seriesname"] != None:
|
if getattr(myShow, 'seriesname', None) is not None:
|
||||||
seriesName.text = myShow["seriesname"]
|
seriesName.text = myShow["seriesname"]
|
||||||
|
|
||||||
episodeName = etree.SubElement(episode, "episode_name")
|
episodeName = etree.SubElement(episode, "episode_name")
|
||||||
@ -244,7 +244,7 @@ class WDTVMetadata(generic.GenericMetadata):
|
|||||||
firstAired.text = str(curEpToWrite.airdate)
|
firstAired.text = str(curEpToWrite.airdate)
|
||||||
|
|
||||||
year = etree.SubElement(episode, "year")
|
year = etree.SubElement(episode, "year")
|
||||||
if myShow["firstaired"] != None:
|
if getattr(myShow, 'firstaired', None) is not None:
|
||||||
try:
|
try:
|
||||||
year_text = str(datetime.datetime.strptime(myShow["firstaired"], '%Y-%m-%d').year)
|
year_text = str(datetime.datetime.strptime(myShow["firstaired"], '%Y-%m-%d').year)
|
||||||
if year_text:
|
if year_text:
|
||||||
@ -254,26 +254,28 @@ class WDTVMetadata(generic.GenericMetadata):
|
|||||||
|
|
||||||
runtime = etree.SubElement(episode, "runtime")
|
runtime = etree.SubElement(episode, "runtime")
|
||||||
if curEpToWrite.season != 0:
|
if curEpToWrite.season != 0:
|
||||||
if myShow["runtime"] != None:
|
if getattr(myShow, 'runtime', None) is not None:
|
||||||
runtime.text = myShow["runtime"]
|
runtime.text = myShow["runtime"]
|
||||||
|
|
||||||
genre = etree.SubElement(episode, "genre")
|
genre = etree.SubElement(episode, "genre")
|
||||||
if myShow["genre"] != None:
|
if getattr(myShow, 'genre', None) is not None:
|
||||||
genre.text = " / ".join([x for x in myShow["genre"].split('|') if x])
|
genre.text = " / ".join([x for x in myShow["genre"].split('|') if x])
|
||||||
|
|
||||||
director = etree.SubElement(episode, "director")
|
director = etree.SubElement(episode, "director")
|
||||||
director_text = myEp['director']
|
if getattr(myEp, 'director', None) is not None:
|
||||||
|
director_text = myEp['director']
|
||||||
if director_text != None:
|
if director_text != None:
|
||||||
director.text = director_text
|
director.text = director_text
|
||||||
|
|
||||||
for actor in myShow['_actors']:
|
if getattr(myShow, '_actors', None) is not None:
|
||||||
cur_actor = etree.SubElement(episode, "actor")
|
for actor in myShow['_actors']:
|
||||||
cur_actor_name = etree.SubElement(cur_actor, "name")
|
cur_actor = etree.SubElement(episode, "actor")
|
||||||
cur_actor_name.text = actor['name']
|
cur_actor_name = etree.SubElement(cur_actor, "name")
|
||||||
cur_actor_role = etree.SubElement(cur_actor, "role")
|
cur_actor_name.text = actor['name']
|
||||||
cur_actor_role_text = actor['role']
|
cur_actor_role = etree.SubElement(cur_actor, "role")
|
||||||
if cur_actor_role_text != None:
|
cur_actor_role_text = actor['role']
|
||||||
cur_actor_role.text = cur_actor_role_text
|
if cur_actor_role_text != None:
|
||||||
|
cur_actor_role.text = cur_actor_role_text
|
||||||
|
|
||||||
overview = etree.SubElement(episode, "overview")
|
overview = etree.SubElement(episode, "overview")
|
||||||
if curEpToWrite.description != None:
|
if curEpToWrite.description != None:
|
||||||
|
@ -127,7 +127,7 @@ class XBMC_12PlusMetadata(generic.GenericMetadata):
|
|||||||
# check for title and id
|
# check for title and id
|
||||||
try:
|
try:
|
||||||
if getattr(myShow, 'seriesname', None) is None or getattr(myShow, 'id') is None:
|
if getattr(myShow, 'seriesname', None) is None or getattr(myShow, 'id') is None:
|
||||||
logger.log(u"Incomplete info for show with id " + str(show_ID) + " on tvdb, skipping it", logger.ERROR)
|
logger.log(u"Incomplete info for show with id " + str(show_ID) + " on " + show_obj.indexer + ", skipping it", logger.ERROR)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
except indexer_exceptions.indexer_attributenotfound:
|
except indexer_exceptions.indexer_attributenotfound:
|
||||||
@ -189,7 +189,7 @@ class XBMC_12PlusMetadata(generic.GenericMetadata):
|
|||||||
if getattr(myShow, 'network', None) is not None:
|
if getattr(myShow, 'network', None) is not None:
|
||||||
studio.text = myShow["network"]
|
studio.text = myShow["network"]
|
||||||
|
|
||||||
if getattr(myShow, 'actors', None) is not None:
|
if getattr(myShow, '_actors', None) is not None:
|
||||||
for actor in myShow['_actors']:
|
for actor in myShow['_actors']:
|
||||||
cur_actor = etree.SubElement(tv_node, "actor")
|
cur_actor = etree.SubElement(tv_node, "actor")
|
||||||
|
|
||||||
@ -258,10 +258,10 @@ class XBMC_12PlusMetadata(generic.GenericMetadata):
|
|||||||
logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str(curEpToWrite.episode) + " on " + ep_obj.show.indexer + ".. has it been removed? Should I delete from db?")
|
logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str(curEpToWrite.episode) + " on " + ep_obj.show.indexer + ".. has it been removed? Should I delete from db?")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if getattr(myShow, 'firstaired', None) is not None:
|
if getattr(myEp, 'firstaired', None) is None:
|
||||||
myEp["firstaired"] = str(datetime.date.fromordinal(1))
|
myEp["firstaired"] = str(datetime.date.fromordinal(1))
|
||||||
|
|
||||||
if getattr(myShow, 'episodename', None) is not None:
|
if getattr(myEp, 'episodename', None) is None:
|
||||||
logger.log(u"Not generating nfo because the ep has no title", logger.DEBUG)
|
logger.log(u"Not generating nfo because the ep has no title", logger.DEBUG)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ class XBMC_12PlusMetadata(generic.GenericMetadata):
|
|||||||
|
|
||||||
runtime = etree.SubElement(episode, "runtime")
|
runtime = etree.SubElement(episode, "runtime")
|
||||||
if curEpToWrite.season != 0:
|
if curEpToWrite.season != 0:
|
||||||
if getattr(myEp, 'runtime', None) is not None:
|
if getattr(myShow, 'runtime', None) is not None:
|
||||||
runtime.text = myShow["runtime"]
|
runtime.text = myShow["runtime"]
|
||||||
|
|
||||||
displayseason = etree.SubElement(episode, "displayseason")
|
displayseason = etree.SubElement(episode, "displayseason")
|
||||||
|
@ -547,7 +547,6 @@ class PostProcessor(object):
|
|||||||
_finalize(parse_result)
|
_finalize(parse_result)
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
|
|
||||||
def _find_info(self):
|
def _find_info(self):
|
||||||
"""
|
"""
|
||||||
For a given file try to find the showid, season, and episode.
|
For a given file try to find the showid, season, and episode.
|
||||||
@ -823,7 +822,7 @@ class PostProcessor(object):
|
|||||||
indexer_id = season = episodes = None
|
indexer_id = season = episodes = None
|
||||||
if 'auto' in self.indexer:
|
if 'auto' in self.indexer:
|
||||||
for indexer in indexerStrings:
|
for indexer in indexerStrings:
|
||||||
self.indexer = indexer[0]
|
self.indexer = indexer
|
||||||
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
sickbeard.INDEXER_API_PARMS['indexer'] = self.indexer
|
||||||
|
|
||||||
# try to find the file info
|
# try to find the file info
|
||||||
|
@ -1335,7 +1335,7 @@ class TVEpisode(object):
|
|||||||
logger.log(u"" + self.indexer + " timed out, unable to create the episode", logger.ERROR)
|
logger.log(u"" + self.indexer + " timed out, unable to create the episode", logger.ERROR)
|
||||||
return False
|
return False
|
||||||
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
|
||||||
logger.log(u"Unable to find the episode on tvdb... has it been removed? Should I delete from db?", logger.DEBUG)
|
logger.log(u"Unable to find the episode on " + self.idexer + "... has it been removed? Should I delete from db?", logger.DEBUG)
|
||||||
# if I'm no longer on TVDB but I once was then delete myself from the DB
|
# if I'm no longer on TVDB but I once was then delete myself from the DB
|
||||||
if self.indexerid != -1:
|
if self.indexerid != -1:
|
||||||
self.deleteEpisode()
|
self.deleteEpisode()
|
||||||
|
@ -1992,10 +1992,6 @@ class NewHomeAddShows:
|
|||||||
t = PageTemplate(file="home_massAddTable.tmpl")
|
t = PageTemplate(file="home_massAddTable.tmpl")
|
||||||
t.submenu = HomeMenu()
|
t.submenu = HomeMenu()
|
||||||
|
|
||||||
for curIndexer in sorted(indexerStrings.items(), key=lambda x: x[1]):
|
|
||||||
a = curIndexer[0]
|
|
||||||
b = curIndexer[1]
|
|
||||||
|
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
|
|
||||||
if not rootDir:
|
if not rootDir:
|
||||||
@ -2052,12 +2048,14 @@ class NewHomeAddShows:
|
|||||||
show_name = ''
|
show_name = ''
|
||||||
for cur_provider in sickbeard.metadata_provider_dict.values():
|
for cur_provider in sickbeard.metadata_provider_dict.values():
|
||||||
(indexer_id, show_name, indexer) = cur_provider.retrieveShowMetadata(cur_path)
|
(indexer_id, show_name, indexer) = cur_provider.retrieveShowMetadata(cur_path)
|
||||||
if indexer_id and indexer and show_name:
|
if indexer_id and show_name:
|
||||||
break
|
break
|
||||||
|
|
||||||
# default to TVDB if indexer was not detected
|
# default to TVDB if indexer was not detected
|
||||||
if indexer is None:
|
if indexer is None:
|
||||||
indexer = 'Tvdb'
|
found_info = helpers.searchIndexersForShow(show_name)
|
||||||
|
if found_info is not None:
|
||||||
|
indexer = found_info
|
||||||
|
|
||||||
cur_dir['existing_info'] = (indexer_id, show_name, indexer)
|
cur_dir['existing_info'] = (indexer_id, show_name, indexer)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user