1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Added code to convert Indexers from string format to new integer format

This commit is contained in:
echel0n 2014-03-24 23:42:39 -07:00
parent a65e68837c
commit e8fd2d20b3
2 changed files with 26 additions and 0 deletions

View File

@ -103,3 +103,11 @@ class ConvertSceneNamesToIndexerID(ConvertSceneExceptionsToIndexerID):
self.connection.action("INSERT INTO scene_names(indexer_id, name) SELECT tvdb_id, name FROM tmp_scene_names")
self.connection.action("DROP TABLE tmp_scene_names")
class ConvertIndexerToInteger(ConvertSceneNamesToIndexerID):
def execute(self):
ql = []
ql.append(["UPDATE xem_numbering SET indexer = ? WHERE LOWER(indexer) = ?", ["1", "tvdb"]])
ql.append(["UPDATE xem_numbering SET indexer = ? WHERE LOWER(indexer) = ?", ["2", "tvrage"]])
ql.append(["UPDATE xem_refresh SET indexer = ? WHERE LOWER(indexer) = ?", ["1", "tvdb"]])
ql.append(["UPDATE xem_refresh SET indexer = ? WHERE LOWER(indexer) = ?", ["2", "tvrage"]])
self.connection.mass_action(ql)

View File

@ -643,4 +643,22 @@ class AddSceneNumbering(AddArchiveFirstMatchOption):
self.connection.action(
"CREATE TABLE scene_numbering (indexer TEXT, indexer_id INTEGER, season INTEGER, episode INTEGER, scene_season INTEGER, scene_episode INTEGER, PRIMARY KEY (indexer_id, season, episode))")
self.incDBVersion()
class ConvertIndexerToInteger(AddSceneNumbering):
def test(self):
return self.checkDBVersion() >= 28
def execute(self):
backupDatabase(28)
ql = []
logger.log(u"Converting Indexer to Integer ...", logger.MESSAGE)
ql.append(["UPDATE tv_shows SET indexer = ? WHERE LOWER(indexer) = ?", ["1", "tvdb"]])
ql.append(["UPDATE tv_shows SET indexer = ? WHERE LOWER(indexer) = ?", ["2", "tvrage"]])
ql.append(["UPDATE tv_episodes SET indexer = ? WHERE LOWER(indexer) = ?", ["1", "tvdb"]])
ql.append(["UPDATE tv_episodes SET indexer = ? WHERE LOWER(indexer) = ?", ["2", "tvrage"]])
self.connection.mass_action(ql)
self.incDBVersion()