Commit 141d1ce7 authored by echel0n's avatar echel0n

Only update indexer details for shows when performing show updates on shows...

Only update indexer details for shows when performing show updates on shows marked as updated on indexer, full updates performed every 7 days.
parent d41e5256
# Changelog
- * c815554 - 2019-02-11: Fixed issue with "unable to verify the download url"
- * 875074a - 2019-02-15: Only update indexer details for shows when performing show updates on shows marked as updated on indexer, full updates performed every 7 days.
- * d41e525 - 2019-02-11: Fixed issue with "unable to verify the download url"
- * 9a10462 - 2019-01-22: Release v9.4.58
- * 92b5423 - 2019-01-22: Dockerfile default TZ set to Canada/Pacific
- * c128f16 - 2019-01-22: Pre-Release v9.4.58.dev1
......
......@@ -90,7 +90,7 @@ class ShowQueue(srQueue):
def _get_loading_show_list(self):
return [x for x in self._get_queue_items() if x.is_loading]
def updateShow(self, show, force=False):
def updateShow(self, show, indexer_update_only=False, force=False):
if self.is_being_added(show):
raise CantUpdateShowException("{} is still being added, please wait until it is finished before trying to "
"update.".format(show.name))
......@@ -103,7 +103,8 @@ class ShowQueue(srQueue):
raise CantUpdateShowException("{} is in the process of being updated, can't update again until "
"it's done.".format(show.name))
return self.put(QueueItemForceUpdate(show)) if force else self.put(QueueItemUpdate(show))
return self.put(QueueItemForceUpdate(show, indexer_update_only)) if force else self.put(
QueueItemUpdate(show, indexer_update_only))
def refreshShow(self, show, force=False):
if (self.is_being_refreshed(show) or self.is_in_refresh_queue(show)) and not force:
......@@ -552,8 +553,9 @@ class QueueItemSubtitle(ShowQueueItem):
class QueueItemUpdate(ShowQueueItem):
def __init__(self, show=None, action_id=ShowQueueActions.UPDATE):
def __init__(self, show=None, indexer_update_only=False, action_id=ShowQueueActions.UPDATE):
super(QueueItemUpdate, self).__init__(show, action_id)
self.indexer_update_only = indexer_update_only
self.force = False
def run(self):
......@@ -574,8 +576,9 @@ class QueueItemUpdate(ShowQueueItem):
return
try:
sickrage.app.log.debug("Attempting to retrieve show info from IMDb")
self.show.load_imdb_info()
if not self.indexer_update_only:
sickrage.app.log.debug("Attempting to retrieve show info from IMDb")
self.show.load_imdb_info()
except Exception as e:
sickrage.app.log.warning("Error loading IMDb info for {}: {}".format(IndexerApi(self.show.indexer).name, e))
......@@ -620,12 +623,14 @@ class QueueItemUpdate(ShowQueueItem):
"Finished updates in {}s for show: {}".format(round(time.time() - start_time, 2), self.show.name))
# refresh show
sickrage.app.show_queue.refreshShow(self.show, self.force)
if not self.indexer_update_only:
sickrage.app.show_queue.refreshShow(self.show, self.force)
class QueueItemForceUpdate(QueueItemUpdate):
def __init__(self, show=None):
super(QueueItemForceUpdate, self).__init__(show, ShowQueueActions.FORCEUPDATE)
def __init__(self, show=None, indexer_update_only=False):
super(QueueItemForceUpdate, self).__init__(show, indexer_update_only, ShowQueueActions.FORCEUPDATE)
self.indexer_update_only = indexer_update_only
self.force = True
......
......@@ -77,9 +77,10 @@ class ShowUpdater(object):
continue
try:
stale = (datetime.datetime.now() - datetime.datetime.fromordinal(show.last_update)).days >= 7
if show.indexerid in updated_shows or stale:
pi_list.append(sickrage.app.show_queue.updateShow(show, False))
if show.indexerid in updated_shows:
pi_list.append(sickrage.app.show_queue.updateShow(show, indexer_update_only=True, force=False))
elif (datetime.datetime.now() - datetime.datetime.fromordinal(show.last_update)).days >= 7:
pi_list.append(sickrage.app.show_queue.updateShow(show, force=False))
else:
pi_list.append(sickrage.app.show_queue.refreshShow(show, False))
except (CantUpdateShowException, CantRefreshShowException) as e:
......
......@@ -2654,7 +2654,7 @@ class CMD_ShowUpdate(ApiCall):
return _responds(RESULT_FAILURE, msg="Show not found")
try:
sickrage.app.show_queue.updateShow(showObj, True) # @UndefinedVariable
sickrage.app.show_queue.updateShow(showObj, force=True)
return _responds(RESULT_SUCCESS, msg=str(showObj.name) + " has queued to be updated")
except CantUpdateShowException as e:
sickrage.app.log.debug("API::Unable to update show: {}".format(e))
......
......@@ -1534,7 +1534,7 @@ class Home(WebHandler):
# force the update
if do_update:
try:
sickrage.app.show_queue.updateShow(showObj, True)
sickrage.app.show_queue.updateShow(showObj, force=True)
time.sleep(cpu_presets[sickrage.app.config.cpu_preset])
except CantUpdateShowException as e:
errors.append(_("Unable to update show: {}").format(e))
......@@ -1645,7 +1645,7 @@ class Home(WebHandler):
# force the update
try:
sickrage.app.show_queue.updateShow(showObj, bool(force))
sickrage.app.show_queue.updateShow(showObj, force=bool(force))
except CantUpdateShowException as e:
sickrage.app.alerts.error(_("Unable to update this show."), str(e))
......@@ -3424,7 +3424,7 @@ class Manage(Home, WebRoot):
if curShowID in toUpdate:
try:
sickrage.app.show_queue.updateShow(showObj, True)
sickrage.app.show_queue.updateShow(showObj, force=True)
updates.append(showObj.name)
except CantUpdateShowException as e:
errors.append(_("Unable to update show: {}").format(e))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment