Add daily search to recent search renaming to config migration code

This commit is contained in:
adam 2014-12-25 09:57:51 +08:00
parent c16903bd73
commit c500a14d06
3 changed files with 30 additions and 29 deletions

View file

@ -19,6 +19,7 @@
* Add BTN api call parameter debug logging
* Fix anime searches on BTN provider
* Change replace "Daily-Search" with "Recent-Search"
* Add daily search to recent search renaming to config migration code
[develop changelog]

View file

@ -58,7 +58,7 @@ CFG = None
CONFIG_FILE = None
# This is the version of the config we EXPECT to find
CONFIG_VERSION = 5
CONFIG_VERSION = 6
# Default encryption version (0 for None)
ENCRYPTION_VERSION = 0
@ -674,10 +674,7 @@ def initialize(consoleLogging=True):
ALLOW_HIGH_PRIORITY = bool(check_setting_int(CFG, 'General', 'allow_high_priority', 1))
RECENTSEARCH_STARTUP = check_setting_int(CFG, 'General', 'dailysearch_startup', 'deprecated')
if 'deprecated' == RECENTSEARCH_STARTUP:
RECENTSEARCH_STARTUP = check_setting_int(CFG, 'General', 'recentsearch_startup', 1)
RECENTSEARCH_STARTUP = bool(RECENTSEARCH_STARTUP)
RECENTSEARCH_STARTUP = bool(check_setting_int(CFG, 'General', 'recentsearch_startup', 1))
BACKLOG_STARTUP = bool(check_setting_int(CFG, 'General', 'backlog_startup', 1))
SKIP_REMOVED_FILES = bool(check_setting_int(CFG, 'General', 'skip_removed_files', 0))
@ -688,11 +685,8 @@ def initialize(consoleLogging=True):
if AUTOPOSTPROCESSER_FREQUENCY < MIN_AUTOPOSTPROCESSER_FREQUENCY:
AUTOPOSTPROCESSER_FREQUENCY = MIN_AUTOPOSTPROCESSER_FREQUENCY
RECENTSEARCH_FREQUENCY = check_setting_int(CFG, 'General', 'dailysearch_frequency',
'deprecated')
if 'deprecated' == RECENTSEARCH_FREQUENCY:
RECENTSEARCH_FREQUENCY = check_setting_int(CFG, 'General', 'recentsearch_frequency',
DEFAULT_RECENTSEARCH_FREQUENCY)
RECENTSEARCH_FREQUENCY = check_setting_int(CFG, 'General', 'recentsearch_frequency',
DEFAULT_RECENTSEARCH_FREQUENCY)
if RECENTSEARCH_FREQUENCY < MIN_RECENTSEARCH_FREQUENCY:
RECENTSEARCH_FREQUENCY = MIN_RECENTSEARCH_FREQUENCY
@ -1029,15 +1023,9 @@ def initialize(consoleLogging=True):
0))
if hasattr(curTorrentProvider, 'enable_recentsearch'):
curTorrentProvider.enable_recentsearch = check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_enable_dailysearch',
'deprecated')
if 'deprecated' == curTorrentProvider.enable_recentsearch:
curTorrentProvider.enable_recentsearch = check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_enable_recentsearch',
1)
curTorrentProvider.enable_recentsearch = bool(curTorrentProvider.enable_recentsearch)
curTorrentProvider.enable_recentsearch = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() +
'_enable_recentsearch', 1))
if hasattr(curTorrentProvider, 'enable_backlog'):
curTorrentProvider.enable_backlog = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_enable_backlog',
@ -1062,15 +1050,9 @@ def initialize(consoleLogging=True):
curNzbProvider.getID() + '_search_fallback',
0))
if hasattr(curNzbProvider, 'enable_recentsearch'):
curNzbProvider.enable_recentsearch = check_setting_int(CFG, curNzbProvider.getID().upper(),
curNzbProvider.getID() + '_enable_dailysearch',
'deprecated')
if 'deprecated' == curNzbProvider.enable_recentsearch:
curNzbProvider.enable_recentsearch = check_setting_int(CFG, curNzbProvider.getID().upper(),
curNzbProvider.getID() + '_enable_recentsearch',
1)
curNzbProvider.enable_recentsearch = bool(curNzbProvider.enable_recentsearch)
curNzbProvider.enable_recentsearch = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
curNzbProvider.getID() + '_enable_recentsearch',
1))
if hasattr(curNzbProvider, 'enable_backlog'):
curNzbProvider.enable_backlog = bool(check_setting_int(CFG, curNzbProvider.getID().upper(),
curNzbProvider.getID() + '_enable_backlog',

View file

@ -27,6 +27,8 @@ from sickbeard import helpers
from sickbeard import logger
from sickbeard import naming
from sickbeard import db
from sickbeard import providers
from sickbeard.providers.generic import GenericProvider
naming_ep_type = ("%(seasonnumber)dx%(episodenumber)02d",
"s%(seasonnumber)02de%(episodenumber)02d",
@ -445,7 +447,8 @@ class ConfigMigrator():
2: 'Sync backup number with version number',
3: 'Rename omgwtfnzb variables',
4: 'Add newznab catIDs',
5: 'Metadata update'
5: 'Metadata update',
6: 'Rename daily search to recent search'
}
def migrate_config(self):
@ -712,3 +715,18 @@ class ConfigMigrator():
sickbeard.METADATA_WDTV = _migrate_metadata(metadata_wdtv, 'WDTV', use_banner)
sickbeard.METADATA_TIVO = _migrate_metadata(metadata_tivo, 'TIVO', use_banner)
sickbeard.METADATA_MEDE8ER = _migrate_metadata(metadata_mede8er, 'Mede8er', use_banner)
# Migration v6: Rename daily search to recent search
def _migrate_v6(self):
sickbeard.RECENTSEARCH_FREQUENCY = check_setting_int(self.config_obj, 'General', 'dailysearch_frequency',
sickbeard.DEFAULT_RECENTSEARCH_FREQUENCY)
sickbeard.RECENTSEARCH_STARTUP = bool(check_setting_int(self.config_obj, 'General', 'dailysearch_startup', 1))
if sickbeard.RECENTSEARCH_FREQUENCY < sickbeard.MIN_RECENTSEARCH_FREQUENCY:
sickbeard.RECENTSEARCH_FREQUENCY = sickbeard.MIN_RECENTSEARCH_FREQUENCY
for curProvider in providers.sortedProviderList():
if hasattr(curProvider, 'enable_recentsearch'):
curProvider.enable_recentsearch = bool(check_setting_int(self.config_obj, curProvider.getID().upper(),
curProvider.getID() + '_enable_dailysearch', 1))