mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 18:03:37 +00:00
Merge pull request #657 from JackDandy/feature/ChangeUpdateShows
Change during update set shows with newly added airdate to wanted and…
This commit is contained in:
commit
644385e346
5 changed files with 417 additions and 433 deletions
|
@ -37,6 +37,7 @@
|
|||
Mass Update, Add with Browse and from Existing views
|
||||
* Add Emby notifier to config/Notifications
|
||||
* Fix alternative unicode show names from breaking search
|
||||
* Change show update, set shows with newly added airdate or existing episodes with future or never dates, to "Wanted"
|
||||
|
||||
|
||||
### 0.11.6 (2016-02-18 23:10:00 UTC)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 860 B |
Binary file not shown.
Before Width: | Height: | Size: 595 B After Width: | Height: | Size: 784 B |
|
@ -138,7 +138,7 @@ class ShowQueue(generic_queue.GenericQueue):
|
|||
|
||||
if ((not after_update and self.isBeingUpdated(show)) or self.isInUpdateQueue(show)) and not force:
|
||||
logger.log(
|
||||
u'Skipping this refresh as there is already an update queued or in progress and a refresh is done at the end of an update anyway.',
|
||||
'Skipping this refresh as there is already an update queued or in progress and a refresh is done at the end of an update anyway.',
|
||||
logger.DEBUG)
|
||||
return
|
||||
|
||||
|
@ -276,7 +276,7 @@ class QueueItemAdd(ShowQueueItem):
|
|||
|
||||
ShowQueueItem.run(self)
|
||||
|
||||
logger.log(u'Starting to add show ' + self.showDir)
|
||||
logger.log('Starting to add show %s' % self.showDir)
|
||||
# make sure the Indexer IDs are valid
|
||||
try:
|
||||
|
||||
|
@ -291,29 +291,27 @@ class QueueItemAdd(ShowQueueItem):
|
|||
|
||||
# this usually only happens if they have an NFO in their show dir which gave us a Indexer ID that has no proper english version of the show
|
||||
if getattr(s, 'seriesname', None) is None:
|
||||
logger.log(u'Show in ' + self.showDir + ' has no name on ' + str(
|
||||
sickbeard.indexerApi(self.indexer).name) + ', probably the wrong language used to search with.',
|
||||
logger.ERROR)
|
||||
logger.log('Show in %s has no name on %s, probably the wrong language used to search with.' %
|
||||
(self.showDir, sickbeard.indexerApi(self.indexer).name), logger.ERROR)
|
||||
ui.notifications.error('Unable to add show',
|
||||
'Show in ' + self.showDir + ' has no name on ' + str(sickbeard.indexerApi(
|
||||
self.indexer).name) + ', probably the wrong language. Delete .nfo and add manually in the correct language.')
|
||||
'Show in %s has no name on %s, probably the wrong language. Delete .nfo and add manually in the correct language.' %
|
||||
(self.showDir, sickbeard.indexerApi(self.indexer).name))
|
||||
self._finishEarly()
|
||||
return
|
||||
# if the show has no episodes/seasons
|
||||
if not sickbeard.ALLOW_INCOMPLETE_SHOWDATA and not s:
|
||||
msg = u'Show %s is on %s but contains no season/episode data. Only the show folder was created.'\
|
||||
msg = 'Show %s is on %s but contains no season/episode data. Only the show folder was created.'\
|
||||
% (s['seriesname'], sickbeard.indexerApi(self.indexer).name)
|
||||
logger.log(msg, logger.ERROR)
|
||||
ui.notifications.error('Unable to add show', msg)
|
||||
self._finishEarly()
|
||||
return
|
||||
except Exception as e:
|
||||
logger.log(u'Unable to find show ID:' + str(self.indexer_id) + ' on Indexer: ' + str(
|
||||
sickbeard.indexerApi(self.indexer).name), logger.ERROR)
|
||||
logger.log('Unable to find show ID:%s on Indexer: %s' % (self.indexer_id, sickbeard.indexerApi(self.indexer).name),
|
||||
logger.ERROR)
|
||||
ui.notifications.error('Unable to add show',
|
||||
'Unable to look up the show in ' + self.showDir + ' on ' + str(sickbeard.indexerApi(
|
||||
self.indexer).name) + ' using ID ' + str(
|
||||
self.indexer_id) + ', not using the NFO. Delete .nfo and try adding manually again.')
|
||||
'Unable to look up the show in %s on %s using ID %s, not using the NFO. Delete .nfo and try adding manually again.' %
|
||||
(self.showDir, sickbeard.indexerApi(self.indexer).name, self.indexer_id))
|
||||
self._finishEarly()
|
||||
return
|
||||
|
||||
|
@ -350,26 +348,25 @@ class QueueItemAdd(ShowQueueItem):
|
|||
|
||||
except sickbeard.indexer_exception as e:
|
||||
logger.log(
|
||||
u'Unable to add show due to an error with ' + sickbeard.indexerApi(self.indexer).name + ': ' + ex(e),
|
||||
'Unable to add show due to an error with %s: %s' % (sickbeard.indexerApi(self.indexer).name, ex(e)),
|
||||
logger.ERROR)
|
||||
if self.show:
|
||||
ui.notifications.error(
|
||||
'Unable to add ' + str(self.show.name) + ' due to an error with ' + sickbeard.indexerApi(
|
||||
self.indexer).name + '')
|
||||
'Unable to add %s due to an error with %s' % (self.show.name, sickbeard.indexerApi(self.indexer).name))
|
||||
else:
|
||||
ui.notifications.error(
|
||||
'Unable to add show due to an error with ' + sickbeard.indexerApi(self.indexer).name + '')
|
||||
'Unable to add show due to an error with %s' % sickbeard.indexerApi(self.indexer).name)
|
||||
self._finishEarly()
|
||||
return
|
||||
|
||||
except exceptions.MultipleShowObjectsException:
|
||||
logger.log(u'The show in ' + self.showDir + ' is already in your show list, skipping', logger.ERROR)
|
||||
ui.notifications.error('Show skipped', 'The show in ' + self.showDir + ' is already in your show list')
|
||||
logger.log('The show in %s is already in your show list, skipping' % self.showDir, logger.ERROR)
|
||||
ui.notifications.error('Show skipped', 'The show in %s is already in your show list' % self.showDir)
|
||||
self._finishEarly()
|
||||
return
|
||||
|
||||
except Exception as e:
|
||||
logger.log(u'Error trying to add show: ' + ex(e), logger.ERROR)
|
||||
logger.log('Error trying to add show: %s' % ex(e), logger.ERROR)
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
self._finishEarly()
|
||||
raise
|
||||
|
@ -379,7 +376,7 @@ class QueueItemAdd(ShowQueueItem):
|
|||
try:
|
||||
self.show.saveToDB()
|
||||
except Exception as e:
|
||||
logger.log(u'Error saving the show to the database: ' + ex(e), logger.ERROR)
|
||||
logger.log('Error saving the show to the database: %s' % ex(e), logger.ERROR)
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
self._finishEarly()
|
||||
raise
|
||||
|
@ -391,20 +388,20 @@ class QueueItemAdd(ShowQueueItem):
|
|||
self.show.loadEpisodesFromIndexer()
|
||||
except Exception as e:
|
||||
logger.log(
|
||||
u'Error with ' + sickbeard.indexerApi(self.show.indexer).name + ', not creating episode list: ' + ex(e),
|
||||
'Error with %s, not creating episode list: %s' % (sickbeard.indexerApi(self.show.indexer).name, ex(e)),
|
||||
logger.ERROR)
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
|
||||
try:
|
||||
self.show.loadEpisodesFromDir()
|
||||
except Exception as e:
|
||||
logger.log(u'Error searching directory for episodes: ' + ex(e), logger.ERROR)
|
||||
logger.log('Error searching directory for episodes: %s' % ex(e), logger.ERROR)
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
|
||||
# if they gave a custom status then change all the eps to it
|
||||
my_db = db.DBConnection()
|
||||
if self.default_status != SKIPPED:
|
||||
logger.log(u'Setting all episodes to the specified default status: ' + str(self.default_status))
|
||||
logger.log('Setting all episodes to the specified default status: %s' % sickbeard.common.statusStrings[self.default_status])
|
||||
my_db.action('UPDATE tv_episodes SET status = ? WHERE status = ? AND showid = ? AND season != 0',
|
||||
[self.default_status, SKIPPED, self.show.indexerid])
|
||||
|
||||
|
@ -447,7 +444,7 @@ class QueueItemAdd(ShowQueueItem):
|
|||
msg = ' the specified show into ' + self.showDir
|
||||
# if started with WANTED eps then run the backlog
|
||||
if WANTED == self.default_status or items_wanted:
|
||||
logger.log(u'Launching backlog for this show since episodes are WANTED')
|
||||
logger.log('Launching backlog for this show since episodes are WANTED')
|
||||
sickbeard.backlogSearchScheduler.action.search_backlog([self.show]) #@UndefinedVariable
|
||||
ui.notifications.message('Show added/search', 'Adding and searching for episodes of' + msg)
|
||||
else:
|
||||
|
@ -471,7 +468,7 @@ class QueueItemAdd(ShowQueueItem):
|
|||
sickbeard.scene_numbering.xem_refresh(self.show.indexerid, self.show.indexer, force=True)
|
||||
# check if show has XEM mapping and if user disabled scene numbering during add show, output availability to log
|
||||
if not self.scene and self.show.indexerid in sickbeard.scene_exceptions.xem_ids_list[self.show.indexer]:
|
||||
logger.log(u'Alternative scene episode numbers were disabled during add show. Edit show to enable them for searching.')
|
||||
logger.log('Alternative scene episode numbers were disabled during add show. Edit show to enable them for searching.')
|
||||
|
||||
# update internal name cache
|
||||
name_cache.buildNameCache(self.show)
|
||||
|
@ -521,12 +518,12 @@ class QueueItemRename(ShowQueueItem):
|
|||
|
||||
ShowQueueItem.run(self)
|
||||
|
||||
logger.log(u'Performing rename on ' + self.show.name)
|
||||
logger.log('Performing rename on %s' % self.show.name)
|
||||
|
||||
try:
|
||||
show_loc = self.show.location
|
||||
except exceptions.ShowDirNotFoundException:
|
||||
logger.log(u'Can\'t perform rename on ' + self.show.name + ' when the show directory is missing.', logger.WARNING)
|
||||
logger.log('Can\'t perform rename on %s when the show directory is missing.' % self.show.name, logger.WARNING)
|
||||
return
|
||||
|
||||
ep_obj_rename_list = []
|
||||
|
@ -561,7 +558,7 @@ class QueueItemSubtitle(ShowQueueItem):
|
|||
def run(self):
|
||||
ShowQueueItem.run(self)
|
||||
|
||||
logger.log(u'Downloading subtitles for ' + self.show.name)
|
||||
logger.log('Downloading subtitles for %s' % self.show.name)
|
||||
|
||||
self.show.downloadSubtitles()
|
||||
|
||||
|
@ -579,24 +576,24 @@ class QueueItemUpdate(ShowQueueItem):
|
|||
ShowQueueItem.run(self)
|
||||
|
||||
if not sickbeard.indexerApi(self.show.indexer).config['active']:
|
||||
logger.log(u'Indexer %s is marked inactive, aborting update for show %s and continue with refresh.' % (sickbeard.indexerApi(self.show.indexer).config['name'], self.show.name))
|
||||
logger.log('Indexer %s is marked inactive, aborting update for show %s and continue with refresh.' % (sickbeard.indexerApi(self.show.indexer).config['name'], self.show.name))
|
||||
sickbeard.showQueueScheduler.action.refreshShow(self.show, self.force, self.scheduled_update, after_update=True)
|
||||
return
|
||||
|
||||
logger.log(u'Beginning update of ' + self.show.name)
|
||||
logger.log('Beginning update of %s' % self.show.name)
|
||||
|
||||
logger.log(u'Retrieving show info from ' + sickbeard.indexerApi(self.show.indexer).name + '', logger.DEBUG)
|
||||
logger.log('Retrieving show info from %s' % sickbeard.indexerApi(self.show.indexer).name, logger.DEBUG)
|
||||
try:
|
||||
result = self.show.loadFromIndexer(cache=not self.force)
|
||||
if None is not result:
|
||||
return
|
||||
except sickbeard.indexer_error as e:
|
||||
logger.log(u'Unable to contact ' + sickbeard.indexerApi(self.show.indexer).name + ', aborting: ' + ex(e),
|
||||
logger.log('Unable to contact %s, aborting: %s' % (sickbeard.indexerApi(self.show.indexer).name, ex(e)),
|
||||
logger.WARNING)
|
||||
return
|
||||
except sickbeard.indexer_attributenotfound as e:
|
||||
logger.log(u'Data retrieved from ' + sickbeard.indexerApi(
|
||||
self.show.indexer).name + ' was incomplete, aborting: ' + ex(e), logger.ERROR)
|
||||
logger.log('Data retrieved from %s was incomplete, aborting: %s' %
|
||||
(sickbeard.indexerApi(self.show.indexer).name, ex(e)), logger.ERROR)
|
||||
return
|
||||
|
||||
if self.force_web:
|
||||
|
@ -605,39 +602,38 @@ class QueueItemUpdate(ShowQueueItem):
|
|||
try:
|
||||
self.show.saveToDB()
|
||||
except Exception as e:
|
||||
logger.log(u'Error saving the episode to the database: ' + ex(e), logger.ERROR)
|
||||
logger.log('Error saving the episode to the database: %s' % ex(e), logger.ERROR)
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
|
||||
# get episode list from DB
|
||||
logger.log(u'Loading all episodes from the database', logger.DEBUG)
|
||||
DBEpList = self.show.loadEpisodesFromDB()
|
||||
logger.log('Loading all episodes from the database', logger.DEBUG)
|
||||
DBEpList = self.show.loadEpisodesFromDB(update=True)
|
||||
|
||||
# get episode list from TVDB
|
||||
logger.log(u'Loading all episodes from ' + sickbeard.indexerApi(self.show.indexer).name + '', logger.DEBUG)
|
||||
logger.log('Loading all episodes from %s' % sickbeard.indexerApi(self.show.indexer).name, logger.DEBUG)
|
||||
try:
|
||||
IndexerEpList = self.show.loadEpisodesFromIndexer(cache=not self.force)
|
||||
IndexerEpList = self.show.loadEpisodesFromIndexer(cache=not self.force, update=True)
|
||||
except sickbeard.indexer_exception as e:
|
||||
logger.log(u'Unable to get info from ' + sickbeard.indexerApi(
|
||||
self.show.indexer).name + ', the show info will not be refreshed: ' + ex(e), logger.ERROR)
|
||||
logger.log('Unable to get info from %s, the show info will not be refreshed: %s' %
|
||||
(sickbeard.indexerApi(self.show.indexer).name, ex(e)), logger.ERROR)
|
||||
IndexerEpList = None
|
||||
|
||||
if IndexerEpList == None:
|
||||
logger.log(u'No data returned from ' + sickbeard.indexerApi(
|
||||
self.show.indexer).name + ', unable to update this show', logger.ERROR)
|
||||
logger.log('No data returned from %s, unable to update this show' %
|
||||
sickbeard.indexerApi(self.show.indexer).name, logger.ERROR)
|
||||
else:
|
||||
# for each ep we found on TVDB delete it from the DB list
|
||||
for curSeason in IndexerEpList:
|
||||
for curEpisode in IndexerEpList[curSeason]:
|
||||
logger.log(u'Removing ' + str(curSeason) + 'x' + str(curEpisode) + ' from the DB list',
|
||||
logger.DEBUG)
|
||||
logger.log('Removing %sx%s from the DB list' % (curSeason, curEpisode), logger.DEBUG)
|
||||
if curSeason in DBEpList and curEpisode in DBEpList[curSeason]:
|
||||
del DBEpList[curSeason][curEpisode]
|
||||
|
||||
# for the remaining episodes in the DB list just delete them from the DB
|
||||
for curSeason in DBEpList:
|
||||
for curEpisode in DBEpList[curSeason]:
|
||||
logger.log(u'Permanently deleting episode ' + str(curSeason) + 'x' + str(
|
||||
curEpisode) + ' from the database', logger.MESSAGE)
|
||||
logger.log('Permanently deleting episode %sx%s from the database' %
|
||||
(curSeason, curEpisode), logger.MESSAGE)
|
||||
curEp = self.show.getEpisode(curSeason, curEpisode)
|
||||
try:
|
||||
curEp.deleteEpisode()
|
||||
|
|
757
sickbeard/tv.py
757
sickbeard/tv.py
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue