diff --git a/sickbeard/databases/cache_db.py b/sickbeard/databases/cache_db.py index 606a6a54..52a9d8c4 100644 --- a/sickbeard/databases/cache_db.py +++ b/sickbeard/databases/cache_db.py @@ -73,4 +73,11 @@ class AddSceneExceptionsSeasons(AddSceneNameCache): return self.hasColumn("scene_exceptions", "season") def execute(self): - self.addColumn("scene_exceptions", "season", "NUMERIC", -1) \ No newline at end of file + self.addColumn("scene_exceptions", "season", "NUMERIC", -1) + +class AddSceneExceptionsCustom(AddSceneExceptionsSeasons): + def test(self): + return self.hasColumn("scene_exceptions", "custom") + + def execute(self): + self.addColumn("scene_exceptions", "custom", "NUMERIC", 0) \ No newline at end of file diff --git a/sickbeard/scene_exceptions.py b/sickbeard/scene_exceptions.py index 6f11252e..fd06412b 100644 --- a/sickbeard/scene_exceptions.py +++ b/sickbeard/scene_exceptions.py @@ -216,13 +216,14 @@ def update_scene_exceptions(indexer_id, scene_exceptions): myDB = db.DBConnection("cache.db") - myDB.action('DELETE FROM scene_exceptions WHERE indexer_id=?', [indexer_id]) + myDB.action('DELETE FROM scene_exceptions WHERE indexer_id=? and custom=1', [indexer_id]) logger.log(u"Updating internal scene name cache", logger.MESSAGE) - for cur_exception, cur_season in scene_exceptions: - exceptionIndexerCache[helpers.full_sanitizeSceneName(cur_exception)] = indexer_id - myDB.action("INSERT INTO scene_exceptions (indexer_id, show_name, season) VALUES (?,?,?)", - [indexer_id, cur_exception, cur_season]) + for cur_season in [-1] + sickbeard.scene_exceptions.get_scene_seasons(indexer_id): + for cur_exception in scene_exceptions: + exceptionIndexerCache[helpers.full_sanitizeSceneName(cur_exception)] = indexer_id + myDB.action("INSERT INTO scene_exceptions (indexer_id, show_name, season, custom) VALUES (?,?,?,?)", + [indexer_id, cur_exception, cur_season, 1]) name_cache.clearCache()