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

Small Bugfix

This commit is contained in:
echel0n 2014-03-11 11:33:57 -07:00
parent c97f5b9c70
commit 481fdc1ac6
2 changed files with 35 additions and 31 deletions

View File

@ -59,7 +59,7 @@ class AddNetworkTimezones(AddSceneNameCache):
class ConverSceneExceptionsToIndexerID(AddNetworkTimezones):
def test(self):
return self.hasColumn("scene_exceptions", "indexer_id")
return self.hasColumn("scene_exceptions", "tvdb_id")
def execute(self):
self.connection.action("ALTER TABLE scene_exceptions RENAME TO tmp_scene_exceptions")
@ -69,7 +69,7 @@ class ConverSceneExceptionsToIndexerID(AddNetworkTimezones):
class ConverSceneNamesToIndexerID(ConverSceneExceptionsToIndexerID):
def test(self):
return self.hasColumn("scene_names", "indexer_id")
return self.hasColumn("scene_names", "tvdb_id")
def execute(self):
self.connection.action("ALTER TABLE scene_names RENAME TO tmp_scene_names")

View File

@ -509,14 +509,15 @@ class AddLastConvertTVShowsToIndexerScheme(AddIndicesToTvEpisodes):
def execute(self):
backupDatabase(22)
logger.log(u"Converting TV Shows table to Indexer Scheme...")
self.connection.action("ALTER TABLE tv_shows RENAME TO tmp_tv_shows")
self.connection.action("CREATE TABLE tv_shows (show_id INTEGER PRIMARY KEY, indexer_id NUMERIC, indexer TEXT, show_name TEXT, location TEXT, network TEXT, genre TEXT, classification TEXT, runtime NUMERIC, quality NUMERIC, airs TEXT, status TEXT, flatten_folders NUMERIC, paused NUMERIC, startyear NUMERIC, air_by_date NUMERIC, lang TEXT, subtitles NUMERIC, notify_list TEXT, imdb_id TEXT, last_update_indexer NUMERIC, dvdorder NUMERIC)")
self.connection.action("CREATE UNIQUE INDEX idx_indexer_id ON tv_shows (indexer_id)")
self.connection.action("UPDATE tv_shows SET indexer = 'Tvdb'")
self.connection.action("UPDATE tv_shows SET classification = 'Scripted'")
self.connection.action("INSERT INTO tv_shows(show_id, indexer_id, show_name, location, network, genre, runtime, quality, airs, status, flatten_folders, paused, startyear, air_by_date, lang, subtitles, notify_list, imdb_id, last_update_indexer, dvdorder) SELECT show_id, tvdb_id, show_name, location, network, genre, runtime, quality, airs, status, flatten_folders, paused, startyear, air_by_date, lang, subtitles, notify_list, imdb_id, last_update_tvdb, dvdorder FROM tmp_tv_shows")
self.connection.action("DROP TABLE tmp_tv_shows")
if self.hasColumn("tv_shows", "tvdb_id"):
logger.log(u"Converting TV Shows table to Indexer Scheme...")
self.connection.action("ALTER TABLE tv_shows RENAME TO tmp_tv_shows")
self.connection.action("CREATE TABLE tv_shows (show_id INTEGER PRIMARY KEY, indexer_id NUMERIC, indexer TEXT, show_name TEXT, location TEXT, network TEXT, genre TEXT, classification TEXT, runtime NUMERIC, quality NUMERIC, airs TEXT, status TEXT, flatten_folders NUMERIC, paused NUMERIC, startyear NUMERIC, air_by_date NUMERIC, lang TEXT, subtitles NUMERIC, notify_list TEXT, imdb_id TEXT, last_update_indexer NUMERIC, dvdorder NUMERIC)")
self.connection.action("CREATE UNIQUE INDEX idx_indexer_id ON tv_shows (indexer_id)")
self.connection.action("UPDATE tv_shows SET indexer = 'Tvdb'")
self.connection.action("UPDATE tv_shows SET classification = 'Scripted'")
self.connection.action("INSERT INTO tv_shows(show_id, indexer_id, show_name, location, network, genre, runtime, quality, airs, status, flatten_folders, paused, startyear, air_by_date, lang, subtitles, notify_list, imdb_id, last_update_indexer, dvdorder) SELECT show_id, tvdb_id, show_name, location, network, genre, runtime, quality, airs, status, flatten_folders, paused, startyear, air_by_date, lang, subtitles, notify_list, imdb_id, last_update_tvdb, dvdorder FROM tmp_tv_shows")
self.connection.action("DROP TABLE tmp_tv_shows")
self.incDBVersion()
@ -529,17 +530,18 @@ class AddLastConvertTVEpisodesToIndexerScheme(AddLastConvertTVShowsToIndexerSche
def execute(self):
backupDatabase(23)
logger.log(u"Converting TV Episodes table to Indexer Scheme...")
self.connection.action("ALTER TABLE tv_episodes RENAME TO tmp_tv_episodes")
self.connection.action("CREATE TABLE tv_episodes (episode_id INTEGER PRIMARY KEY, showid NUMERIC, indexerid NUMERIC, indexer TEXT, name TEXT, season NUMERIC, episode NUMERIC, description TEXT, airdate NUMERIC, hasnfo NUMERIC, hastbn NUMERIC, status NUMERIC, location TEXT, file_size NUMERIC, release_name TEXT, subtitles TEXT, subtitles_searchcount NUMERIC, subtitles_lastsearch TIMESTAMP, is_proper NUMERIC)")
self.connection.action("CREATE INDEX idx_showid ON tv_episodes (showid)")
self.connection.action("CREATE INDEX idx_tv_episodes_showid_airdate ON tv_episodes(showid,airdate)")
self.connection.action("CREATE INDEX idx_status ON tv_episodes (status,season,episode,airdate)")
self.connection.action("CREATE INDEX idx_sta_epi_air ON tv_episodes (status,episode, airdate)")
self.connection.action("CREATE INDEX idx_sta_epi_sta_air ON tv_episodes (season,episode, status, airdate)")
self.connection.action("UPDATE tv_episodes SET indexer = 'Tvdb'")
self.connection.action("INSERT INTO tv_episodes(episode_id, showid, indexerid, name, season, episode, description, airdate, hasnfo, hastbn, status, location, file_size, release_name, subtitles, subtitles_searchcount, subtitles_lastsearch, is_proper) SELECT episode_id, showid, tvdbid, name, season, episode, description, airdate, hasnfo, hastbn, status, location, file_size, release_name, subtitles, subtitles_searchcount, subtitles_lastsearch, is_proper FROM tmp_tv_episodes")
self.connection.action("DROP TABLE tmp_tv_episodes")
if self.hasColumn("tv_episodes", "tvdbid"):
logger.log(u"Converting TV Episodes table to Indexer Scheme...")
self.connection.action("ALTER TABLE tv_episodes RENAME TO tmp_tv_episodes")
self.connection.action("CREATE TABLE tv_episodes (episode_id INTEGER PRIMARY KEY, showid NUMERIC, indexerid NUMERIC, indexer TEXT, name TEXT, season NUMERIC, episode NUMERIC, description TEXT, airdate NUMERIC, hasnfo NUMERIC, hastbn NUMERIC, status NUMERIC, location TEXT, file_size NUMERIC, release_name TEXT, subtitles TEXT, subtitles_searchcount NUMERIC, subtitles_lastsearch TIMESTAMP, is_proper NUMERIC)")
self.connection.action("CREATE INDEX idx_showid ON tv_episodes (showid)")
self.connection.action("CREATE INDEX idx_tv_episodes_showid_airdate ON tv_episodes(showid,airdate)")
self.connection.action("CREATE INDEX idx_status ON tv_episodes (status,season,episode,airdate)")
self.connection.action("CREATE INDEX idx_sta_epi_air ON tv_episodes (status,episode, airdate)")
self.connection.action("CREATE INDEX idx_sta_epi_sta_air ON tv_episodes (season,episode, status, airdate)")
self.connection.action("UPDATE tv_episodes SET indexer = 'Tvdb'")
self.connection.action("INSERT INTO tv_episodes(episode_id, showid, indexerid, name, season, episode, description, airdate, hasnfo, hastbn, status, location, file_size, release_name, subtitles, subtitles_searchcount, subtitles_lastsearch, is_proper) SELECT episode_id, showid, tvdbid, name, season, episode, description, airdate, hasnfo, hastbn, status, location, file_size, release_name, subtitles, subtitles_searchcount, subtitles_lastsearch, is_proper FROM tmp_tv_episodes")
self.connection.action("DROP TABLE tmp_tv_episodes")
self.incDBVersion()
@ -552,11 +554,12 @@ class AddLastConvertIMDBInfoToIndexerScheme(AddLastConvertTVEpisodesToIndexerSch
def execute(self):
backupDatabase(24)
logger.log(u"Converting IMDB Info table to Indexer Scheme...")
self.connection.action("ALTER TABLE imdb_info RENAME TO tmp_imdb_info")
self.connection.action("CREATE TABLE imdb_info (indexer_id INTEGER PRIMARY KEY, imdb_id TEXT, title TEXT, year NUMERIC, akas TEXT, runtimes NUMERIC, genres TEXT, countries TEXT, country_codes TEXT, certificates TEXT, rating TEXT, votes INTEGER, last_update NUMERIC)")
self.connection.action("INSERT INTO imdb_info(indexer_id, imdb_id, title, year, akas, runtimes, genres, countries, country_codes, certificates, rating, votes, last_update) SELECT tvdb_id, imdb_id, title, year, akas, runtimes, genres, countries, country_codes, certificates, rating, votes, last_update FROM tmp_imdb_info")
self.connection.action("DROP TABLE tmp_imdb_info")
if self.hasColumn("imdb_info", "tvdb_id"):
logger.log(u"Converting IMDB Info table to Indexer Scheme...")
self.connection.action("ALTER TABLE imdb_info RENAME TO tmp_imdb_info")
self.connection.action("CREATE TABLE imdb_info (indexer_id INTEGER PRIMARY KEY, imdb_id TEXT, title TEXT, year NUMERIC, akas TEXT, runtimes NUMERIC, genres TEXT, countries TEXT, country_codes TEXT, certificates TEXT, rating TEXT, votes INTEGER, last_update NUMERIC)")
self.connection.action("INSERT INTO imdb_info(indexer_id, imdb_id, title, year, akas, runtimes, genres, countries, country_codes, certificates, rating, votes, last_update) SELECT tvdb_id, imdb_id, title, year, akas, runtimes, genres, countries, country_codes, certificates, rating, votes, last_update FROM tmp_imdb_info")
self.connection.action("DROP TABLE tmp_imdb_info")
self.incDBVersion()
@ -569,10 +572,11 @@ class AddLastConvertInfoToIndexerScheme(AddLastConvertIMDBInfoToIndexerScheme):
def execute(self):
backupDatabase(25)
logger.log(u"Converting Info table to Indexer Scheme...")
self.connection.action("ALTER TABLE info RENAME TO tmp_info")
self.connection.action("CREATE TABLE info (last_backlog NUMERIC, last_indexerid NUMERIC, last_proper_search NUMERIC)")
self.connection.action("INSERT INTO info(last_backlog, last_indexerid, last_proper_search) SELECT last_backlog, last_tvdbid, last_proper_search FROM tmp_info")
self.connection.action("DROP TABLE tmp_info")
if self.hasColumn("info", "last_tvdbid"):
logger.log(u"Converting Info table to Indexer Scheme...")
self.connection.action("ALTER TABLE info RENAME TO tmp_info")
self.connection.action("CREATE TABLE info (last_backlog NUMERIC, last_indexerid NUMERIC, last_proper_search NUMERIC)")
self.connection.action("INSERT INTO info(last_backlog, last_indexerid, last_proper_search) SELECT last_backlog, last_tvdbid, last_proper_search FROM tmp_info")
self.connection.action("DROP TABLE tmp_info")
self.incDBVersion()