• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python db.upgradeDatabase函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sickbeard.db.upgradeDatabase函数的典型用法代码示例。如果您正苦于以下问题:Python upgradeDatabase函数的具体用法?Python upgradeDatabase怎么用?Python upgradeDatabase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了upgradeDatabase函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setUp_test_db

def setUp_test_db():
    """upgrades the db to the latest version
    """
    # upgrading the db
    db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)
    # fix up any db problems
    db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)

    #and for cache.b too
    db.upgradeDatabase(db.DBConnection("cache.db"), cache_db.InitialSchema)
开发者ID:mrsplendid,项目名称:Sickbeard-MrOrange,代码行数:10,代码来源:test_lib.py


示例2: rollback_20004

    def rollback_20004(self):
        if self.my_db.hasTable('indexer_mapping'):
            self.my_db.mass_action([
                ['ALTER TABLE'
                 + ' indexer_mapping RENAME TO tmp_indexer_mapping'],
                ['CREATE TABLE'
                 + ' indexer_mapping (indexer_id INTEGER, indexer NUMERIC, mindexer_id INTEGER,'
                 + ' mindexer NUMERIC, PRIMARY KEY (indexer_id, indexer))'],
                ['DELETE FROM'
                 + ' tmp_indexer_mapping WHERE mindexer NOT IN (1,2)'],
                ['INSERT OR REPLACE INTO'
                 + ' indexer_mapping SELECT indexer_id, indexer, mindexer_id, mindexer FROM tmp_indexer_mapping'],
                ['DROP TABLE'
                 + ' tmp_indexer_mapping']
            ])

        if self.my_db.hasColumn('info', 'last_run_backlog'):
            self.my_db.mass_action([
                ['ALTER TABLE'
                 + ' info RENAME TO tmp_info'],
                ['CREATE TABLE'
                 + ' info (last_backlog NUMERIC, last_indexer NUMERIC, last_proper_search NUMERIC)'],
                ['INSERT OR REPLACE INTO'
                 + ' info SELECT last_backlog, last_indexer, last_proper_search FROM tmp_info'],
                ['DROP TABLE'
                 + ' tmp_info']
            ])

        my_cache_db = db.DBConnection('cache.db')
        if 0 == my_cache_db.checkDBVersion():
            from sickbeard.databases import cache_db
            db.upgradeDatabase(my_cache_db, cache_db.InitialSchema)

        if self.my_db.hasTable('scene_exceptions'):
            sql_results = self.my_db.action('SELECT *' + ' FROM scene_exceptions')
            cs = []
            for r in sql_results:
                cs.append(
                    ['INSERT OR REPLACE INTO'
                     + ' scene_exceptions (exception_id, indexer_id, show_name, season, custom)'
                     + ' VALUES (?,?,?,?,?)', [
                        r['exception_id'], r['indexer_id'], r['show_name'], r['season'], r['custom']]])

            if 0 < len(cs):
                my_cache_db.mass_action(cs)

            self.remove_table('scene_exceptions')

        self.remove_table('scene_exceptions_refresh')

        self.set_db_version(20003)
开发者ID:SickGear,项目名称:sickgear.extdata,代码行数:51,代码来源:rollback.py


示例3: setUp_test_db

def setUp_test_db():
    """upgrades the db to the latest version
    """
    # upgrading the db
    db.MigrationCode(db.DBConnection())

    # fix up any db problems
    db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)

    # and for cachedb too
    db.upgradeDatabase(db.DBConnection('cache.db'), cache_db.InitialSchema)

    # and for faileddb too
    db.upgradeDatabase(db.DBConnection('failed.db'), failed_db.InitialSchema)
开发者ID:Apocrathia,项目名称:SickGear,代码行数:14,代码来源:test_lib.py


示例4: setup_test_db

def setup_test_db():
    """
    Set up the test databases.
    """
    # Upgrade the db to the latest version.
    # upgrading the db
    db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)

    # fix up any db problems
    db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)

    # and for cache.db too
    db.upgradeDatabase(db.DBConnection('cache.db'), cache_db.InitialSchema)

    # and for failed.db too
    db.upgradeDatabase(db.DBConnection('failed.db'), failed_db.InitialSchema)
开发者ID:NickMolloy,项目名称:SickRage,代码行数:16,代码来源:test_lib.py


示例5: initialize


#.........这里部分代码省略.........

                new_metadata_class = old_metadata_class(METADATA_SHOW,
                                                        METADATA_EPISODE,
                                                        ART_POSTER,
                                                        ART_FANART,
                                                        ART_THUMBNAILS,
                                                        ART_SEASON_THUMBNAILS)
                
                metadata_provider_dict[new_metadata_class.name] = new_metadata_class

        # this is the normal codepath for metadata config
        else:
            METADATA_XBMC = check_setting_str(CFG, 'General', 'metadata_xbmc', '0|0|0|0|0|0')
            METADATA_MEDIABROWSER = check_setting_str(CFG, 'General', 'metadata_mediabrowser', '0|0|0|0|0|0')
            METADATA_PS3 = check_setting_str(CFG, 'General', 'metadata_ps3', '0|0|0|0|0|0')
            METADATA_WDTV = check_setting_str(CFG, 'General', 'metadata_wdtv', '0|0|0|0|0|0')
            METADATA_TIVO = check_setting_str(CFG, 'General', 'metadata_tivo', '0|0|0|0|0|0')
            
            for cur_metadata_tuple in [(METADATA_XBMC, metadata.xbmc),
                                       (METADATA_MEDIABROWSER, metadata.mediabrowser),
                                       (METADATA_PS3, metadata.ps3),
                                       (METADATA_WDTV, metadata.wdtv),
                                       (METADATA_TIVO, metadata.tivo),
                                       ]:

                (cur_metadata_config, cur_metadata_class) = cur_metadata_tuple
                tmp_provider = cur_metadata_class.metadata_class()
                tmp_provider.set_config(cur_metadata_config)
                metadata_provider_dict[tmp_provider.name] = tmp_provider

        COMING_EPS_LAYOUT = check_setting_str(CFG, 'GUI', 'coming_eps_layout', 'banner')
        COMING_EPS_DISPLAY_PAUSED = bool(check_setting_int(CFG, 'GUI', 'coming_eps_display_paused', 0))
        COMING_EPS_SORT = check_setting_str(CFG, 'GUI', 'coming_eps_sort', 'date')

        newznabData = check_setting_str(CFG, 'Newznab', 'newznab_data', '')
        newznabProviderList = providers.getNewznabProviderList(newznabData)

        providerList = providers.makeProviderList()
        
        logger.sb_log_instance.initLogging(consoleLogging=consoleLogging)

        # initialize the main SB database
        db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)
        
        # initialize the cache database
        db.upgradeDatabase(db.DBConnection("cache.db"), cache_db.InitialSchema)
        
        # fix up any db problems
        db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)

        currentSearchScheduler = scheduler.Scheduler(searchCurrent.CurrentSearcher(),
                                                     cycleTime=datetime.timedelta(minutes=SEARCH_FREQUENCY),
                                                     threadName="SEARCH",
                                                     runImmediately=True)

        # the interval for this is stored inside the ShowUpdater class
        showUpdaterInstance = showUpdater.ShowUpdater()
        showUpdateScheduler = scheduler.Scheduler(showUpdaterInstance,
                                               cycleTime=showUpdaterInstance.updateInterval,
                                               threadName="SHOWUPDATER",
                                               runImmediately=False)

        versionCheckScheduler = scheduler.Scheduler(versionChecker.CheckVersion(),
                                                     cycleTime=datetime.timedelta(hours=12),
                                                     threadName="CHECKVERSION",
                                                     runImmediately=True)

        showQueueScheduler = scheduler.Scheduler(show_queue.ShowQueue(),
                                               cycleTime=datetime.timedelta(seconds=3),
                                               threadName="SHOWQUEUE",
                                               silent=True)

        searchQueueScheduler = scheduler.Scheduler(search_queue.SearchQueue(),
                                               cycleTime=datetime.timedelta(seconds=3),
                                               threadName="SEARCHQUEUE",
                                               silent=True)

        properFinderInstance = properFinder.ProperFinder()
        properFinderScheduler = scheduler.Scheduler(properFinderInstance,
                                                     cycleTime=properFinderInstance.updateInterval,
                                                     threadName="FINDPROPERS",
                                                     runImmediately=False)

        autoPostProcesserScheduler = scheduler.Scheduler(autoPostProcesser.PostProcesser(),
                                                     cycleTime=datetime.timedelta(minutes=10),
                                                     threadName="POSTPROCESSER",
                                                     runImmediately=True)

        backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(searchBacklog.BacklogSearcher(),
                                                                      cycleTime=datetime.timedelta(minutes=get_backlog_cycle_time()),
                                                                      threadName="BACKLOG",
                                                                      runImmediately=True)
        backlogSearchScheduler.action.cycleTime = BACKLOG_SEARCH_FREQUENCY


        showList = []
        loadingShowList = {}

        __INITIALIZED__ = True
        return True
开发者ID:wezman,项目名称:Sick-Beard,代码行数:101,代码来源:__init__.py


示例6: initialize


#.........这里部分代码省略.........
        CheckSection(CFG, 'Synology')
        USE_SYNOINDEX = bool(check_setting_int(CFG, 'Synology', 'use_synoindex', 0))

        CheckSection(CFG, 'Trakt')
        USE_TRAKT = bool(check_setting_int(CFG, 'Trakt', 'use_trakt', 0))
        TRAKT_USERNAME = check_setting_str(CFG, 'Trakt', 'trakt_username', '')
        TRAKT_PASSWORD = check_setting_str(CFG, 'Trakt', 'trakt_password', '')
        TRAKT_API = check_setting_str(CFG, 'Trakt', 'trakt_api', '')

        CheckSection(CFG, 'pyTivo')
        USE_PYTIVO = bool(check_setting_int(CFG, 'pyTivo', 'use_pytivo', 0))
        PYTIVO_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'pyTivo', 'pytivo_notify_onsnatch', 0))
        PYTIVO_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'pyTivo', 'pytivo_notify_ondownload', 0))
        PYTIVO_UPDATE_LIBRARY = bool(check_setting_int(CFG, 'pyTivo', 'pyTivo_update_library', 0))
        PYTIVO_HOST = check_setting_str(CFG, 'pyTivo', 'pytivo_host', '')
        PYTIVO_SHARE_NAME = check_setting_str(CFG, 'pyTivo', 'pytivo_share_name', '')
        PYTIVO_TIVO_NAME = check_setting_str(CFG, 'pyTivo', 'pytivo_tivo_name', '')

        CheckSection(CFG, 'NMA')
        USE_NMA = bool(check_setting_int(CFG, 'NMA', 'use_nma', 0))
        NMA_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'NMA', 'nma_notify_onsnatch', 0))
        NMA_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'NMA', 'nma_notify_ondownload', 0))
        NMA_API = check_setting_str(CFG, 'NMA', 'nma_api', '')
        NMA_PRIORITY = check_setting_str(CFG, 'NMA', 'nma_priority', "0")

        if not os.path.isfile(CONFIG_FILE):
            logger.log(u"Unable to find '" + CONFIG_FILE + "', all settings will be default!", logger.DEBUG)
            save_config()

        # start up all the threads
        logger.sb_log_instance.initLogging(consoleLogging=consoleLogging)

        # initialize the main SB database
        db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)

        # initialize the cache database
        db.upgradeDatabase(db.DBConnection("cache.db"), cache_db.InitialSchema)

        # fix up any db problems
        db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)

        # migrate the config if it needs it
        migrator = ConfigMigrator(CFG)
        migrator.migrate_config()

        # initialize metadata_providers
        metadata_provider_dict = metadata.get_metadata_generator_dict()
        for cur_metadata_tuple in [(METADATA_XBMC, metadata.xbmc),
                                   (METADATA_XBMC_12PLUS, metadata.xbmc_12plus),
                                   (METADATA_MEDIABROWSER, metadata.mediabrowser),
                                   (METADATA_PS3, metadata.ps3),
                                   (METADATA_WDTV, metadata.wdtv),
                                   (METADATA_TIVO, metadata.tivo),
                                   (METADATA_MEDE8ER, metadata.mede8er)
                                   ]:

            (cur_metadata_config, cur_metadata_class) = cur_metadata_tuple
            tmp_provider = cur_metadata_class.metadata_class()
            tmp_provider.set_config(cur_metadata_config)
            metadata_provider_dict[tmp_provider.name] = tmp_provider

        # initialize newznab providers
        newznabProviderList = providers.getNewznabProviderList(NEWZNAB_DATA)
        providerList = providers.makeProviderList()

        # initialize schedulars
开发者ID:Larusso,项目名称:Sick-Beard,代码行数:67,代码来源:__init__.py


示例7: initialize


#.........这里部分代码省略.........
        KEEP_PROCESSED_DIR = check_setting_int(CFG, 'General', 'keep_processed_dir', 1)
        
        TVBINZ = bool(check_setting_int(CFG, 'TVBinz', 'tvbinz', 0))
        TVBINZ_UID = check_setting_str(CFG, 'TVBinz', 'tvbinz_uid', '')
        TVBINZ_SABUID = check_setting_str(CFG, 'TVBinz', 'tvbinz_sabuid', '')
        TVBINZ_HASH = check_setting_str(CFG, 'TVBinz', 'tvbinz_hash', '')
        TVBINZ_AUTH = check_setting_str(CFG, 'TVBinz', 'tvbinz_auth', '')
        
        NZBS = bool(check_setting_int(CFG, 'NZBs', 'nzbs', 0))
        NZBS_UID = check_setting_str(CFG, 'NZBs', 'nzbs_uid', '')
        NZBS_HASH = check_setting_str(CFG, 'NZBs', 'nzbs_hash', '')
        
        NZBSRUS = bool(check_setting_int(CFG, 'NZBsRUS', 'nzbsrus', 0))
        NZBSRUS_UID = check_setting_str(CFG, 'NZBsRUS', 'nzbsrus_uid', '')
        NZBSRUS_HASH = check_setting_str(CFG, 'NZBsRUS', 'nzbsrus_hash', '')
        
        NZBMATRIX = bool(check_setting_int(CFG, 'NZBMatrix', 'nzbmatrix', 0))
        NZBMATRIX_USERNAME = check_setting_str(CFG, 'NZBMatrix', 'nzbmatrix_username', '')
        NZBMATRIX_APIKEY = check_setting_str(CFG, 'NZBMatrix', 'nzbmatrix_apikey', '')
        
        BINREQ = bool(check_setting_int(CFG, 'Bin-Req', 'binreq', 1))

        SAB_USERNAME = check_setting_str(CFG, 'SABnzbd', 'sab_username', '')
        SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '')
        SAB_APIKEY = check_setting_str(CFG, 'SABnzbd', 'sab_apikey', '')
        SAB_CATEGORY = check_setting_str(CFG, 'SABnzbd', 'sab_category', 'tv')
        SAB_HOST = check_setting_str(CFG, 'SABnzbd', 'sab_host', '')

        XBMC_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'XBMC', 'xbmc_notify_onsnatch', 0))
        XBMC_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'XBMC', 'xbmc_notify_ondownload', 0))
        XBMC_UPDATE_LIBRARY = bool(check_setting_int(CFG, 'XBMC', 'xbmc_update_library', 0))
        XBMC_UPDATE_FULL = bool(check_setting_int(CFG, 'XBMC', 'xbmc_update_full', 0))
        XBMC_HOST = check_setting_str(CFG, 'XBMC', 'xbmc_host', '')
        XBMC_USERNAME = check_setting_str(CFG, 'XBMC', 'xbmc_username', '')
        XBMC_PASSWORD = check_setting_str(CFG, 'XBMC', 'xbmc_password', '')

        USE_GROWL = bool(check_setting_int(CFG, 'Growl', 'use_growl', 0))
        GROWL_HOST = check_setting_str(CFG, 'Growl', 'growl_host', '')
        GROWL_PASSWORD = check_setting_str(CFG, 'Growl', 'growl_password', '')

        EXTRA_SCRIPTS = [x for x in check_setting_str(CFG, 'General', 'extra_scripts', '').split('|') if x]

        newznabData = check_setting_str(CFG, 'Newznab', 'newznab_data', '')
        newznabProviderList = providers.getNewznabProviderList(newznabData)
        
        providerList = providers.makeProviderList()
        
        logger.initLogging(consoleLogging=consoleLogging)

        # initialize the main SB database
        db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)

        currentSearchScheduler = scheduler.Scheduler(searchCurrent.CurrentSearcher(),
                                                     cycleTime=datetime.timedelta(minutes=SEARCH_FREQUENCY),
                                                     threadName="SEARCH",
                                                     runImmediately=True)
        
        backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(searchBacklog.BacklogSearcher(),
                                                                      cycleTime=datetime.timedelta(hours=1),
                                                                      threadName="BACKLOG",
                                                                      runImmediately=False)
        backlogSearchScheduler.action.cycleTime = BACKLOG_SEARCH_FREQUENCY
        
        # the interval for this is stored inside the ShowUpdater class
        showUpdaterInstance = showUpdater.ShowUpdater()
        showUpdateScheduler = scheduler.Scheduler(showUpdaterInstance,
                                               cycleTime=showUpdaterInstance.updateInterval,
                                               threadName="SHOWUPDATER",
                                               runImmediately=False)

        versionCheckScheduler = scheduler.Scheduler(versionChecker.CheckVersion(),
                                                     cycleTime=datetime.timedelta(hours=12),
                                                     threadName="CHECKVERSION",
                                                     runImmediately=True)
        
        showQueueScheduler = scheduler.Scheduler(queue.ShowQueue(),
                                               cycleTime=datetime.timedelta(seconds=3),
                                               threadName="SHOWQUEUE",
                                               silent=True)

        properFinderInstance = properFinder.ProperFinder()
        properFinderScheduler = scheduler.Scheduler(properFinderInstance,
                                                     cycleTime=properFinderInstance.updateInterval,
                                                     threadName="FINDPROPERS",
                                                     runImmediately=False)
        
        autoPostProcesserScheduler = scheduler.Scheduler(autoPostProcesser.PostProcesser(),
                                                     cycleTime=datetime.timedelta(minutes=10),
                                                     threadName="POSTPROCESSER",
                                                     runImmediately=True)
        
        
        showList = []
        loadingShowList = {}
        
        airingList = []
        comingList = []

        __INITIALIZED__ = True
        return True
开发者ID:Orbi,项目名称:Sick-Beard,代码行数:101,代码来源:__init__.py


示例8: initialize


#.........这里部分代码省略.........
        # this is the normal codepath for metadata config
        else:
            METADATA_XBMC = check_setting_str(CFG, "General", "metadata_xbmc", "0|0|0|0|0|0")
            METADATA_MEDIABROWSER = check_setting_str(CFG, "General", "metadata_mediabrowser", "0|0|0|0|0|0")
            METADATA_PS3 = check_setting_str(CFG, "General", "metadata_ps3", "0|0|0|0|0|0")
            METADATA_WDTV = check_setting_str(CFG, "General", "metadata_wdtv", "0|0|0|0|0|0")
            METADATA_TIVO = check_setting_str(CFG, "General", "metadata_tivo", "0|0|0|0|0|0")

            for cur_metadata_tuple in [
                (METADATA_XBMC, metadata.xbmc),
                (METADATA_MEDIABROWSER, metadata.mediabrowser),
                (METADATA_PS3, metadata.ps3),
                (METADATA_WDTV, metadata.wdtv),
                (METADATA_TIVO, metadata.tivo),
            ]:

                (cur_metadata_config, cur_metadata_class) = cur_metadata_tuple
                tmp_provider = cur_metadata_class.metadata_class()
                tmp_provider.set_config(cur_metadata_config)
                metadata_provider_dict[tmp_provider.name] = tmp_provider

        COMING_EPS_LAYOUT = check_setting_str(CFG, "GUI", "coming_eps_layout", "banner")
        COMING_EPS_DISPLAY_PAUSED = bool(check_setting_int(CFG, "GUI", "coming_eps_display_paused", 0))
        COMING_EPS_SORT = check_setting_str(CFG, "GUI", "coming_eps_sort", "date")

        newznabData = check_setting_str(CFG, "Newznab", "newznab_data", "")
        newznabProviderList = providers.getNewznabProviderList(newznabData)

        providerList = providers.makeProviderList()

        logger.sb_log_instance.initLogging(consoleLogging=consoleLogging)

        # initialize the main SB database
        db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)

        # initialize the cache database
        db.upgradeDatabase(db.DBConnection("cache.db"), cache_db.InitialSchema)

        # fix up any db problems
        db.sanityCheckDatabase(db.DBConnection(), mainDB.MainSanityCheck)

        currentSearchScheduler = scheduler.Scheduler(
            searchCurrent.CurrentSearcher(),
            cycleTime=datetime.timedelta(minutes=SEARCH_FREQUENCY),
            threadName="SEARCH",
            runImmediately=True,
        )

        # the interval for this is stored inside the ShowUpdater class
        showUpdaterInstance = showUpdater.ShowUpdater()
        showUpdateScheduler = scheduler.Scheduler(
            showUpdaterInstance,
            cycleTime=showUpdaterInstance.updateInterval,
            threadName="SHOWUPDATER",
            runImmediately=False,
        )

        versionCheckScheduler = scheduler.Scheduler(
            versionChecker.CheckVersion(),
            cycleTime=datetime.timedelta(hours=12),
            threadName="CHECKVERSION",
            runImmediately=True,
        )

        showQueueScheduler = scheduler.Scheduler(
            show_queue.ShowQueue(), cycleTime=datetime.timedelta(seconds=3), threadName="SHOWQUEUE", silent=True
开发者ID:gordonturner,项目名称:Sick-Beard,代码行数:67,代码来源:__init__.py


示例9: initialize


#.........这里部分代码省略.........
        TVBINZ_UID = check_setting_str(CFG, "TVBinz", "tvbinz_uid", "")
        TVBINZ_SABUID = check_setting_str(CFG, "TVBinz", "tvbinz_sabuid", "")
        TVBINZ_HASH = check_setting_str(CFG, "TVBinz", "tvbinz_hash", "")
        TVBINZ_AUTH = check_setting_str(CFG, "TVBinz", "tvbinz_auth", "")

        NZBS = bool(check_setting_int(CFG, "NZBs", "nzbs", 0))
        NZBS_UID = check_setting_str(CFG, "NZBs", "nzbs_uid", "")
        NZBS_HASH = check_setting_str(CFG, "NZBs", "nzbs_hash", "")

        NZBSRUS = bool(check_setting_int(CFG, "NZBsRUS", "nzbsrus", 0))
        NZBSRUS_UID = check_setting_str(CFG, "NZBsRUS", "nzbsrus_uid", "")
        NZBSRUS_HASH = check_setting_str(CFG, "NZBsRUS", "nzbsrus_hash", "")

        NZBMATRIX = bool(check_setting_int(CFG, "NZBMatrix", "nzbmatrix", 0))
        NZBMATRIX_USERNAME = check_setting_str(CFG, "NZBMatrix", "nzbmatrix_username", "")
        NZBMATRIX_APIKEY = check_setting_str(CFG, "NZBMatrix", "nzbmatrix_apikey", "")

        BINREQ = bool(check_setting_int(CFG, "Bin-Req", "binreq", 1))

        SAB_USERNAME = check_setting_str(CFG, "SABnzbd", "sab_username", "")
        SAB_PASSWORD = check_setting_str(CFG, "SABnzbd", "sab_password", "")
        SAB_APIKEY = check_setting_str(CFG, "SABnzbd", "sab_apikey", "")
        SAB_CATEGORY = check_setting_str(CFG, "SABnzbd", "sab_category", "tv")
        SAB_HOST = check_setting_str(CFG, "SABnzbd", "sab_host", "")

        XBMC_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, "XBMC", "xbmc_notify_onsnatch", 0))
        XBMC_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, "XBMC", "xbmc_notify_ondownload", 0))
        XBMC_UPDATE_LIBRARY = bool(check_setting_int(CFG, "XBMC", "xbmc_update_library", 0))
        XBMC_UPDATE_FULL = bool(check_setting_int(CFG, "XBMC", "xbmc_update_full", 0))
        XBMC_HOST = check_setting_str(CFG, "XBMC", "xbmc_host", "")
        XBMC_USERNAME = check_setting_str(CFG, "XBMC", "xbmc_username", "")
        XBMC_PASSWORD = check_setting_str(CFG, "XBMC", "xbmc_password", "")

        USE_GROWL = bool(check_setting_int(CFG, "Growl", "use_growl", 0))
        GROWL_HOST = check_setting_str(CFG, "Growl", "growl_host", "")
        GROWL_PASSWORD = check_setting_str(CFG, "Growl", "growl_password", "")

        logger.initLogging(consoleLogging=consoleLogging)

        # initialize the main SB database
        db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)

        currentSearchScheduler = scheduler.Scheduler(
            searchCurrent.CurrentSearcher(),
            cycleTime=datetime.timedelta(minutes=SEARCH_FREQUENCY),
            threadName="SEARCH",
            runImmediately=True,
        )

        backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(
            searchBacklog.BacklogSearcher(),
            cycleTime=datetime.timedelta(hours=1),
            threadName="BACKLOG",
            runImmediately=False,
        )
        backlogSearchScheduler.action.cycleTime = BACKLOG_SEARCH_FREQUENCY

        # the interval for this is stored inside the ShowUpdater class
        showUpdaterInstance = showUpdater.ShowUpdater()
        showUpdateScheduler = scheduler.Scheduler(
            showUpdaterInstance,
            cycleTime=showUpdaterInstance.updateInterval,
            threadName="SHOWUPDATER",
            runImmediately=False,
        )

        versionCheckScheduler = scheduler.Scheduler(
            versionChecker.CheckVersion(),
            cycleTime=datetime.timedelta(hours=12),
            threadName="CHECKVERSION",
            runImmediately=True,
        )

        showQueueScheduler = scheduler.Scheduler(
            queue.ShowQueue(), cycleTime=datetime.timedelta(seconds=3), threadName="SHOWQUEUE", silent=True
        )

        properFinderInstance = properFinder.ProperFinder()
        properFinderScheduler = scheduler.Scheduler(
            properFinderInstance,
            cycleTime=properFinderInstance.updateInterval,
            threadName="FINDPROPERS",
            runImmediately=False,
        )

        autoPostProcesserScheduler = scheduler.Scheduler(
            autoPostProcesser.PostProcesser(),
            cycleTime=datetime.timedelta(minutes=10),
            threadName="POSTPROCESSER",
            runImmediately=True,
        )

        showList = []
        loadingShowList = {}

        airingList = []
        comingList = []

        __INITIALIZED__ = True
        return True
开发者ID:styx-tdo,项目名称:Sick-Beard,代码行数:101,代码来源:__init__.py


示例10: Name

        self._test_allPossibleShowNames('Show Name (Full Country Name)', expected=['Show Name (Full Country Name)', 'Show Name (FCN)'])
        self._test_allPossibleShowNames('Show Name (FCN)', -1, 'TVRage Name', expected=['Show Name (FCN)', 'Show Name (Full Country Name)', 'Exception Test', 'TVRage Name'])

    def test_filterBadReleases(self):
        
        self._test_filterBadReleases('Show.S02.German.Stuff-Grp', False)
        self._test_filterBadReleases('Show.S02.Some.Stuff-Core2HD', False)
        self._test_filterBadReleases('Show.S02.Some.German.Stuff-Grp', False)
        self._test_filterBadReleases('German.Show.S02.Some.Stuff-Grp', True)
        self._test_filterBadReleases('Show.S02.This.Is.German', False)




print 'Loading exceptions...',
db.upgradeDatabase(db.DBConnection("cache.db"), cache_db.InitialSchema)
scene_exceptions.retrieve_exceptions()
print 'done.'

class SceneExceptionTestCase(unittest.TestCase):

    def test_sceneExceptionsEmpty(self):
        self.assertEqual(scene_exceptions.get_scene_exceptions(0), [])

    def test_sceneExceptionsBabylon5(self):
        self.assertEqual(sorted(scene_exceptions.get_scene_exceptions(70726)), ['Babylon 5', 'Babylon5'])

    def test_sceneExceptionByName(self):
        self.assertEqual(scene_exceptions.get_scene_exception_by_name('Babylon5'), 70726)
        self.assertEqual(scene_exceptions.get_scene_exception_by_name('babylon 5'), 70726)
        self.assertEqual(scene_exceptions.get_scene_exception_by_name('Carlos 2010'), 164451)
开发者ID:jesseward,项目名称:Sick-Beard,代码行数:31,代码来源:scene_helpers_tests.py


示例11: initialize


#.........这里部分代码省略.........
        
            if old_metadata_class:
                
                METADATA_SHOW = bool(check_setting_int(CFG, 'General', 'metadata_show', 1))
                METADATA_EPISODE = bool(check_setting_int(CFG, 'General', 'metadata_episode', 1))
            
                ART_POSTER = bool(check_setting_int(CFG, 'General', 'art_poster', 1))
                ART_FANART = bool(check_setting_int(CFG, 'General', 'art_fanart', 1))
                ART_THUMBNAILS = bool(check_setting_int(CFG, 'General', 'art_thumbnails', 1))
                ART_SEASON_THUMBNAILS = bool(check_setting_int(CFG, 'General', 'art_season_thumbnails', 1))

                new_metadata_class = old_metadata_class(METADATA_SHOW,
                                                        METADATA_EPISODE,
                                                        ART_POSTER,
                                                        ART_FANART,
                                                        ART_THUMBNAILS,
                                                        ART_SEASON_THUMBNAILS)
                
                metadata_provider_dict[new_metadata_class.name] = new_metadata_class

        # this is the normal codepath for metadata config
        else:
            METADATA_XBMC = check_setting_str(CFG, 'General', 'metadata_xbmc', '0|0|0|0|0|0')
            METADATA_MEDIABROWSER = check_setting_str(CFG, 'General', 'metadata_mediabrowser', '0|0|0|0|0|0')
            METADATA_PS3 = check_setting_str(CFG, 'General', 'metadata_ps3', '0|0|0|0|0|0')
            
            for cur_metadata_tuple in [(METADATA_XBMC, metadata.xbmc),
                                       (METADATA_MEDIABROWSER, metadata.mediabrowser),
                                       (METADATA_PS3, metadata.ps3),
                                       ]:

                (cur_metadata_config, cur_metadata_class) = cur_metadata_tuple
                tmp_provider = cur_metadata_class.metadata_class()
                tmp_provider.set_config(cur_metadata_config)
                metadata_provider_dict[tmp_provider.name] = tmp_provider

        COMING_EPS_LAYOUT = check_setting_str(CFG, 'GUI', 'coming_eps_layout', 'banner')
        COMING_EPS_DISPLAY_PAUSED = bool(check_setting_int(CFG, 'GUI', 'coming_eps_display_paused', 0))
        COMING_EPS_SORT = check_setting_str(CFG, 'GUI', 'coming_eps_sort', 'date')

        newznabData = check_setting_str(CFG, 'Newznab', 'newznab_data', '')
        newznabProviderList = providers.getNewznabProviderList(newznabData)

        providerList = providers.makeProviderList()
        
        logger.initLogging(consoleLogging=consoleLogging)

        # initialize the main SB database
        db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)

        currentSearchScheduler = scheduler.Scheduler(searchCurrent.CurrentSearcher(),
                                                     cycleTime=datetime.timedelta(minutes=SEARCH_FREQUENCY),
                                                     threadName="SEARCH",
                                                     runImmediately=True)

        backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(searchBacklog.BacklogSearcher(),
                                                                      cycleTime=datetime.timedelta(minutes=get_backlog_cycle_time()),
                                                                      threadName="BACKLOG",
                                                                      runImmediately=False)
        backlogSearchScheduler.action.cycleTime = BACKLOG_SEARCH_FREQUENCY

        # the interval for this is stored inside the ShowUpdater class
        showUpdaterInstance = showUpdater.ShowUpdater()
        showUpdateScheduler = scheduler.Scheduler(showUpdaterInstance,
                                               cycleTime=showUpdaterInstance.updateInterval,
                                               threadName="SHOWUPDATER",
                                               runImmediately=False)

        versionCheckScheduler = scheduler.Scheduler(versionChecker.CheckVersion(),
                                                     cycleTime=datetime.timedelta(hours=12),
                                                     threadName="CHECKVERSION",
                                                     runImmediately=True)

        showQueueScheduler = scheduler.Scheduler(show_queue.ShowQueue(),
                                               cycleTime=datetime.timedelta(seconds=3),
                                               threadName="SHOWQUEUE",
                                               silent=True)

        searchQueueScheduler = scheduler.Scheduler(search_queue.SearchQueue(),
                                               cycleTime=datetime.timedelta(seconds=3),
                                               threadName="SEARCHQUEUE",
                                               silent=True)

        properFinderInstance = properFinder.ProperFinder()
        properFinderScheduler = scheduler.Scheduler(properFinderInstance,
                                                     cycleTime=properFinderInstance.updateInterval,
                                                     threadName="FINDPROPERS",
                                                     runImmediately=False)

        autoPostProcesserScheduler = scheduler.Scheduler(autoPostProcesser.PostProcesser(),
                                                     cycleTime=datetime.timedelta(minutes=10),
                                                     threadName="POSTPROCESSER",
                                                     runImmediately=True)


        showList = []
        loadingShowList = {}

        __INITIALIZED__ = True
        return True
开发者ID:davidakachaos,项目名称:Sick-Beard,代码行数:101,代码来源:__init__.py


示例12: initialize


#.........这里部分代码省略.........
        GIT_PATH = check_setting_str(CFG, "General", "git_path", "")

        EXTRA_SCRIPTS = [x for x in check_setting_str(CFG, "General", "extra_scripts", "").split("|") if x]

        METADATA_TYPE = check_setting_str(CFG, "General", "metadata_type", "xbmc")
        METADATA_SHOW = bool(check_setting_int(CFG, "General", "metadata_show", 1))
        METADATA_EPISODE = bool(check_setting_int(CFG, "General", "metadata_episode", 1))

        ART_POSTER = bool(check_setting_int(CFG, "General", "art_poster", 1))
        ART_FANART = bool(check_setting_int(CFG, "General", "art_fanart", 1))
        ART_THUMBNAILS = bool(check_setting_int(CFG, "General", "art_thumbnails", 1))
        ART_SEASON_THUMBNAILS = bool(check_setting_int(CFG, "General", "art_season_thumbnails", 1))

        # try setting defaults if possible
        try:
            TEMP_CREATE_METADATA = bool(int(CFG["General"]["create_metadata"]))
            METADATA_SHOW = TEMP_CREATE_METADATA
            METADATA_EPISODE = TEMP_CREATE_METADATA
        except:
            pass

        try:
            TEMP_CREATE_IMAGES = bool(int(CFG["General"]["create_images"]))
            ART_POSTER = TEMP_CREATE_IMAGES
            ART_FANART = TEMP_CREATE_IMAGES
            ART_THUMBNAILS = TEMP_CREATE_IMAGES
            ART_SEASON_THUMBNAILS = TEMP_CREATE_IMAGES
        except:
            pass

        newznabData = check_setting_str(CFG, "Newznab", "newznab_data", "")
        newznabProviderList = providers.getNewznabProviderList(newznabData)

        providerList = providers.makeProviderList()

        metadata_generator = metadata.getMetadataClass(METADATA_TYPE)

        logger.initLogging(consoleLogging=consoleLogging)

        # initialize the main SB database
        db.upgradeDatabase(db.DBConnection(), mainDB.InitialSchema)

        currentSearchScheduler = scheduler.Scheduler(
            searchCurrent.CurrentSearcher(),
            cycleTime=datetime.timedelta(minutes=SEARCH_FREQUENCY),
            threadName="SEARCH",
            runImmediately=True,
        )

        backlogSearchScheduler = searchBacklog.BacklogSearchScheduler(
            searchBacklog.BacklogSearcher(),
            cycleTime=datetime.timedelta(minutes=get_backlog_cycle_time()),
            threadName="BACKLOG",
            runImmediately=False,
        )
        backlogSearchScheduler.action.cycleTime = BACKLOG_SEARCH_FREQUENCY

        # the interval for this is stored inside the ShowUpdater class
        showUpdaterInstance = showUpdater.ShowUpdater()
        showUpdateScheduler = scheduler.Scheduler(
            showUpdaterInstance,
            cycleTime=showUpdaterInstance.updateInterval,
            threadName="SHOWUPDATER",
            runImmediately=False,
        )

        versionCheckScheduler = scheduler.Scheduler(
            versionChecker.CheckVersion(),
            cycleTime=datetime.timedelta(hours=12),
            threadName="CHECKVERSION",
            runImmediately=True,
        )

        showQueueScheduler = scheduler.Scheduler(
            queue.ShowQueue(), cycleTime=datetime.timedelta(seconds=3), threadName="SHOWQUEUE", silent=True
        )

        properFinderInstance = properFinder.ProperFinder()
        properFinderScheduler = scheduler.Scheduler(
            properFinderInstance,
            cycleTime=properFinderInstance.updateInterval,
            threadName="FINDPROPERS",
            runImmediately=False,
        )

        autoPostProcesserScheduler = scheduler.Scheduler(
            autoPostProcesser.PostProcesser(),
            cycleTime=datetime.timedelta(minutes=10),
            threadName="POSTPROCESSER",
            runImmediately=True,
        )

        showList = []
        loadingShowList = {}

        airingList = []
        comingList = []

        __INITIALIZED__ = True
        return True
开发者ID:sgranade,项目名称:Sick-Beard,代码行数:101,代码来源:__init__.py



注:本文中的sickbeard.db.upgradeDatabase函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python db.DBConnection类代码示例发布时间:2022-05-27
下一篇:
Python db.sanityCheckDatabase函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap