Skip to content

Commit

Permalink
Erase cache results when toggling scene numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandog committed Mar 4, 2016
1 parent 1e01642 commit 816edb5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sickbeard/webserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,9 @@ def editShow(self, show=None, location=None, anyQualities=[], bestQualities=[],
except CantUpdateShowException as e:
errors.append("Unable to force an update on scene numbering of the show.")

# Must erase cached results when toggling scene numbering
self.erase_cache(showObj)

if directCall:
return errors

Expand All @@ -1758,6 +1761,24 @@ def editShow(self, show=None, location=None, anyQualities=[], bestQualities=[],
'<ul>' + '\n'.join(['<li>%s</li>' % error for error in errors]) + "</ul>")

return self.redirect("/home/displayShow?show=" + show)

def erase_cache(self, showObj):

try:
main_db_con = db.DBConnection('cache.db')
for curProvider in sickbeard.providers.sortedProviderList():
# Let's check if this provider table already exists
table_exists = main_db_con.select("SELECT name FROM sqlite_master WHERE type='table' AND name=?", [curProvider.get_id()])
if not table_exists:
continue
try:
main_db_con.action("DELETE FROM '%s' WHERE indexerid = ?" % curProvider.get_id(), [showObj.indexerid])
except Exception:
logger.log(u"Unable to delete cached results for provider {} for show: {}".format(curProvider, showObj.name), logger.DEBUG)

except Exception:
logger.log(u"Unable to delete cached results for show: {}".format(showObj.name), logger.DEBUG)


def togglePause(self, show=None):
error, show = Show.pause(show)
Expand Down

0 comments on commit 816edb5

Please sign in to comment.