本文整理汇总了Python中sickbeard.db.dbFilename函数的典型用法代码示例。如果您正苦于以下问题:Python dbFilename函数的具体用法?Python dbFilename怎么用?Python dbFilename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbFilename函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, dbname):
self.db_versions = {}
self.db_name = dbname
self.my_db = db.DBConnection(self.db_name)
self.filename = db.dbFilename(self.db_name)
self.backup_filename = db.dbFilename(self.db_name, 'bak')
self.rollback_version = None
开发者ID:SickGear,项目名称:sickgear.extdata,代码行数:7,代码来源:rollback.py
示例2: 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")
开发者ID:riksmith,项目名称:Sick-Beard,代码行数:7,代码来源:mainDB.py
示例3: execute
def execute(self):
numTries = 0
while not ek.ek(os.path.isfile, db.dbFilename(suffix='v0')):
if not ek.ek(os.path.isfile, db.dbFilename()):
break
try:
logger.log(u"Attempting to back up your sickbeard.db file before migration...")
shutil.copy(db.dbFilename(), db.dbFilename(suffix='v0'))
logger.log(u"Done backup, proceeding with migration.")
break
except Exception, e:
logger.log(u"Error while trying to back up your sickbeard.db: "+ex(e))
numTries += 1
time.sleep(1)
logger.log(u"Trying again.")
if numTries >= 10:
logger.log(u"Unable to back up your sickbeard.db file, please do it manually.")
sys.exit(1)
开发者ID:kadeo,项目名称:Sick-Beard,代码行数:21,代码来源:mainDB.py
示例4: backupDatabase
def backupDatabase(version):
helpers.backupVersionedFile(db.dbFilename(), version)
开发者ID:Araldwenn,项目名称:Sick-Beard,代码行数:2,代码来源:mainDB.py
示例5: execute
def execute(self):
backupDatabase(0)
# old stuff that's been removed from common but we need it to upgrade
HD = 1
SD = 3
ANY = 2
BEST = 4
ACTION_SNATCHED = 1
ACTION_PRESNATCHED = 2
ACTION_DOWNLOADED = 3
PREDOWNLOADED = 3
MISSED = 6
BACKLOG = 7
DISCBACKLOG = 8
SNATCHED_BACKLOG = 10
### Update default quality
if sickbeard.QUALITY_DEFAULT == HD:
sickbeard.QUALITY_DEFAULT = common.HD
elif sickbeard.QUALITY_DEFAULT == SD:
sickbeard.QUALITY_DEFAULT = common.SD
elif sickbeard.QUALITY_DEFAULT == ANY:
sickbeard.QUALITY_DEFAULT = common.ANY
elif sickbeard.QUALITY_DEFAULT == BEST:
sickbeard.QUALITY_DEFAULT = common.BEST
### Update episode statuses
toUpdate = self.connection.select("SELECT episode_id, location, status FROM tv_episodes WHERE status IN (?, ?, ?, ?, ?, ?, ?)", [common.DOWNLOADED, common.SNATCHED, PREDOWNLOADED, MISSED, BACKLOG, DISCBACKLOG, SNATCHED_BACKLOG])
didUpdate = False
for curUpdate in toUpdate:
# remember that we changed something
didUpdate = True
newStatus = None
oldStatus = int(curUpdate["status"])
if oldStatus == common.SNATCHED:
newStatus = common.Quality.compositeStatus(common.SNATCHED, common.Quality.UNKNOWN)
elif oldStatus == PREDOWNLOADED:
newStatus = common.Quality.compositeStatus(common.DOWNLOADED, common.Quality.SDTV)
elif oldStatus in (MISSED, BACKLOG, DISCBACKLOG):
newStatus = common.WANTED
elif oldStatus == SNATCHED_BACKLOG:
newStatus = common.Quality.compositeStatus(common.SNATCHED, common.Quality.UNKNOWN)
if newStatus != None:
self.connection.action("UPDATE tv_episodes SET status = ? WHERE episode_id = ? ", [newStatus, curUpdate["episode_id"]])
continue
# if we get here status should be == DOWNLOADED
if not curUpdate["location"]:
continue
newQuality = common.Quality.nameQuality(curUpdate["location"])
if newQuality == common.Quality.UNKNOWN:
newQuality = common.Quality.assumeQuality(curUpdate["location"])
self.connection.action("UPDATE tv_episodes SET status = ? WHERE episode_id = ?", [common.Quality.compositeStatus(common.DOWNLOADED, newQuality), curUpdate["episode_id"]])
# if no updates were done then the backup is useless
if didUpdate:
os.remove(db.dbFilename(suffix='v0'))
### Update show qualities
toUpdate = self.connection.select("SELECT * FROM tv_shows")
for curUpdate in toUpdate:
if not curUpdate["quality"]:
continue
if int(curUpdate["quality"]) == HD:
newQuality = common.HD
elif int(curUpdate["quality"]) == SD:
newQuality = common.SD
elif int(curUpdate["quality"]) == ANY:
newQuality = common.ANY
elif int(curUpdate["quality"]) == BEST:
newQuality = common.BEST
else:
logger.log(u"Unknown show quality: " + str(curUpdate["quality"]), logger.WARNING)
newQuality = None
if newQuality:
self.connection.action("UPDATE tv_shows SET quality = ? WHERE show_id = ?", [newQuality, curUpdate["show_id"]])
### Update history
toUpdate = self.connection.select("SELECT * FROM history")
for curUpdate in toUpdate:
newAction = None
newStatus = None
if int(curUpdate["action"] == ACTION_SNATCHED):
newStatus = common.SNATCHED
elif int(curUpdate["action"] == ACTION_DOWNLOADED):
newStatus = common.DOWNLOADED
elif int(curUpdate["action"] == ACTION_PRESNATCHED):
#.........这里部分代码省略.........
开发者ID:Araldwenn,项目名称:Sick-Beard,代码行数:101,代码来源:mainDB.py
注:本文中的sickbeard.db.dbFilename函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论