diff --git a/CHANGES.md b/CHANGES.md index 6fd5b307..e1537f51 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -43,8 +43,9 @@ * Change to not display IMDb info on UI when "Enable IMDb info" is disabled * Change genre tags on displayShow page to link to IMDb instead of Trakt * Change to reduce the time taken to "Update shows" with show data -* Change to stop updating the IMDb info on edit, mass edit and during the scheduled daily update for every show +* Change to stop updating the IMDb info on edit, and during the scheduled daily update for every show * Change to update the IMDb info for a show after snatching an episode for it +* Add IMDb lookup to "Update" action on Manage/Mass Update page * Fix updating of scene exception name cache after adding exceptions on Editshow page * Change log rotation to occur at midnight * Change to keep a maximum of 7 log files @@ -89,6 +90,7 @@ * Add show overview from indexers to the database * Fix case where start year or runtime is not available to display show * Add "File logging level" to General Config/Advanced Settings +* Fix saving of Sort By/Next Episode in Layout Poster on Show List page [develop changelog] * Fix traceback error when using the menu item Manage/Update Kodi @@ -111,6 +113,11 @@ * Change display genres sourced from indexers in labels underneath the show title on displayShow, remove the tag image * Change IMDb genre links to have the tag image applied to the link making it an easier target to click and also visually different from indexer genres * Fix scene anime html id construction in line with plot_info +* Fix display indexer provided start year on the displayShow page when no IMDb data exists +* Fix display indexer provided genres on the displayShow page when no IMDb data exists +* Fix display IMDb indexer with correct IMDb id on the displayShow page only when IMDb data exists +* Fix correctly display show runtime when available on the displayShow page +* Fix correctly initialise IMDb id loaded from db ### 0.7.2 (2015-03-10 17:05:00 UTC) diff --git a/gui/slick/interfaces/default/displayShow.tmpl b/gui/slick/interfaces/default/displayShow.tmpl index 4c9983e8..dfaa8257 100644 --- a/gui/slick/interfaces/default/displayShow.tmpl +++ b/gui/slick/interfaces/default/displayShow.tmpl @@ -169,19 +169,23 @@ $displayshowlist.append('\t\t\t' % $curShowType)

$show.name

-#if not $sickbeard.USE_IMDB_INFO or not $show.imdbid - #if $show.genre - #for $genre in $show.genre[1:-1].split('|') - $genre - #end for - #end if -#end if +#set $genres_done = False #if $sickbeard.USE_IMDB_INFO and 'genres' in $show.imdb_info and '' != $show.imdb_info['genres'] #for $imdbgenre in $show.imdb_info['genres'].split('|') + #set $genres_done = True $imdbgenre.replace('Sci-Fi','Science-Fiction') #end for #end if -
+#if not $genres_done and $show.genre + #for $genre in $show.genre[1:-1].split('|') + #set $genres_done = True + $genre + #end for# +#end if +#if not $genres_done + No genres +#end if +
@@ -201,29 +205,35 @@ $displayshowlist.append('\t\t\t' % $curShowType) -#set $startyear, $runtime = (None, None) -#if not $sickbeard.USE_IMDB_INFO - #if not $show.imdbid - #set $runtime = $show.runtime - #set $startyear = $show.startyear - #end if -#elif $sickbeard.USE_IMDB_INFO +#set $startyear, $flags, $runtime = (None, False, None) +#if $sickbeard.USE_IMDB_INFO and $show.imdbid #if 'year' in $show.imdb_info - #set $runtime = $show.imdb_info['runtimes'] #set $startyear = $show.imdb_info['year'] #end if + #set $flags = 'country_codes' in $show.imdb_info and '' != $show.imdb_info['country_codes'] + #if 'runtimes' in $show.imdb_info + #set $runtime = $show.imdb_info['runtimes'] + #end if #end if +#if None is $startyear and $show.startyear + #set $startyear = $show.startyear +#end if +#if None is $runtime and $show.runtime + #set $runtime = $show.runtime +#end if +#if None is not $startyear or $flags
Premiered - #if None is not $startyear#$startyear#end if# -#if $sickbeard.USE_IMDB_INFO and 'country_codes' in $show.imdb_info and '' != $show.imdb_info['country_codes'] - #for $country in $show.imdb_info['country_codes'].split('|') + #echo ($startyear, 'Unknown')[None is $startyear]# + #if $flags + #for $country in $show.imdb_info['country_codes'].split('|') - #end for -#end if + #end for + #end if
+#end if #if $show.airs #set $showairs = '%s%s' % ($show.airs.replace('y', 'y,'), @@ -301,7 +311,7 @@ $displayshowlist.append('\t\t\t' % $curShowType)
- Info language, $show.lang + $showLoc[0] $sickbeard.helpers.human(sickbeard.helpers.get_size($showLoc[0])) #set $filecount = sum([$c for $k, $c in $epCounts['videos'].items()]) diff --git a/sickbeard/databases/mainDB.py b/sickbeard/databases/mainDB.py index fe4ea879..9be4f28a 100644 --- a/sickbeard/databases/mainDB.py +++ b/sickbeard/databases/mainDB.py @@ -170,8 +170,8 @@ class InitialSchema(db.SchemaUpgrade): '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)', 'CREATE TABLE info (last_backlog NUMERIC, last_indexer NUMERIC, last_proper_search NUMERIC)', '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))', - '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, archive_firstmatch NUMERIC, rls_require_words TEXT, rls_ignore_words TEXT, sports NUMERIC);', - '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, scene_season NUMERIC, scene_episode NUMERIC);', + 'CREATE TABLE tv_shows (show_id INTEGER PRIMARY KEY, indexer_id NUMERIC, indexer NUMERIC, 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, archive_firstmatch NUMERIC, rls_require_words TEXT, rls_ignore_words TEXT, sports NUMERIC);', + 'CREATE TABLE tv_episodes (episode_id INTEGER PRIMARY KEY, showid NUMERIC, indexerid NUMERIC, indexer NUMERIC, 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, scene_season NUMERIC, scene_episode NUMERIC);', 'CREATE UNIQUE INDEX idx_indexer_id ON tv_shows (indexer_id)', 'CREATE INDEX idx_showid ON tv_episodes (showid);', 'CREATE INDEX idx_sta_epi_air ON tv_episodes (status,episode, airdate);', @@ -502,11 +502,12 @@ class AddLastUpdateTVDB(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - logger.log(u'Adding column last_update_tvdb to tvshows') if not self.hasColumn('tv_shows', 'last_update_tvdb'): + logger.log(u'Adding column last_update_tvdb to tv_shows') self.addColumn('tv_shows', 'last_update_tvdb', default=1) self.incDBVersion() + return self.checkDBVersion() # 14 -> 15 @@ -514,6 +515,7 @@ class AddDBIncreaseTo15(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) + logger.log(u'Bumping database version to v%s' % self.checkDBVersion()) self.incDBVersion() return self.checkDBVersion() @@ -523,10 +525,12 @@ class AddIMDbInfo(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) + logger.log(u'Creating IMDb table imdb_info') self.connection.action( 'CREATE TABLE imdb_info (tvdb_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)') if not self.hasColumn('tv_shows', 'imdb_id'): + logger.log(u'Adding IMDb column imdb_id to tv_shows') self.addColumn('tv_shows', 'imdb_id') self.incDBVersion() @@ -538,7 +542,16 @@ class AddProperNamingSupport(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - self.addColumn('tv_episodes', 'is_proper') + if not self.hasColumn('tv_shows', 'imdb_id')\ + and self.hasColumn('tv_shows', 'rls_require_words')\ + and self.hasColumn('tv_shows', 'rls_ignore_words'): + self.setDBVersion(5816) + return self.checkDBVersion() + + if not self.hasColumn('tv_episodes', 'is_proper'): + logger.log(u'Adding column is_proper to tv_episodes') + self.addColumn('tv_episodes', 'is_proper') + self.incDBVersion() return self.checkDBVersion() @@ -548,7 +561,17 @@ class AddEmailSubscriptionTable(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - self.addColumn('tv_shows', 'notify_list', 'TEXT', None) + if not self.hasColumn('tv_episodes', 'is_proper')\ + and self.hasColumn('tv_shows', 'rls_require_words')\ + and self.hasColumn('tv_shows', 'rls_ignore_words')\ + and self.hasColumn('tv_shows', 'skip_notices'): + self.setDBVersion(5817) + return self.checkDBVersion() + + if not self.hasColumn('tv_shows', 'notify_list'): + logger.log(u'Adding column notify_list to tv_shows') + self.addColumn('tv_shows', 'notify_list', 'TEXT', None) + self.incDBVersion() return self.checkDBVersion() @@ -558,8 +581,16 @@ class AddProperSearch(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - logger.log(u'Adding column last_proper_search to info') + if not self.hasColumn('tv_shows', 'notify_list')\ + and self.hasColumn('tv_shows', 'rls_require_words')\ + and self.hasColumn('tv_shows', 'rls_ignore_words')\ + and self.hasColumn('tv_shows', 'skip_notices')\ + and self.hasColumn('history', 'source'): + self.setDBVersion(5818) + return self.checkDBVersion() + if not self.hasColumn('info', 'last_proper_search'): + logger.log(u'Adding column last_proper_search to info') self.addColumn('info', 'last_proper_search', default=1) self.incDBVersion() @@ -571,8 +602,8 @@ class AddDvdOrderOption(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - logger.log(u'Adding column dvdorder to tvshows') if not self.hasColumn('tv_shows', 'dvdorder'): + logger.log(u'Adding column dvdorder to tv_shows') self.addColumn('tv_shows', 'dvdorder', 'NUMERIC', '0') self.incDBVersion() @@ -585,10 +616,12 @@ class AddSubtitlesSupport(db.SchemaUpgrade): backup_database(self.checkDBVersion()) if not self.hasColumn('tv_shows', 'subtitles'): + logger.log(u'Adding subtitles to tv_shows and tv_episodes') self.addColumn('tv_shows', 'subtitles') self.addColumn('tv_episodes', 'subtitles', 'TEXT', '') self.addColumn('tv_episodes', 'subtitles_searchcount') self.addColumn('tv_episodes', 'subtitles_lastsearch', 'TIMESTAMP', str(datetime.datetime.min)) + self.incDBVersion() return self.checkDBVersion() @@ -699,8 +732,8 @@ class AddArchiveFirstMatchOption(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - logger.log(u'Adding column archive_firstmatch to tvshows') if not self.hasColumn('tv_shows', 'archive_firstmatch'): + logger.log(u'Adding column archive_firstmatch to tv_shows') self.addColumn('tv_shows', 'archive_firstmatch', 'NUMERIC', '0') self.incDBVersion() @@ -716,8 +749,9 @@ class AddSceneNumbering(db.SchemaUpgrade): if self.hasTable('scene_numbering'): self.connection.action('DROP TABLE scene_numbering') + logger.log(u'Upgrading table scene_numbering ...', logger.MESSAGE) 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, scene_season, scene_episode))') + '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() return self.checkDBVersion() @@ -748,14 +782,18 @@ class AddRequireAndIgnoreWords(db.SchemaUpgrade): # Adding column rls_require_words and rls_ignore_words to tv_shows def execute(self): + if self.hasColumn('tv_shows', 'rls_require_words') and self.hasColumn('tv_shows', 'rls_ignore_words'): + self.incDBVersion() + return self.checkDBVersion() + backup_database(self.checkDBVersion()) - logger.log(u'Adding column rls_require_words to tvshows') if not self.hasColumn('tv_shows', 'rls_require_words'): + logger.log(u'Adding column rls_require_words to tv_shows') self.addColumn('tv_shows', 'rls_require_words', 'TEXT', '') - logger.log(u'Adding column rls_ignore_words to tvshows') if not self.hasColumn('tv_shows', 'rls_ignore_words'): + logger.log(u'Adding column rls_ignore_words to tv_shows') self.addColumn('tv_shows', 'rls_ignore_words', 'TEXT', '') self.incDBVersion() @@ -767,8 +805,8 @@ class AddSportsOption(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - logger.log(u'Adding column sports to tvshows') if not self.hasColumn('tv_shows', 'sports'): + logger.log(u'Adding column sports to tv_shows') self.addColumn('tv_shows', 'sports', 'NUMERIC', '0') if self.hasColumn('tv_shows', 'air_by_date') and self.hasColumn('tv_shows', 'sports'): @@ -792,12 +830,12 @@ class AddSceneNumberingToTvEpisodes(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - logger.log(u'Adding column scene_season and scene_episode to tvepisodes') + logger.log(u'Adding columns scene_season and scene_episode to tvepisodes') self.addColumn('tv_episodes', 'scene_season', 'NUMERIC', 'NULL') self.addColumn('tv_episodes', 'scene_episode', 'NUMERIC', 'NULL') self.incDBVersion() - return self.incDBVersion() + return self.checkDBVersion() # 31 -> 32 @@ -829,7 +867,7 @@ class AddSceneAbsoluteNumbering(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - logger.log(u'Adding column absolute_number and scene_absolute_number to scene_numbering') + logger.log(u'Adding columns absolute_number and scene_absolute_number to scene_numbering') self.addColumn('scene_numbering', 'absolute_number', 'NUMERIC', '0') self.addColumn('scene_numbering', 'scene_absolute_number', 'NUMERIC', '0') @@ -845,6 +883,7 @@ class AddAnimeBlacklistWhitelist(db.SchemaUpgrade): cl = [] cl.append(['CREATE TABLE blacklist (show_id INTEGER, range TEXT, keyword TEXT)']) cl.append(['CREATE TABLE whitelist (show_id INTEGER, range TEXT, keyword TEXT)']) + logger.log(u'Creating table blacklist whitelist') self.connection.mass_action(cl) self.incDBVersion() @@ -909,9 +948,11 @@ class AddVersionToTvEpisodes(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - logger.log(u'Adding column version to tv_episodes and history') - self.addColumn('tv_episodes', 'version', 'NUMERIC', '-1') + logger.log(u'Adding columns release_group and version to tv_episodes') self.addColumn('tv_episodes', 'release_group', 'TEXT', '') + self.addColumn('tv_episodes', 'version', 'NUMERIC', '-1') + + logger.log(u'Adding column version to history') self.addColumn('history', 'version', 'NUMERIC', '-1') self.incDBVersion() @@ -922,6 +963,7 @@ class AddVersionToTvEpisodes(db.SchemaUpgrade): class BumpDatabaseVersion(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) + logger.log(u'Bumping database version') self.setDBVersion(10000) @@ -939,36 +981,27 @@ class Migrate41(db.SchemaUpgrade): return self.checkDBVersion() +# 5816 - 5818 -> 15 +class MigrateUpstream(db.SchemaUpgrade): + def execute(self): + backup_database(self.checkDBVersion()) + + logger.log(u'Migrate SickBeard DB v%s into v15' % str(self.checkDBVersion()).replace('58', '')) + + self.setDBVersion(15) + return self.checkDBVersion() + + # 10000 -> 20000 class SickGearDatabaseVersion(db.SchemaUpgrade): def execute(self): backup_database(self.checkDBVersion()) - logger.log('Bumping database version to new SickGear standards') + logger.log(u'Bumping database version to new SickGear standards') self.setDBVersion(20000) return self.checkDBVersion() -# 20000 -> 20001 -class DBIncreaseTo20001(db.SchemaUpgrade): - def execute(self): - backup_database(self.checkDBVersion()) - - logger.log('Bumping database version to force a backup before new database code') - - self.setDBVersion(20001) - return self.checkDBVersion() - - -class AddTvShowOverview(db.SchemaUpgrade): - def execute(self): - backup_database(self.checkDBVersion()) - - logger.log(u'Adding column overview to tv_shows') - self.addColumn('tv_shows', 'overview', 'TEXT', '') - - self.setDBVersion(20002) - return self.checkDBVersion() # 10001 -> 10000 class RemoveDefaultEpStatusFromTvShows(db.SchemaUpgrade): @@ -980,3 +1013,30 @@ class RemoveDefaultEpStatusFromTvShows(db.SchemaUpgrade): self.setDBVersion(10000) return self.checkDBVersion() + + +# 20000 -> 20001 +class DBIncreaseTo20001(db.SchemaUpgrade): + def execute(self): + backup_database(self.checkDBVersion()) + + logger.log(u'Bumping database version to force a backup before new database code') + + self.connection.action('VACUUM') + logger.log(u'Performed a vacuum on the database', logger.DEBUG) + + self.setDBVersion(20001) + return self.checkDBVersion() + + +# 20001 -> 20002 +class AddTvShowOverview(db.SchemaUpgrade): + def execute(self): + backup_database(self.checkDBVersion()) + + logger.log(u'Adding column overview to tv_shows') + self.addColumn('tv_shows', 'overview', 'TEXT', '') + + self.setDBVersion(20002) + return self.checkDBVersion() + diff --git a/sickbeard/db.py b/sickbeard/db.py index 0ef25659..c34ca221 100644 --- a/sickbeard/db.py +++ b/sickbeard/db.py @@ -407,6 +407,11 @@ def MigrationCode(myDB): 40: sickbeard.mainDB.BumpDatabaseVersion, 41: sickbeard.mainDB.Migrate41, + 42: sickbeard.mainDB.Migrate41, + + 5816: sickbeard.mainDB.MigrateUpstream, + 5817: sickbeard.mainDB.MigrateUpstream, + 5818: sickbeard.mainDB.MigrateUpstream, 10000: sickbeard.mainDB.SickGearDatabaseVersion, 10001: sickbeard.mainDB.RemoveDefaultEpStatusFromTvShows, diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 362eac75..5f338682 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -829,7 +829,8 @@ class TVShow(object): self.rls_require_words = sqlResults[0]['rls_require_words'] if not self.imdbid: - self.imdbid = sqlResults[0]['imdb_id'] + imdbid = sqlResults[0]['imdb_id'] + self.imdbid = ('', imdbid)[2 < len(imdbid)] if self.is_anime: self.release_groups = BlackAndWhiteList(self.indexerid) @@ -1197,7 +1198,7 @@ class TVShow(object): myDB = db.DBConnection() myDB.upsert("tv_shows", newValueDict, controlValueDict) - if sickbeard.USE_IMDB_INFO and self.imdbid: + if sickbeard.USE_IMDB_INFO and len(self.imdb_info): controlValueDict = {'indexer_id': self.indexerid} newValueDict = self.imdb_info diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 8083d6b2..be916001 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -357,7 +357,7 @@ class MainHandler(WebHandler): def setPosterSortBy(self, sort): - if sort not in ('name', 'time', 'network', 'progress'): + if sort not in ('name', 'date', 'network', 'progress'): sort = 'name' sickbeard.POSTER_SORTBY = sort @@ -3066,7 +3066,7 @@ class Manage(MainHandler): if curShowID in toUpdate: try: - sickbeard.showQueueScheduler.action.updateShow(showObj, True) # @UndefinedVariable + sickbeard.showQueueScheduler.action.updateShow(showObj, True, True) # @UndefinedVariable updates.append(showObj.name) except exceptions.CantUpdateException, e: errors.append('Unable to update show ' + showObj.name + ': ' + ex(e))