Change editshow saving empty scene exceptions.

Change replace invalid scene exceptions table season column with -1.
Fix already saved invalid scene_exceptions.
This commit is contained in:
Prinz23 2017-07-11 10:29:55 +01:00 committed by JackDandy
parent 79098a3b04
commit 39b162419c
4 changed files with 14 additions and 1 deletions

View file

@ -62,6 +62,7 @@
* Change catch show update task errors
* Change simplify and update FreeBSD init script
* Change only use newznab Api key if needed
* Change editshow saving empty scene exceptions
[develop changelog]

View file

@ -67,6 +67,8 @@ $(document).ready(function () {
$('#SceneException').fadeIn('fast', 'linear');
var option = $('<option>');
if (null == sceneExSeason)
sceneExSeason = '-1';
option.val(sceneExSeason + '|' + sceneEx);
option.html((config.showIsAnime ? 'S' + ('-1' === sceneExSeason ? '*' : sceneExSeason) + ': ' : '') + sceneEx);

View file

@ -37,6 +37,7 @@ class MainSanityCheck(db.DBSanityCheck):
self.fix_duplicate_episodes()
self.fix_orphan_episodes()
self.fix_unaired_episodes()
self.fix_scene_exceptions()
def fix_duplicate_shows(self, column='indexer_id'):
@ -159,6 +160,14 @@ class MainSanityCheck(db.DBSanityCheck):
else:
logger.log(u'No UNAIRED episodes, check passed')
def fix_scene_exceptions(self):
sql_results = self.connection.select(
'SELECT exception_id FROM scene_exceptions WHERE season = "null"')
if 0 < len(sql_results):
logger.log('Fixing invalid scene exceptions')
self.connection.action('UPDATE scene_exceptions SET season = -1 WHERE season = "null"')
# ======================
# = Main DB Migrations =

View file

@ -18,6 +18,7 @@
import threading
import sickbeard
from sickbeard import db
from sickbeard.helpers import tryInt
nameCache = {}
nameCacheLock = threading.Lock()
@ -83,7 +84,7 @@ def buildNameCache(show=None):
if cache_results:
for cache_result in cache_results:
indexer_id = int(cache_result['indexer_id'])
season = int(cache_result['season'])
season = tryInt(cache_result['season'], -1)
name = sickbeard.helpers.full_sanitizeSceneName(cache_result['show_name'])
nameCache[name] = [indexer_id, season]