Merge pull request #314 from JackDandy/feature/ChangeOnlyAddValidItemsToSaveDB

Change only add valid items to save to DB.
This commit is contained in:
JackDandy 2015-03-29 15:33:39 +01:00
commit 86443c21ca
4 changed files with 26 additions and 13 deletions

View file

@ -92,6 +92,7 @@
* Add "File logging level" to General Config/Advanced Settings
* Fix saving of Sort By/Next Episode in Layout Poster on Show List page
* Change improve backlog search
* Change only add valid items to save to DB
[develop changelog]
* Fix traceback error when using the menu item Manage/Update Kodi

View file

@ -453,9 +453,11 @@ class TVShow(object):
logger.log(str(self.indexerid) + ": Could not refresh subtitles", logger.ERROR)
logger.log(traceback.format_exc(), logger.DEBUG)
sql_l.append(curEpisode.get_sql())
result = curEpisode.get_sql()
if None is not result:
sql_l.append(result)
if len(sql_l) > 0:
if 0 < len(sql_l):
myDB = db.DBConnection()
myDB.mass_action(sql_l)
@ -573,11 +575,13 @@ class TVShow(object):
self.indexer).name + " for episode " + str(season) + "x" + str(episode), logger.DEBUG)
ep.loadFromIndexer(season, episode, tvapi=t)
sql_l.append(ep.get_sql())
result = ep.get_sql()
if None is not result:
sql_l.append(result)
scannedEps[season][episode] = True
if len(sql_l) > 0:
if 0 < len(sql_l):
myDB = db.DBConnection()
myDB.mass_action(sql_l)
@ -731,9 +735,11 @@ class TVShow(object):
curEp.status = Quality.compositeStatus(newStatus, newQuality)
with curEp.lock:
sql_l.append(curEp.get_sql())
result = curEp.get_sql()
if None is not result:
sql_l.append(result)
if len(sql_l) > 0:
if 0 < len(sql_l):
myDB = db.DBConnection()
myDB.mass_action(sql_l)
@ -1127,13 +1133,15 @@ class TVShow(object):
curEp.hastbn = False
curEp.release_name = ''
sql_l.append(curEp.get_sql())
result = curEp.get_sql()
if None is not result:
sql_l.append(result)
else:
# the file exists, set its modify file stamp
if sickbeard.AIRDATE_EPISODES:
curEp.airdateModifyStamp()
if len(sql_l) > 0:
if 0 < len(sql_l):
myDB = db.DBConnection()
myDB.mass_action(sql_l)
@ -2511,9 +2519,11 @@ class TVEpisode(object):
sql_l = []
with self.lock:
for relEp in [self] + self.relatedEps:
sql_l.append(relEp.get_sql())
result = relEp.get_sql()
if None is not result:
sql_l.append(result)
if len(sql_l) > 0:
if 0 < len(sql_l):
myDB = db.DBConnection()
myDB.mass_action(sql_l)

View file

@ -999,13 +999,15 @@ class CMD_EpisodeSetStatus(ApiCall):
continue
epObj.status = self.status
sql_l.append(epObj.get_sql())
result = epObj.get_sql()
if None is not result:
sql_l.append(result)
if self.status == WANTED:
start_backlog = True
ep_results.append(_epResult(RESULT_SUCCESS, epObj))
if len(sql_l) > 0:
if 0 < len(sql_l):
myDB = db.DBConnection()
myDB.mass_action(sql_l)

View file

@ -1582,7 +1582,7 @@ class Home(MainHandler):
if None is not result:
sql_l.append(result)
if len(sql_l) > 0:
if 0 < len(sql_l):
myDB = db.DBConnection()
myDB.mass_action(sql_l)