From 410251eaf2667ff1f632e15e85482621fca35b19 Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Sat, 7 Apr 2018 00:14:13 +0100 Subject: [PATCH] Change improve tvinfo source meta handling for cases where server is either down, or no results are returned. --- CHANGES.md | 7 ++++++- lib/tvdb_api/tvdb_api.py | 2 -- sickbeard/metadata/generic.py | 10 ++++++++++ sickbeard/metadata/kodi.py | 12 +++++++++++- sickbeard/metadata/mede8er.py | 12 +++++++++++- sickbeard/metadata/mediabrowser.py | 12 +++++++++++- sickbeard/metadata/tivo.py | 7 ++++++- sickbeard/metadata/wdtv.py | 7 ++++++- sickbeard/metadata/xbmc_12plus.py | 10 ++++++++++ 9 files changed, 71 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b52c74b2..3bf5b62c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,9 @@ -### 0.15.7 (2018-04-06 13:30:00 UTC) +### 0.15.8 (2018-04-07 00:14:00 UTC) + +* Change improve tvinfo source meta handling for cases where server is either down, or no results are returned + + +### 0.15.7 (2018-04-06 13:30:00 UTC) * Change improve metadata handler during postprocessing when tvinfo source is down * Fix Torrentz2 filter spam diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index 60dff9e5..c0f958f9 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -644,8 +644,6 @@ class Tvdb: try: src = self._load_url(url, params=params, language=language) return src - except tvdb_error: - raise sickbeard.indexer_error except (StandardError, Exception): return [] diff --git a/sickbeard/metadata/generic.py b/sickbeard/metadata/generic.py index 88dac4cf..bacc97bf 100644 --- a/sickbeard/metadata/generic.py +++ b/sickbeard/metadata/generic.py @@ -789,6 +789,11 @@ class GenericMetadata(): show_obj.indexer).name + ", not downloading images: " + ex(e), logger.ERROR) return None + if not indexer_show_obj: + logger.log(u'Show %s not found on %s ' % + (show_obj.name, sickbeard.indexerApi(show_obj.indexer).name), logger.WARNING) + return None + return_links = False if 'fanart_all' == image_type: return_links = True @@ -876,6 +881,11 @@ class GenericMetadata(): show_obj.indexer).name + ', not downloading images: ' + ex(e), logger.ERROR) return result + if not indexer_show_obj: + logger.log(u'Show %s not found on %s ' % + (show_obj.name, sickbeard.indexerApi(show_obj.indexer).name), logger.WARNING) + return result + season_images = getattr(indexer_show_obj, '_banners', {}).get( ('season', 'seasonwide')['seasonwides' == image_type], {}).get(season, {}) for image_id in season_images.keys(): diff --git a/sickbeard/metadata/kodi.py b/sickbeard/metadata/kodi.py index a771d84f..e2368414 100644 --- a/sickbeard/metadata/kodi.py +++ b/sickbeard/metadata/kodi.py @@ -124,6 +124,11 @@ class KODIMetadata(generic.GenericMetadata): logger.ERROR) raise + if not myShow: + logger.log(u'Show %s not found on %s ' % (show_obj.name, sickbeard.indexerApi(show_obj.indexer).name), + logger.WARNING) + return + # check for title and id if getattr(myShow, 'seriesname', None) is None or getattr(myShow, 'id', None) is None: logger.log(u'Incomplete info for show with id ' + str(show_ID) + ' on ' + sickbeard.indexerApi( @@ -241,6 +246,11 @@ class KODIMetadata(generic.GenericMetadata): ep_obj.show.indexer).name + ' while creating meta files - skipping - ' + ex(e), logger.ERROR) return + if not myShow: + logger.log(u'Show %s not found on %s ' % + (ep_obj.show.name, sickbeard.indexerApi(ep_obj.show.indexer).name), logger.WARNING) + return + if len(eps_to_write) > 1: rootNode = etree.Element('xbmcmultiepisode') else: @@ -251,7 +261,7 @@ class KODIMetadata(generic.GenericMetadata): try: myEp = myShow[curEpToWrite.season][curEpToWrite.episode] - except (sickbeard.indexer_episodenotfound, sickbeard.indexer_seasonnotfound): + except (StandardError, Exception): logger.log(u'Unable to find episode ' + str(curEpToWrite.season) + 'x' + str( curEpToWrite.episode) + ' on ' + sickbeard.indexerApi( ep_obj.show.indexer).name + '.. has it been removed? Should I delete from db?') diff --git a/sickbeard/metadata/mede8er.py b/sickbeard/metadata/mede8er.py index 3b7e6a7b..bf8eb71d 100644 --- a/sickbeard/metadata/mede8er.py +++ b/sickbeard/metadata/mede8er.py @@ -129,6 +129,11 @@ class Mede8erMetadata(mediabrowser.MediaBrowserMetadata): logger.log(u"TVDB is down, can't use its data to make the NFO", logger.ERROR) raise + if not myShow: + logger.log(u'Show %s not found on %s ' % (show_obj.name, sickbeard.indexerApi(show_obj.indexer).name), + logger.WARNING) + return + # check for title and id try: if myShow['seriesname'] == None or myShow['seriesname'] == "" or myShow['id'] == None or myShow['id'] == "": @@ -242,6 +247,11 @@ class Mede8erMetadata(mediabrowser.MediaBrowserMetadata): logger.log(u"Unable to connect to TVDB while creating meta files - skipping - " + ex(e), logger.ERROR) return False + if not myShow: + logger.log(u'Show %s not found on %s ' % (ep_obj.show.name, sickbeard.indexerApi(ep_obj.show.indexer).name), + logger.WARNING) + return + rootNode = etree.Element("details") movie = etree.SubElement(rootNode, "movie") @@ -254,7 +264,7 @@ class Mede8erMetadata(mediabrowser.MediaBrowserMetadata): try: myEp = myShow[curEpToWrite.season][curEpToWrite.episode] - except (sickbeard.indexer_episodenotfound, sickbeard.indexer_seasonnotfound): + except (StandardError, Exception): 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?") return None diff --git a/sickbeard/metadata/mediabrowser.py b/sickbeard/metadata/mediabrowser.py index 5dd043f2..7ef95e22 100644 --- a/sickbeard/metadata/mediabrowser.py +++ b/sickbeard/metadata/mediabrowser.py @@ -256,6 +256,11 @@ class MediaBrowserMetadata(generic.GenericMetadata): logger.ERROR) raise + if not myShow: + logger.log(u'Show %s not found on %s ' % (show_obj.name, sickbeard.indexerApi(show_obj.indexer).name), + logger.WARNING) + return + # check for title and id if getattr(myShow, 'seriesname', None) is None or getattr(myShow, 'id', None) is None: logger.log(u"Incomplete info for show with id " + str(show_obj.indexerid) + " on " + sickbeard.indexerApi( @@ -416,6 +421,11 @@ class MediaBrowserMetadata(generic.GenericMetadata): ep_obj.show.indexer).name + " while creating meta files - skipping - " + ex(e), logger.ERROR) return False + if not myShow: + logger.log(u'Show %s not found on %s ' % (ep_obj.show.name, sickbeard.indexerApi(ep_obj.show.indexer).name), + logger.WARNING) + return + rootNode = etree.Element("Item") # write an MediaBrowser XML containing info for all matching episodes @@ -423,7 +433,7 @@ class MediaBrowserMetadata(generic.GenericMetadata): try: myEp = myShow[curEpToWrite.season][curEpToWrite.episode] - except (sickbeard.indexer_episodenotfound, sickbeard.indexer_seasonnotfound): + except (StandardError, Exception): logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str( curEpToWrite.episode) + " on " + sickbeard.indexerApi( ep_obj.show.indexer).name + ".. has it been removed? Should I delete from db?") diff --git a/sickbeard/metadata/tivo.py b/sickbeard/metadata/tivo.py index 13254567..3eae82ce 100644 --- a/sickbeard/metadata/tivo.py +++ b/sickbeard/metadata/tivo.py @@ -188,11 +188,16 @@ class TIVOMetadata(generic.GenericMetadata): ep_obj.show.indexer).name + " while creating meta files - skipping - " + str(e), logger.ERROR) return False + if not myShow: + logger.log(u'Show %s not found on %s ' % (ep_obj.show.name, sickbeard.indexerApi(ep_obj.show.indexer).name), + logger.WARNING) + return + for curEpToWrite in eps_to_write: try: myEp = myShow[curEpToWrite.season][curEpToWrite.episode] - except (sickbeard.indexer_episodenotfound, sickbeard.indexer_seasonnotfound): + except (StandardError, Exception): logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str( curEpToWrite.episode) + " on " + sickbeard.indexerApi( ep_obj.show.indexer).name + "... has it been removed? Should I delete from db?") diff --git a/sickbeard/metadata/wdtv.py b/sickbeard/metadata/wdtv.py index e53a7bb6..00817a90 100644 --- a/sickbeard/metadata/wdtv.py +++ b/sickbeard/metadata/wdtv.py @@ -199,6 +199,11 @@ class WDTVMetadata(generic.GenericMetadata): ep_obj.show.indexer).name + " while creating meta files - skipping - " + ex(e), logger.ERROR) return False + if not myShow: + logger.log(u'Show %s not found on %s ' % (ep_obj.show.name, sickbeard.indexerApi(ep_obj.show.indexer).name), + logger.WARNING) + return + rootNode = etree.Element("details") # write an WDTV XML containing info for all matching episodes @@ -206,7 +211,7 @@ class WDTVMetadata(generic.GenericMetadata): try: myEp = myShow[curEpToWrite.season][curEpToWrite.episode] - except (sickbeard.indexer_episodenotfound, sickbeard.indexer_seasonnotfound): + except (StandardError, Exception): logger.log(u"Unable to find episode " + str(curEpToWrite.season) + "x" + str( curEpToWrite.episode) + " on " + sickbeard.indexerApi( ep_obj.show.indexer).name + "... has it been removed? Should I delete from db?") diff --git a/sickbeard/metadata/xbmc_12plus.py b/sickbeard/metadata/xbmc_12plus.py index ddd74897..58a3708f 100644 --- a/sickbeard/metadata/xbmc_12plus.py +++ b/sickbeard/metadata/xbmc_12plus.py @@ -124,6 +124,11 @@ class XBMC_12PlusMetadata(generic.GenericMetadata): logger.ERROR) raise + if not myShow: + logger.log(u'Show %s not found on %s ' % (show_obj.name, sickbeard.indexerApi(show_obj.indexer).name), + logger.WARNING) + return + # check for title and id if getattr(myShow, 'seriesname', None) is None or getattr(myShow, 'id', None) is None: logger.log(u"Incomplete info for show with id " + str(show_ID) + " on " + sickbeard.indexerApi( @@ -241,6 +246,11 @@ class XBMC_12PlusMetadata(generic.GenericMetadata): ep_obj.show.indexer).name + " while creating meta files - skipping - " + ex(e), logger.ERROR) return + if not myShow: + logger.log(u'Show %s not found on %s ' % (ep_obj.show.name, sickbeard.indexerApi(ep_obj.show.indexer).name), + logger.WARNING) + return + if len(eps_to_write) > 1: rootNode = etree.Element("xbmcmultiepisode") else: