本文整理汇总了Python中sickbeard.logger.log_error_and_exit函数的典型用法代码示例。如果您正苦于以下问题:Python log_error_and_exit函数的具体用法?Python log_error_and_exit怎么用?Python log_error_and_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_error_and_exit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
def execute(self):
if not self.hasTable("tv_shows") and not self.hasTable("db_version"):
queries = [
"CREATE TABLE db_version (db_version INTEGER);",
"CREATE TABLE history (action NUMERIC, date NUMERIC, showid NUMERIC, season NUMERIC, episode NUMERIC, quality NUMERIC, resource TEXT, provider TEXT, source TEXT);",
"CREATE TABLE info (last_backlog NUMERIC, last_tvdb NUMERIC);",
"CREATE TABLE tv_episodes (episode_id INTEGER PRIMARY KEY, showid NUMERIC, tvdbid 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);",
"CREATE TABLE tv_shows (show_id INTEGER PRIMARY KEY, location TEXT, show_name TEXT, tvdb_id NUMERIC, network TEXT, genre TEXT, runtime NUMERIC, quality NUMERIC, airs TEXT, status TEXT, flatten_folders NUMERIC, paused NUMERIC, startyear NUMERIC, tvr_id NUMERIC, tvr_name TEXT, air_by_date NUMERIC, lang TEXT, last_update_tvdb NUMERIC, rls_require_words TEXT, rls_ignore_words TEXT, skip_notices NUMERIC);",
"CREATE INDEX idx_tv_episodes_showid_airdate ON tv_episodes (showid,airdate);",
"CREATE INDEX idx_showid ON tv_episodes (showid);",
"CREATE UNIQUE INDEX idx_tvdb_id ON tv_shows (tvdb_id);",
"INSERT INTO db_version (db_version) VALUES (18);"
]
for query in queries:
self.connection.action(query)
else:
cur_db_version = self.checkDBVersion()
if cur_db_version < MIN_DB_VERSION:
logger.log_error_and_exit(u"Your database version (" + str(cur_db_version) + ") is too old to migrate from what this version of Sick Beard supports (" + \
str(MIN_DB_VERSION) + ").\n" + \
"Upgrade using a previous version (tag) build 496 to build 501 of Sick Beard first or remove database file to begin fresh."
)
if cur_db_version > MAX_DB_VERSION:
logger.log_error_and_exit(u"Your database version (" + str(cur_db_version) + ") has been incremented past what this version of Sick Beard supports (" + \
str(MAX_DB_VERSION) + ").\n" + \
"If you have used other forks of Sick Beard, your database may be unusable due to their modifications."
)
示例2: daemonize
def daemonize(self):
"""
Fork off as a daemon
"""
# pylint: disable=protected-access
# An object is accessed for a non-existent member.
# Access to a protected member of a client class
# Make a non-session-leader child process
try:
pid = os.fork() # @UndefinedVariable - only available in UNIX
if pid != 0:
os._exit(0)
except OSError as error:
sys.stderr.write('fork #1 failed: {error_num}: {error_message}\n'.format
(error_num=error.errno, error_message=error.strerror))
sys.exit(1)
os.setsid() # @UndefinedVariable - only available in UNIX
# https://github.com/SickRage/SickRage/issues/2969
# http://www.microhowto.info/howto/cause_a_process_to_become_a_daemon_in_c.html#idp23920
# https://www.safaribooksonline.com/library/view/python-cookbook/0596001673/ch06s08.html
# Previous code simply set the umask to whatever it was because it was ANDing instead of OR-ing
# Daemons traditionally run with umask 0 anyways and this should not have repercussions
os.umask(0)
# Make the child a session-leader by detaching from the terminal
try:
pid = os.fork() # @UndefinedVariable - only available in UNIX
if pid != 0:
os._exit(0)
except OSError as error:
sys.stderr.write('fork #2 failed: Error {error_num}: {error_message}\n'.format
(error_num=error.errno, error_message=error.strerror))
sys.exit(1)
# Write pid
if self.create_pid:
pid = os.getpid()
logger.log('Writing PID: {pid} to {filename}'.format(pid=pid, filename=self.pid_file))
try:
with io.open(self.pid_file, 'w') as f_pid:
f_pid.write('{0}\n'.format(pid))
except EnvironmentError as error:
logger.log_error_and_exit('Unable to write PID file: {filename} Error {error_num}: {error_message}'.format
(filename=self.pid_file, error_num=error.errno, error_message=error.strerror))
# Redirect all output
sys.stdout.flush()
sys.stderr.flush()
devnull = getattr(os, 'devnull', '/dev/null')
stdin = file(devnull)
stdout = file(devnull, 'a+')
stderr = file(devnull, 'a+')
os.dup2(stdin.fileno(), getattr(sys.stdin, 'device', sys.stdin).fileno())
os.dup2(stdout.fileno(), getattr(sys.stdout, 'device', sys.stdout).fileno())
os.dup2(stderr.fileno(), getattr(sys.stderr, 'device', sys.stderr).fileno())
示例3: backupDatabase
def backupDatabase(version):
logger.log(u"Backing up database before upgrade")
if not helpers.backupVersionedFile(db.dbFilename(), version):
logger.log_error_and_exit(u"Database backup failed, abort upgrading database")
else:
logger.log(u"Proceeding with upgrade")
示例4: migrate_config
def migrate_config(self):
""" Calls each successive migration until the config is the same version as SG expects """
if self.config_version > self.expected_config_version:
logger.log_error_and_exit(
u'Your config version (%s) has been incremented past what this version of SickGear supports (%s).\n'
'If you have used other forks or a newer version of SickGear, your config file may be unusable due to '
'their modifications.' % (self.config_version, self.expected_config_version))
sickbeard.CONFIG_VERSION = self.config_version
while self.config_version < self.expected_config_version:
next_version = self.config_version + 1
if next_version in self.migration_names:
migration_name = ': %s' % self.migration_names[next_version]
else:
migration_name = ''
logger.log(u'Backing up config before upgrade')
if not helpers.backupVersionedFile(sickbeard.CONFIG_FILE, self.config_version):
logger.log_error_and_exit(u'Config backup failed, abort upgrading config')
else:
logger.log(u'Proceeding with upgrade')
# do the migration, expect a method named _migrate_v<num>
logger.log(u'Migrating config up to version %s %s' % (next_version, migration_name))
getattr(self, '_migrate_v%s' % next_version)()
self.config_version = next_version
# save new config after migration
sickbeard.CONFIG_VERSION = self.config_version
logger.log(u'Saving config file to disk')
sickbeard.save_config()
示例5: restoreDatabase
def restoreDatabase(filename, version):
logger.log(u'Restoring database before trying upgrade again')
if not sickbeard.helpers.restoreVersionedFile(dbFilename(filename=filename, suffix='v%s' % version), version):
logger.log_error_and_exit(u'Database restore failed, abort upgrading database')
return False
else:
return True
示例6: daemonize
def daemonize():
try:
pid = os.fork()
if pid > 0:
sys.exit(0)
except OSError:
print "fork() failed"
sys.exit(1)
os.chdir(sickbeard.PROG_DIR)
os.setsid()
# Make sure I can read my own files and shut out others
prev= os.umask(0)
os.umask(prev and int('077',8))
try:
pid = os.fork()
if pid > 0:
sys.exit(0)
except OSError:
print "fork() failed"
sys.exit(1)
# Write pid
if sickbeard.CREATEPID:
pid = str(os.getpid())
logger.log(u"Writing PID: " + pid + " to " + str(sickbeard.PIDFILE))
try:
file(sickbeard.PIDFILE, 'w').write("%s\n" % pid)
except IOError, e:
logger.log_error_and_exit(
u"Unable to write PID file: " + sickbeard.PIDFILE + " Error: " + str(e.strerror) + " [" + str(
e.errno) + "]")
示例7: _processUpgrade
def _processUpgrade(connection, upgradeClass):
instance = upgradeClass(connection)
logger.log(u'Checking %s database upgrade' % prettyName(upgradeClass.__name__), logger.DEBUG)
if not instance.test():
logger.log(u'Database upgrade required: %s' % prettyName(upgradeClass.__name__), logger.MESSAGE)
try:
instance.execute()
except sqlite3.DatabaseError as e:
# attemping to restore previous DB backup and perform upgrade
try:
instance.execute()
except:
result = connection.select('SELECT db_version FROM db_version')
if result:
version = int(result[0]['db_version'])
# close db before attempting restore
connection.close()
if restoreDatabase(connection.filename, version):
logger.log_error_and_exit(u'Successfully restored database version: %s' % version)
else:
logger.log_error_and_exit(u'Failed to restore database version: %s' % version)
logger.log('%s upgrade completed' % upgradeClass.__name__, logger.DEBUG)
else:
logger.log('%s upgrade not required' % upgradeClass.__name__, logger.DEBUG)
for upgradeSubClass in upgradeClass.__subclasses__():
_processUpgrade(connection, upgradeSubClass)
示例8: daemonize
def daemonize(self):
"""
Fork off as a daemon
"""
# pylint: disable=no-member,protected-access
# An object is accessed for a non-existent member.
# Access to a protected member of a client class
# Make a non-session-leader child process
try:
pid = os.fork() # @UndefinedVariable - only available in UNIX
if pid != 0:
os._exit(0)
except OSError as error_message:
sys.stderr.write("fork #1 failed: %d (%s)\n" % (error_message.errno, error_message.strerror))
sys.exit(1)
os.setsid() # @UndefinedVariable - only available in UNIX
# https://github.com/SickRage/sickrage-issues/issues/2969
# http://www.microhowto.info/howto/cause_a_process_to_become_a_daemon_in_c.html#idp23920
# https://www.safaribooksonline.com/library/view/python-cookbook/0596001673/ch06s08.html
# Previous code simply set the umask to whatever it was because it was ANDing instead of OR-ing
# Daemons traditionally run with umask 0 anyways and this should not have repercussions
os.umask(0)
# Make the child a session-leader by detaching from the terminal
try:
pid = os.fork() # @UndefinedVariable - only available in UNIX
if pid != 0:
os._exit(0)
except OSError as error_message:
sys.stderr.write("fork #2 failed: %d (%s)\n" % (error_message.errno, error_message.strerror))
sys.exit(1)
# Write pid
if self.create_pid:
pid = os.getpid()
logger.log("Writing PID: %s to %s" % (pid, self.pid_file))
try:
with io.open(self.pid_file, "w") as f_pid:
f_pid.write("%s\n" % pid)
except EnvironmentError as error_message:
logger.log_error_and_exit(
"Unable to write PID file: %s Error: %s [%s]"
% (self.pid_file, error_message.strerror, error_message.errno)
)
# Redirect all output
sys.stdout.flush()
sys.stderr.flush()
devnull = getattr(os, "devnull", "/dev/null")
stdin = file(devnull)
stdout = file(devnull, "a+")
stderr = file(devnull, "a+")
os.dup2(stdin.fileno(), getattr(sys.stdin, "device", sys.stdin).fileno())
os.dup2(stdout.fileno(), getattr(sys.stdout, "device", sys.stdout).fileno())
os.dup2(stderr.fileno(), getattr(sys.stderr, "device", sys.stderr).fileno())
示例9: restoreDatabase
def restoreDatabase(version):
logger.log(u"Restoring database before trying upgrade again")
if not sickbeard.helpers.restoreVersionedFile(dbFilename(suffix='v' + str(version)), version):
logger.log_error_and_exit(u"Database restore failed, abort upgrading database")
return False
else:
return True
示例10: migrate_config
def migrate_config(self):
"""
Calls each successive migration until the config is the same version as SB expects
"""
if self.config_version > self.expected_config_version:
logger.log_error_and_exit(u"Your config version (" + str(self.config_version) + ") has been incremented past what this version of Sick Beard supports (" + str(self.expected_config_version) + ").\n" + \
"If you have used other forks or a newer version of Sick Beard, your config file may be unusable due to their modifications.")
sickbeard.CONFIG_VERSION = self.config_version
while self.config_version < self.expected_config_version:
next_version = self.config_version + 1
if next_version in self.migration_names:
migration_name = ': ' + self.migration_names[next_version]
else:
migration_name = ''
logger.log(u"Backing up config before upgrade")
if not helpers.backupVersionedFile(sickbeard.CONFIG_FILE, self.config_version):
logger.log_error_and_exit(u"Config backup failed, abort upgrading config")
else:
logger.log(u"Proceeding with upgrade")
# do the migration, expect a method named _migrate_v<num>
logger.log(u"Migrating config up to version " + str(next_version) + migration_name)
getattr(self, '_migrate_v' + str(next_version))()
self.config_version = next_version
# save new config after migration
sickbeard.CONFIG_VERSION = self.config_version
logger.log(u"Saving config file to disk")
sickbeard.save_config()
示例11: daemonize
def daemonize(self):
"""
Fork off as a daemon
"""
# pylint: disable=no-member,protected-access
# An object is accessed for a non-existent member.
# Access to a protected member of a client class
# Make a non-session-leader child process
try:
pid = os.fork() # @UndefinedVariable - only available in UNIX
if pid != 0:
os._exit(0)
except OSError as e:
sys.stderr.write(u"fork #1 failed: %d (%s)\n" % (e.errno, e.strerror))
sys.exit(1)
os.setsid() # @UndefinedVariable - only available in UNIX
# https://github.com/SickRage/sickrage-issues/issues/2969
# http://www.microhowto.info/howto/cause_a_process_to_become_a_daemon_in_c.html#idp23920
# https://www.safaribooksonline.com/library/view/python-cookbook/0596001673/ch06s08.html
# Previous code simply set the umask to whatever it was because it was ANDing instead of ORring
# Daemons traditionally run with umask 0 anyways and this should not have repercussions
os.umask(0)
# Make the child a session-leader by detaching from the terminal
try:
pid = os.fork() # @UndefinedVariable - only available in UNIX
if pid != 0:
os._exit(0)
except OSError as e:
sys.stderr.write(u"fork #2 failed: %d (%s)\n" % (e.errno, e.strerror))
sys.exit(1)
# Write pid
if self.CREATEPID:
pid = str(os.getpid())
logger.log(u"Writing PID: " + pid + " to " + str(self.PIDFILE))
try:
file(self.PIDFILE, 'w').write("%s\n" % pid)
except IOError as e:
logger.log_error_and_exit(
u"Unable to write PID file: " + self.PIDFILE + " Error: " + str(e.strerror) + " [" + str(
e.errno) + "]")
# Redirect all output
sys.stdout.flush()
sys.stderr.flush()
devnull = getattr(os, 'devnull', '/dev/null')
stdin = file(devnull, 'r')
stdout = file(devnull, 'a+')
stderr = file(devnull, 'a+')
os.dup2(stdin.fileno(), getattr(sys.stdin, 'device', sys.stdin).fileno())
os.dup2(stdout.fileno(), getattr(sys.stdout, 'device', sys.stdout).fileno())
os.dup2(stderr.fileno(), getattr(sys.stderr, 'device', sys.stderr).fileno())
示例12: restoreDatabase
def restoreDatabase(version):
"""
Restores a database to a previous version (backup file of version must still exist)
:param version: Version to restore to
:return: True if restore succeeds, False if it fails
"""
logger.log(u"Restoring database before trying upgrade again")
if not sickbeard.helpers.restoreVersionedFile(dbFilename(suffix='v' + str(version)), version):
logger.log_error_and_exit(u"Database restore failed, abort upgrading database")
return False
else:
return True
示例13: daemonize
def daemonize(self):
"""
Fork off as a daemon
"""
# pylint: disable=E1101
# Make a non-session-leader child process
try:
pid = os.fork() # @UndefinedVariable - only available in UNIX
if pid != 0:
os._exit(0)
except OSError as e:
sys.stderr.write('fork #1 failed: %d (%s)\n' % (e.errno, e.strerror))
sys.exit(1)
os.setsid() # @UndefinedVariable - only available in UNIX
# Make sure I can read my own files and shut out others
prev = os.umask(0)
os.umask(prev and int('077', 8))
# Make the child a session-leader by detaching from the terminal
try:
pid = os.fork() # @UndefinedVariable - only available in UNIX
if pid != 0:
os._exit(0)
except OSError as e:
sys.stderr.write('fork #2 failed: %d (%s)\n' % (e.errno, e.strerror))
sys.exit(1)
# Write pid
if self.CREATEPID:
pid = str(os.getpid())
logger.log(u'Writing PID: %s to %s' % (pid, self.PIDFILE))
try:
open(self.PIDFILE, 'w').write('%s\n' % pid)
except IOError as e:
logger.log_error_and_exit(
u'Unable to write PID file: %s Error: %s [%s]' % (self.PIDFILE, e.strerror, e.errno))
# Redirect all output
sys.stdout.flush()
sys.stderr.flush()
devnull = getattr(os, 'devnull', '/dev/null')
stdin = open(devnull, 'r')
stdout = open(devnull, 'a+')
stderr = open(devnull, 'a+')
os.dup2(stdin.fileno(), sys.stdin.fileno())
os.dup2(stdout.fileno(), sys.stdout.fileno())
os.dup2(stderr.fileno(), sys.stderr.fileno())
示例14: execute
def execute(self):
db.backup_database('sickbeard.db', self.checkDBVersion())
if not self.hasTable('tv_shows') and not self.hasTable('db_version'):
queries = [
# original sick beard tables
'CREATE TABLE db_version (db_version INTEGER);',
'CREATE TABLE history (action NUMERIC, date NUMERIC, showid NUMERIC, season NUMERIC, episode NUMERIC, quality NUMERIC, resource TEXT, provider TEXT, version NUMERIC)',
'CREATE TABLE info (last_backlog NUMERIC, last_indexer NUMERIC, last_proper_search 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, absolute_number NUMERIC, scene_absolute_number NUMERIC, version NUMERIC, release_group TEXT, trakt_watched 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, anime NUMERIC, scene NUMERIC, overview TEXT, tag TEXT)',
'CREATE INDEX idx_showid ON tv_episodes (showid)',
'CREATE INDEX idx_tv_episodes_showid_airdate ON tv_episodes (showid,airdate)',
'CREATE TABLE blacklist (show_id INTEGER, range TEXT, keyword TEXT)',
'CREATE TABLE indexer_mapping (indexer_id INTEGER, indexer NUMERIC, mindexer_id INTEGER, mindexer NUMERIC, PRIMARY KEY (indexer_id, indexer))',
'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 scene_numbering (indexer TEXT, indexer_id INTEGER, season INTEGER, episode INTEGER, scene_season INTEGER, scene_episode INTEGER, absolute_number NUMERIC, scene_absolute_number NUMERIC, PRIMARY KEY (indexer_id, season, episode))',
'CREATE TABLE whitelist (show_id INTEGER, range TEXT, keyword TEXT)',
'CREATE TABLE xem_refresh (indexer TEXT, indexer_id INTEGER PRIMARY KEY, last_refreshed INTEGER)',
'CREATE UNIQUE INDEX idx_indexer_id ON tv_shows (indexer_id)',
'CREATE INDEX idx_sta_epi_air ON tv_episodes (status,episode, airdate)',
'CREATE INDEX idx_sta_epi_sta_air ON tv_episodes (season,episode, status, airdate)',
'CREATE INDEX idx_status ON tv_episodes (status,season,episode,airdate)',
'INSERT INTO db_version (db_version) VALUES (20003)'
]
for query in queries:
self.connection.action(query)
else:
cur_db_version = self.checkDBVersion()
if cur_db_version < MIN_DB_VERSION:
logger.log_error_and_exit(u'Your database version ('
+ str(cur_db_version)
+ ') is too old to migrate from what this version of SickGear supports ('
+ str(MIN_DB_VERSION) + ').' + "\n"
+ 'Upgrade using a previous version (tag) build 496 to build 501 of SickGear first or remove database file to begin fresh.'
)
if cur_db_version > MAX_DB_VERSION:
logger.log_error_and_exit(u'Your database version ('
+ str(cur_db_version)
+ ') has been incremented past what this version of SickGear supports ('
+ str(MAX_DB_VERSION) + ').' + "\n"
+ 'If you have used other forks of SickGear, your database may be unusable due to their modifications.'
)
return self.checkDBVersion()
示例15: execute
def execute(self):
if not self.hasTable("tv_shows") and not self.hasTable("db_version"):
queries = [
"CREATE TABLE db_version (db_version INTEGER);",
"CREATE TABLE history (action NUMERIC, date NUMERIC, showid NUMERIC, season NUMERIC, episode NUMERIC, quality NUMERIC, resource TEXT, provider TEXT)",
"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 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);",
"CREATE INDEX idx_sta_epi_sta_air ON tv_episodes (season,episode, status, airdate);",
"CREATE INDEX idx_status ON tv_episodes (status,season,episode,airdate);",
"CREATE INDEX idx_tv_episodes_showid_airdate ON tv_episodes(showid,airdate)",
"INSERT INTO db_version (db_version) VALUES (31);",
]
for query in queries:
self.connection.action(query)
else:
cur_db_version = self.checkDBVersion()
if cur_db_version < MIN_DB_VERSION:
logger.log_error_and_exit(
u"Your database version ("
+ str(cur_db_version)
+ ") is too old to migrate from what this version of SickRage supports ("
+ str(MIN_DB_VERSION)
+ ").\n"
+ "Upgrade using a previous version (tag) build 496 to build 501 of SickRage first or remove database file to begin fresh."
)
if cur_db_version > MAX_DB_VERSION:
logger.log_error_and_exit(
u"Your database version ("
+ str(cur_db_version)
+ ") has been incremented past what this version of SickRage supports ("
+ str(MAX_DB_VERSION)
+ ").\n"
+ "If you have used other forks of SickRage, your database may be unusable due to their modifications."
)