本文整理汇总了Python中sickbeard.save_config函数的典型用法代码示例。如果您正苦于以下问题:Python save_config函数的具体用法?Python save_config怎么用?Python save_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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()
开发者ID:joshguerette,项目名称:SickGear,代码行数:34,代码来源:config.py
示例2: migrate_config
def migrate_config(self):
"""
Calls each successive migration until the config is the same version as SB expects
"""
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 = ''
helpers.backupVersionedFile(sickbeard.CONFIG_FILE, self.config_version)
# 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()
开发者ID:AbhieSpeaks,项目名称:Sick-Beard,代码行数:27,代码来源:config.py
示例3: index
def index(self, limit=None):
if limit is None:
if sickbeard.HISTORY_LIMIT:
limit = int(sickbeard.HISTORY_LIMIT)
else:
limit = 100
else:
limit = try_int(limit, 100)
sickbeard.HISTORY_LIMIT = limit
sickbeard.save_config()
history = self.history.get(limit)
t = PageTemplate(rh=self, filename='history.mako')
submenu = [
{'title': 'Clear History', 'path': 'history/clearHistory', 'icon': 'ui-icon ui-icon-trash', 'class': 'clearhistory', 'confirm': True},
{'title': 'Trim History', 'path': 'history/trimHistory', 'icon': 'menu-icon-cut', 'class': 'trimhistory', 'confirm': True},
]
return t.render(historyResults=history.detailed, compactResults=history.compact, limit=limit,
submenu=submenu, title='History', header='History',
topmenu='history', controller='history', action='index')
开发者ID:Eiber,项目名称:SickRage-Medusa,代码行数:25,代码来源:history.py
示例4: execute
def execute(self):
use_torrents = False
use_nzbs = False
use_vods = False
for cur_provider in sickbeard.providers.sortedProviderList():
if cur_provider.isEnabled():
if cur_provider.providerType == GenericProvider.NZB:
use_nzbs = True
logger.log(u"Provider " + cur_provider.name + " is enabled, enabling NZBs in the upgrade")
break
elif cur_provider.providerType == GenericProvider.TORRENT:
use_torrents = True
logger.log(u"Provider " + cur_provider.name + " is enabled, enabling Torrents in the upgrade")
break
elif cur_provider.providerType == GenericProvider.VOD:
use_vods = True
logger.log(u"Provider "+cur_provider.name+" is enabled, enabling VideoOnDemand in the upgrade")
break
sickbeard.USE_TORRENTS = use_torrents
sickbeard.USE_NZBS = use_nzbs
sickbeard.USE_VODS = use_vods
sickbeard.save_config()
self.incDBVersion()
开发者ID:AbhieSpeaks,项目名称:Sick-Beard,代码行数:27,代码来源:mainDB.py
示例5: saveAnime
def saveAnime(self, use_anidb=None, anidb_username=None, anidb_password=None, anidb_use_mylist=None,
split_home=None):
"""
Save anime related settings
"""
results = []
sickbeard.USE_ANIDB = config.checkbox_to_value(use_anidb)
sickbeard.ANIDB_USERNAME = anidb_username
sickbeard.ANIDB_PASSWORD = anidb_password
sickbeard.ANIDB_USE_MYLIST = config.checkbox_to_value(anidb_use_mylist)
sickbeard.ANIME_SPLIT_HOME = config.checkbox_to_value(split_home)
sickbeard.save_config()
if results:
for x in results:
logger.log(x, logger.ERROR)
ui.notifications.error('Error(s) Saving Configuration',
'<br>\n'.join(results))
else:
ui.notifications.message('Configuration Saved', ek(os.path.join, sickbeard.CONFIG_FILE))
return self.redirect('/config/anime/')
开发者ID:Eiber,项目名称:SickRage-Medusa,代码行数:25,代码来源:anime.py
示例6: saveIRC
def saveIRC(self, irc_bot=None, irc_server=None, irc_channel=None, irc_key=None, irc_nick=None):
results = []
if irc_bot == "on":
irc_bot = 1
else:
irc_bot = 0
config.change_IRC_BOT(irc_bot)
config.change_IRC_SERVER(irc_server)
config.change_IRC_CHANNEL(irc_channel, irc_key)
config.change_IRC_NICK(irc_nick)
sickbeard.save_config()
if len(results) > 0:
for x in results:
logger.log(x, logger.ERROR)
flash['error'] = 'Error(s) Saving Configuration'
flash['error-detail'] = "<br />\n".join(results)
else:
flash['message'] = 'Configuration Saved'
raise cherrypy.HTTPRedirect("index")
开发者ID:mattsch,项目名称:Sickbeard,代码行数:25,代码来源:webserve.py
示例7: 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()
开发者ID:070499,项目名称:Sick-Beard,代码行数:35,代码来源:config.py
示例8: execute
def execute(self):
backupDatabase(12)
# update the default quality so we dont grab the wrong qualities after migration -- should have really been a config migration
sickbeard.QUALITY_DEFAULT = self._update_composite_qualities(sickbeard.QUALITY_DEFAULT)
sickbeard.save_config()
# upgrade previous HD to HD720p -- shift previous qualities to new placevalues
old_hd = common.Quality.combineQualities([common.Quality.HDTV, common.Quality.HDWEBDL >> 2, common.Quality.HDBLURAY >> 3], [])
new_hd = common.Quality.combineQualities([common.Quality.HDTV, common.Quality.HDWEBDL, common.Quality.HDBLURAY], [])
# update ANY -- shift existing qualities and add new 1080p qualities, note that rawHD was not added to the ANY template
old_any = common.Quality.combineQualities([common.Quality.SDTV, common.Quality.SDDVD, common.Quality.HDTV, common.Quality.HDWEBDL >> 2, common.Quality.HDBLURAY >> 3, common.Quality.UNKNOWN], [])
new_any = common.Quality.combineQualities([common.Quality.SDTV, common.Quality.SDDVD, common.Quality.HDTV, common.Quality.FULLHDTV, common.Quality.HDWEBDL, common.Quality.FULLHDWEBDL, common.Quality.HDBLURAY, common.Quality.FULLHDBLURAY, common.Quality.UNKNOWN], [])
# update qualities (including templates)
logger.log(u"[1/4] Updating pre-defined templates and the quality for each show...", logger.MESSAGE)
ql = []
shows = self.connection.select("SELECT * FROM tv_shows")
for cur_show in shows:
if cur_show["quality"] == old_hd:
new_quality = new_hd
elif cur_show["quality"] == old_any:
new_quality = new_any
else:
new_quality = self._update_composite_qualities(cur_show["quality"])
ql.append(["UPDATE tv_shows SET quality = ? WHERE show_id = ?", [new_quality, cur_show["show_id"]]])
self.connection.mass_action(ql)
# update status that are are within the old hdwebdl (1<<3 which is 8) and better -- exclude unknown (1<<15 which is 32768)
logger.log(u"[2/4] Updating the status for the episodes within each show...", logger.MESSAGE)
ql = []
episodes = self.connection.select("SELECT * FROM tv_episodes WHERE status < 3276800 AND status >= 800")
for cur_episode in episodes:
ql.append(["UPDATE tv_episodes SET status = ? WHERE episode_id = ?", [self._update_status(cur_episode["status"]), cur_episode["episode_id"]]])
self.connection.mass_action(ql)
# make two separate passes through the history since snatched and downloaded (action & quality) may not always coordinate together
# update previous history so it shows the correct action
logger.log(u"[3/4] Updating history to reflect the correct action...", logger.MESSAGE)
ql = []
historyAction = self.connection.select("SELECT * FROM history WHERE action < 3276800 AND action >= 800")
for cur_entry in historyAction:
ql.append(["UPDATE history SET action = ? WHERE showid = ? AND date = ?", [self._update_status(cur_entry["action"]), cur_entry["showid"], cur_entry["date"]]])
self.connection.mass_action(ql)
# update previous history so it shows the correct quality
logger.log(u"[4/4] Updating history to reflect the correct quality...", logger.MESSAGE)
ql = []
historyQuality = self.connection.select("SELECT * FROM history WHERE quality < 32768 AND quality >= 8")
for cur_entry in historyQuality:
ql.append(["UPDATE history SET quality = ? WHERE showid = ? AND date = ?", [self._update_quality(cur_entry["quality"]), cur_entry["showid"], cur_entry["date"]]])
self.connection.mass_action(ql)
self.incDBVersion()
# cleanup and reduce db if any previous data was removed
logger.log(u"Performing a vacuum on the database.", logger.DEBUG)
self.connection.action("VACUUM")
开发者ID:riksmith,项目名称:Sick-Beard,代码行数:60,代码来源:mainDB.py
示例9: trakt_request
def trakt_request(self, path, data=None, headers=None, url=None, method='GET', count=0):
if None is sickbeard.TRAKT_TOKEN:
logger.log(u'You must get a Trakt token. Check your Trakt settings', logger.WARNING)
return {}
headers = headers or self.headers
url = url or self.api_url
count += 1
headers['Authorization'] = 'Bearer ' + sickbeard.TRAKT_TOKEN
try:
resp = self.session.request(method, url + path, headers=headers, timeout=self.timeout,
data=json.dumps(data) if data else [], verify=self.verify)
# check for http errors and raise if any are present
resp.raise_for_status()
# convert response to json
resp = resp.json()
except requests.RequestException as e:
code = getattr(e.response, 'status_code', None)
if not code:
if 'timed out' in e:
logger.log(u'Timeout connecting to Trakt. Try to increase timeout value in Trakt settings', logger.WARNING)
# This is pretty much a fatal error if there is no status_code
# It means there basically was no response at all
else:
logger.log(u'Could not connect to Trakt. Error: {0}'.format(e), logger.WARNING)
elif 502 == code:
# Retry the request, Cloudflare had a proxying issue
logger.log(u'Retrying trakt api request: %s' % path, logger.WARNING)
return self.trakt_request(path, data, headers, url, method, count=count)
elif 401 == code:
if self.trakt_token(refresh=True, count=count):
sickbeard.save_config()
return self.trakt_request(path, data, headers, url, method, count=count)
else:
logger.log(u'Unauthorized. Please check your Trakt settings', logger.WARNING)
raise traktAuthException()
elif code in (500, 501, 503, 504, 520, 521, 522):
# http://docs.trakt.apiary.io/#introduction/status-codes
logger.log(u'Trakt may have some issues and it\'s unavailable. Try again later please', logger.WARNING)
elif 404 == code:
logger.log(u'Trakt error (404) the resource does not exist: %s' % url + path, logger.WARNING)
else:
logger.log(u'Could not connect to Trakt. Code error: {0}'.format(code), logger.ERROR)
return {}
# check and confirm Trakt call did not fail
if isinstance(resp, dict) and 'failure' == resp.get('status', None):
if 'message' in resp:
raise traktException(resp['message'])
if 'error' in resp:
raise traktException(resp['error'])
else:
raise traktException('Unknown Error')
return resp
开发者ID:adam111316,项目名称:SickGear,代码行数:60,代码来源:trakt.py
示例10: execute
def execute(self):
dir_results = self.connection.select("SELECT location FROM tv_shows")
dir_counts = {}
for cur_dir in dir_results:
cur_root_dir = ek.ek(os.path.dirname, ek.ek(os.path.normpath, cur_dir["location"]))
if cur_root_dir not in dir_counts:
dir_counts[cur_root_dir] = 1
else:
dir_counts[cur_root_dir] += 1
logger.log(u"Dir counts: "+str(dir_counts), logger.DEBUG)
if not dir_counts:
self.incDBVersion()
return
default_root_dir = dir_counts.values().index(max(dir_counts.values()))
new_root_dirs = str(default_root_dir)+'|'+'|'.join(dir_counts.keys())
logger.log(u"Setting ROOT_DIRS to: "+new_root_dirs, logger.DEBUG)
sickbeard.ROOT_DIRS = new_root_dirs
sickbeard.save_config()
self.incDBVersion()
开发者ID:kadeo,项目名称:Sick-Beard,代码行数:27,代码来源:mainDB.py
示例11: saveSubtitles
def saveSubtitles(self, use_subtitles=None, subtitles_plugins=None, subtitles_languages=None, subtitles_dir=None, subtitles_perfect_match=None,
service_order=None, subtitles_history=None, subtitles_finder_frequency=None,
subtitles_multi=None, embedded_subtitles_all=None, subtitles_extra_scripts=None, subtitles_pre_scripts=None, subtitles_hearing_impaired=None,
addic7ed_user=None, addic7ed_pass=None, itasa_user=None, itasa_pass=None, legendastv_user=None, legendastv_pass=None, opensubtitles_user=None, opensubtitles_pass=None,
subtitles_download_in_pp=None, subtitles_keep_only_wanted=None):
"""
Save Subtitle Search related settings
"""
results = []
config.change_SUBTITLES_FINDER_FREQUENCY(subtitles_finder_frequency)
config.change_USE_SUBTITLES(use_subtitles)
sickbeard.SUBTITLES_LANGUAGES = [code.strip() for code in subtitles_languages.split(',') if code.strip() in subtitles.subtitle_code_filter()] if subtitles_languages else []
sickbeard.SUBTITLES_DIR = subtitles_dir
sickbeard.SUBTITLES_PERFECT_MATCH = config.checkbox_to_value(subtitles_perfect_match)
sickbeard.SUBTITLES_HISTORY = config.checkbox_to_value(subtitles_history)
sickbeard.EMBEDDED_SUBTITLES_ALL = config.checkbox_to_value(embedded_subtitles_all)
sickbeard.SUBTITLES_HEARING_IMPAIRED = config.checkbox_to_value(subtitles_hearing_impaired)
sickbeard.SUBTITLES_MULTI = 1 if len(sickbeard.SUBTITLES_LANGUAGES) > 1 else config.checkbox_to_value(subtitles_multi)
sickbeard.SUBTITLES_DOWNLOAD_IN_PP = config.checkbox_to_value(subtitles_download_in_pp)
sickbeard.SUBTITLES_KEEP_ONLY_WANTED = config.checkbox_to_value(subtitles_keep_only_wanted)
sickbeard.SUBTITLES_EXTRA_SCRIPTS = [x.strip() for x in subtitles_extra_scripts.split('|') if x.strip()]
sickbeard.SUBTITLES_PRE_SCRIPTS = [x.strip() for x in subtitles_pre_scripts.split('|') if x.strip()]
# Subtitles services
services_str_list = service_order.split()
subtitles_services_list = []
subtitles_services_enabled = []
for curServiceStr in services_str_list:
cur_service, cur_enabled = curServiceStr.split(':')
subtitles_services_list.append(cur_service)
subtitles_services_enabled.append(int(cur_enabled))
sickbeard.SUBTITLES_SERVICES_LIST = subtitles_services_list
sickbeard.SUBTITLES_SERVICES_ENABLED = subtitles_services_enabled
sickbeard.ADDIC7ED_USER = addic7ed_user or ''
sickbeard.ADDIC7ED_PASS = addic7ed_pass or ''
sickbeard.ITASA_USER = itasa_user or ''
sickbeard.ITASA_PASS = itasa_pass or ''
sickbeard.LEGENDASTV_USER = legendastv_user or ''
sickbeard.LEGENDASTV_PASS = legendastv_pass or ''
sickbeard.OPENSUBTITLES_USER = opensubtitles_user or ''
sickbeard.OPENSUBTITLES_PASS = opensubtitles_pass or ''
sickbeard.save_config()
# Reset provider pool so next time we use the newest settings
subtitles.get_provider_pool.invalidate()
if results:
for x in results:
logger.log(x, logger.ERROR)
ui.notifications.error('Error(s) Saving Configuration',
'<br>\n'.join(results))
else:
ui.notifications.message('Configuration Saved', ek(os.path.join, sickbeard.CONFIG_FILE))
return self.redirect('/config/subtitles/')
开发者ID:Eiber,项目名称:SickRage-Medusa,代码行数:59,代码来源:subtitles.py
示例12: delete_account
def delete_account(account):
if account in sickbeard.TRAKT_ACCOUNTS:
try:
TraktAPI().trakt_request('/oauth/revoke', send_oauth=account, method='POST')
except TraktException:
logger.log('Failed to remove account from trakt.tv')
sickbeard.TRAKT_ACCOUNTS.pop(account)
sickbeard.save_config()
return True
return False
开发者ID:JackDandy,项目名称:SickGear,代码行数:10,代码来源:trakt.py
示例13: _check_auth
def _check_auth(self, **kwargs):
try:
secret_key = 'secret_key=' + re.split('secret_key\s*=\s*([0-9a-zA-Z]+)', self.api_key)[1]
except (StandardError, Exception):
raise sickbeard.exceptions.AuthException('Invalid secret key for %s in Media Providers/Options' % self.name)
if secret_key != self.api_key:
self.api_key = secret_key
sickbeard.save_config()
return True
开发者ID:JackDandy,项目名称:SickGear,代码行数:11,代码来源:immortalseed.py
示例14: replace_account
def replace_account(account, token, refresh_token, token_valid_date, refresh):
if account in sickbeard.TRAKT_ACCOUNTS:
sickbeard.TRAKT_ACCOUNTS[account].token = token
sickbeard.TRAKT_ACCOUNTS[account].refresh_token = refresh_token
sickbeard.TRAKT_ACCOUNTS[account].token_valid_date = token_valid_date
if not refresh:
sickbeard.TRAKT_ACCOUNTS[account].reset_name()
sickbeard.TRAKT_ACCOUNTS[account].reset_auth_failure()
sickbeard.save_config()
return True
else:
return False
开发者ID:Apocrathia,项目名称:SickGear,代码行数:12,代码来源:trakt.py
示例15: saveGeneral
def saveGeneral(self, log_dir=None, web_port=None, web_log=None, web_ipv6=None,
launch_browser=None, web_username=None,
web_password=None, version_notify=None):
results = []
if web_ipv6 == "on":
web_ipv6 = 1
else:
web_ipv6 = 0
if web_log == "on":
web_log = 1
else:
web_log = 0
if launch_browser == "on":
launch_browser = 1
else:
launch_browser = 0
if version_notify == "on":
version_notify = 1
else:
version_notify = 0
if not config.change_LOG_DIR(log_dir):
results += ["Unable to create directory " + os.path.normpath(log_dir) + ", log dir not changed."]
sickbeard.LAUNCH_BROWSER = launch_browser
sickbeard.WEB_PORT = int(web_port)
sickbeard.WEB_IPV6 = web_ipv6
sickbeard.WEB_LOG = web_log
sickbeard.WEB_USERNAME = web_username
sickbeard.WEB_PASSWORD = web_password
config.change_VERSION_NOTIFY(version_notify)
sickbeard.save_config()
if len(results) > 0:
for x in results:
logger.log(x, logger.ERROR)
ui.notifications.error('Error(s) Saving Configuration',
'<br />\n'.join(results))
else:
ui.notifications.message('Configuration Saved', ek.ek(os.path.join, sickbeard.CONFIG_FILE) )
redirect("/config/general/")
开发者ID:natem345,项目名称:Sick-Beard,代码行数:50,代码来源:webserve_config.py
示例16: auth_failure
def auth_failure(self):
if self.auth_fail < self.max_auth_fail:
if self.last_fail:
time_diff = datetime.datetime.now() - self.last_fail
if self.auth_fail % 3 == 0:
if time_diff > datetime.timedelta(days=1):
self.inc_auth_failure()
sickbeard.save_config()
elif time_diff > datetime.timedelta(minutes=15):
self.inc_auth_failure()
if self.auth_fail == self.max_auth_fail or time_diff > datetime.timedelta(hours=6):
sickbeard.save_config()
else:
self.inc_auth_failure()
开发者ID:Apocrathia,项目名称:SickGear,代码行数:14,代码来源:trakt.py
示例17: saveNotifications
def saveNotifications(self, xbmc_notify_onsnatch=None, xbmc_notify_ondownload=None,
xbmc_update_library=None, xbmc_host=None, xbmc_username=None, xbmc_password=None, use_growl=None,
growl_host=None, growl_password=None, ):
results = []
if xbmc_notify_onsnatch == "on":
xbmc_notify_onsnatch = 1
else:
xbmc_notify_onsnatch = 0
if xbmc_notify_ondownload == "on":
xbmc_notify_ondownload = 1
else:
xbmc_notify_ondownload = 0
if xbmc_update_library == "on":
xbmc_update_library = 1
else:
xbmc_update_library = 0
if use_growl == "on":
use_growl = 1
else:
use_growl = 0
sickbeard.XBMC_NOTIFY_ONSNATCH = xbmc_notify_onsnatch
sickbeard.XBMC_NOTIFY_ONDOWNLOAD = xbmc_notify_ondownload
sickbeard.XBMC_UPDATE_LIBRARY = xbmc_update_library
sickbeard.XBMC_HOST = xbmc_host
sickbeard.XBMC_USERNAME = xbmc_username
sickbeard.XBMC_PASSWORD = xbmc_password
sickbeard.USE_GROWL = use_growl
sickbeard.GROWL_HOST = growl_host
sickbeard.GROWL_PASSWORD = growl_password
sickbeard.save_config()
if len(results) > 0:
for x in results:
logger.log(x, logger.ERROR)
flash.error('Error(s) Saving Configuration',
'<br />\n'.join(results))
else:
flash.message('Configuration Saved')
redirect("/config/notifications/")
开发者ID:censer,项目名称:Sick-Beard,代码行数:49,代码来源:webserve.py
示例18: execute
def execute(self):
backupDatabase(self.checkDBVersion())
# update the default quality so we dont grab the wrong qualities after migration
sickbeard.QUALITY_DEFAULT = self._update_composite_qualities(sickbeard.QUALITY_DEFAULT)
sickbeard.save_config()
# upgrade previous HD to HD720p -- shift previous qualities to new placevalues
old_hd = common.Quality.combineQualities([common.Quality.HDTV, common.Quality.HDWEBDL >> 2, common.Quality.HDBLURAY >> 3], [])
new_hd = common.Quality.combineQualities([common.Quality.HDTV, common.Quality.HDWEBDL, common.Quality.HDBLURAY], [])
# update ANY -- shift existing qualities and add new 1080p qualities, note that rawHD was not added to the ANY template
old_any = common.Quality.combineQualities([common.Quality.SDTV, common.Quality.SDDVD, common.Quality.HDTV, common.Quality.HDWEBDL >> 2, common.Quality.HDBLURAY >> 3, common.Quality.UNKNOWN], [])
new_any = common.Quality.combineQualities([common.Quality.SDTV, common.Quality.SDDVD, common.Quality.HDTV, common.Quality.FULLHDTV, common.Quality.HDWEBDL, common.Quality.FULLHDWEBDL, common.Quality.HDBLURAY, common.Quality.FULLHDBLURAY, common.Quality.UNKNOWN], [])
# update qualities (including templates)
shows = self.connection.select("SELECT * FROM tv_shows")
for cur_show in shows:
if cur_show["quality"] == old_hd:
new_quality = new_hd
elif cur_show["quality"] == old_any:
new_quality = new_any
else:
new_quality = self._update_composite_qualities(cur_show["quality"])
self.connection.action("UPDATE tv_shows SET quality = ? WHERE tvdb_id = ?", [new_quality, cur_show["tvdb_id"]])
# update status that are are within the old hdwebdl (1<<3 which is 8) and better -- exclude unknown (1<<15 which is 32768)
episodes = self.connection.select("SELECT * FROM tv_episodes WHERE status/100 < 32768 AND status/100 >= 8")
for cur_episode in episodes:
self.connection.action("UPDATE tv_episodes SET status = ? WHERE episode_id = ?", [self._update_status(cur_episode["status"]), cur_episode["episode_id"]])
# make two seperate passes through the history since snatched and downloaded (action & quality) may not always coordinate together
# update previous history so it shows the correct action
historyAction = self.connection.select("SELECT * FROM history WHERE action/100 < 32768 AND action/100 >= 8")
for cur_entry in historyAction:
self.connection.action("UPDATE history SET action = ? WHERE showid = ? AND date = ?", [self._update_status(cur_entry["action"]), cur_entry["showid"], cur_entry["date"]])
# update previous history so it shows the correct quality
historyQuality = self.connection.select("SELECT * FROM history WHERE quality < 32768 AND quality >= 8")
for cur_entry in historyQuality:
self.connection.action("UPDATE history SET quality = ? WHERE showid = ? AND date = ?", [self._update_quality(cur_entry["quality"]), cur_entry["showid"], cur_entry["date"]])
self.incDBVersion()
开发者ID:Andersh75,项目名称:Sick-Beard,代码行数:44,代码来源:mainDB.py
示例19: saveAddShowDefaults
def saveAddShowDefaults(defaultStatus, anyQualities, bestQualities, defaultFlattenFolders, subtitles=False,
anime=False, scene=False, defaultStatusAfter=WANTED):
allowed_qualities = anyQualities.split(',') if anyQualities else []
preferred_qualities = bestQualities.split(',') if bestQualities else []
new_quality = Quality.combineQualities([int(quality) for quality in allowed_qualities], [int(quality) for quality in preferred_qualities])
sickbeard.STATUS_DEFAULT = int(defaultStatus)
sickbeard.STATUS_DEFAULT_AFTER = int(defaultStatusAfter)
sickbeard.QUALITY_DEFAULT = int(new_quality)
sickbeard.FLATTEN_FOLDERS_DEFAULT = config.checkbox_to_value(defaultFlattenFolders)
sickbeard.SUBTITLES_DEFAULT = config.checkbox_to_value(subtitles)
sickbeard.ANIME_DEFAULT = config.checkbox_to_value(anime)
sickbeard.SCENE_DEFAULT = config.checkbox_to_value(scene)
sickbeard.save_config()
开发者ID:Eiber,项目名称:SickRage-Medusa,代码行数:19,代码来源:general.py
示例20: _authorised
def _authorised(self, **kwargs):
result = False
if self.digest:
digest = [x[::-1] for x in self.digest[::-1].rpartition('=')]
self.digest = digest[2] + digest[1] + quote(unquote(digest[0]))
params = dict(
logged_in=(lambda y='': all(
[self.session.cookies.get_dict(domain='.speed.cd') and
self.session.cookies.clear('.speed.cd') is None or True] +
['RSS' in y, 'type="password"' not in y, self.has_all_cookies(['speedian'], 'inSpeed_')] +
[(self.session.cookies.get('inSpeed_' + c) or 'sg!no!pw') in self.digest for c in ['speedian']])),
failed_msg=(lambda y=None: None), post_params={'login': False})
result = super(SpeedCDProvider, self)._authorised(**params)
if not result and not self.failure_count:
if self.digest:
self.get_url('%slogout.php' % self.url_base, skip_auth=True, post_data={'submit.x': 24, 'submit.y': 11})
self.digest = ''
params = dict(
logged_in=(lambda y='': all(
[self.session.cookies.get_dict(domain='.speed.cd') and
self.session.cookies.clear('.speed.cd') is None or True] +
[bool(y), not re.search('(?i)type="password"', y)] +
[re.search('(?i)Logout', y) or not self.digest
or (self.session.cookies.get('inSpeed_speedian') or 'sg!no!pw') in self.digest])),
failed_msg=(lambda y='': (
re.search(r'(?i)(username|password)((<[^>]+>)|\W)*' +
'(or|and|/|\s)((<[^>]+>)|\W)*(password|incorrect)', y) and
u'Invalid username or password for %s. Check settings' or
u'Failed to authenticate or parse a response from %s, abort provider')),
post_params={'form_tmpl': True})
self.urls['login_action'] = self.urls.get('do_login')
session = super(SpeedCDProvider, self)._authorised(session=None, resp_sess=True, **params)
self.urls['login_action'] = None
if session:
self.digest = 'inSpeed_speedian=%s' % session.cookies.get('inSpeed_speedian')
sickbeard.save_config()
result = True
logger.log('Cookie details for %s updated.' % self.name, logger.DEBUG)
elif not self.failure_count:
logger.log('Invalid cookie details for %s and login failed. Check settings' % self.name, logger.ERROR)
return result
开发者ID:JackDandy,项目名称:SickGear,代码行数:42,代码来源:speedcd.py
注:本文中的sickbeard.save_config函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论