1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-17 14:55:07 -05:00

Fixed a bug in the SQL statement for a transactional

This commit is contained in:
echel0n 2014-03-20 06:45:43 -07:00
parent 972833a7f6
commit 3665a1f69b

View File

@ -1235,14 +1235,14 @@ class TVEpisode(object):
logger.log(str(self.show.indexerid) + u": There was an error loading the NFO for episode " + str(season) + "x" + str(episode), logger.ERROR) logger.log(str(self.show.indexerid) + u": There was an error loading the NFO for episode " + str(season) + "x" + str(episode), logger.ERROR)
pass pass
# if we tried loading it from NFO and didn't find the NFO, use TVDB # if we tried loading it from NFO and didn't find the NFO, try the Indexers
if self.hasnfo == False: if self.hasnfo == False:
try: try:
result = self.loadFromIndexer(season, episode) result = self.loadFromIndexer(season, episode)
except exceptions.EpisodeDeletedException: except exceptions.EpisodeDeletedException:
result = False result = False
# if we failed SQL *and* NFO, TVDB then fail # if we failed SQL *and* NFO, Indexers then fail
if result == False: if result == False:
raise exceptions.EpisodeNotFoundException("Couldn't find episode " + str(season) + "x" + str(episode)) raise exceptions.EpisodeNotFoundException("Couldn't find episode " + str(season) + "x" + str(episode))
@ -1339,7 +1339,7 @@ class TVEpisode(object):
return False return False
except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound): except (indexer_exceptions.indexer_episodenotfound, indexer_exceptions.indexer_seasonnotfound):
logger.log(u"Unable to find the episode on " + self.indexer + "... has it been removed? Should I delete from db?", logger.DEBUG) logger.log(u"Unable to find the episode on " + self.indexer + "... has it been removed? Should I delete from db?", logger.DEBUG)
# if I'm no longer on TVDB but I once was then delete myself from the DB # if I'm no longer on the Indexers but I once was then delete myself from the DB
if self.indexerid != -1: if self.indexerid != -1:
self.deleteEpisode() self.deleteEpisode()
return return
@ -1564,7 +1564,7 @@ class TVEpisode(object):
# use a custom update/insert method to get the data into the DB # use a custom update/insert method to get the data into the DB
return ["INSERT OR REPLACE INTO tv_episodes (episode_id, indexerid, indexer, name, description, subtitles, subtitles_searchcount, subtitles_lastsearch, airdate, hasnfo, hastbn, status, location, file_size, release_name, is_proper, showid, season, episode) VALUES ((SELECT episode_id FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ?),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);", return ["INSERT OR REPLACE INTO tv_episodes (episode_id, indexerid, indexer, name, description, subtitles, subtitles_searchcount, subtitles_lastsearch, airdate, hasnfo, hastbn, status, location, file_size, release_name, is_proper, showid, season, episode) VALUES ((SELECT episode_id FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ?),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);",
[self.show.tvdbid, self.season, self.episode, self.indexerid, self.indexer, self.name, self.description, ",".join([sub for sub in self.subtitles]), self.subtitles_searchcount, self.subtitles_lastsearch, self.airdate.toordinal(), self.hasnfo, self.hastbn, self.status, self.location, self.file_size, self.release_name, self.is_proper, self.show.indexerid, self.season, self.episode]] [self.show.indexerid, self.season, self.episode, self.indexerid, self.indexer, self.name, self.description, ",".join([sub for sub in self.subtitles]), self.subtitles_searchcount, self.subtitles_lastsearch, self.airdate.toordinal(), self.hasnfo, self.hastbn, self.status, self.location, self.file_size, self.release_name, self.is_proper, self.show.indexerid, self.season, self.episode]]
def saveToDB(self, forceSave=False): def saveToDB(self, forceSave=False):
""" """