コード例 #1
0
def config_metadata(monkeypatch, app_config):
    # initialize metadata_providers
    default_config = ['0'] * 10
    providers = [(default_config, metadata.kodi),
                 (default_config, metadata.kodi_12plus),
                 (default_config, metadata.media_browser),
                 (default_config, metadata.ps3),
                 (default_config, metadata.wdtv),
                 (default_config, metadata.tivo),
                 (default_config, metadata.mede8er)]

    metadata_provider_dict = app_config('metadata_provider_dict',
                                        metadata.get_metadata_generator_dict())
    for cur_metadata_tuple in providers:
        (cur_metadata_config, cur_metadata_class) = cur_metadata_tuple
        tmp_provider = cur_metadata_class.metadata_class()
        tmp_provider.set_config(cur_metadata_config)
        monkeypatch.setitem(metadata_provider_dict, tmp_provider.name,
                            tmp_provider)

    section_data = {}

    section_data['metadataProviders'] = {}

    for provider in itervalues(app.metadata_provider_dict):
        json_repr = provider.to_json()
        section_data['metadataProviders'][json_repr['id']] = json_repr

    return section_data
コード例 #2
0
ファイル: test_config.py プロジェクト: pymedusa/SickRage
def config_metadata(monkeypatch, app_config):
    # initialize metadata_providers
    default_config = ['0'] * 10
    providers = [
        (default_config, metadata.kodi),
        (default_config, metadata.kodi_12plus),
        (default_config, metadata.media_browser),
        (default_config, metadata.ps3),
        (default_config, metadata.wdtv),
        (default_config, metadata.tivo),
        (default_config, metadata.mede8er)
    ]

    metadata_provider_dict = app_config('metadata_provider_dict', metadata.get_metadata_generator_dict())
    for cur_metadata_tuple in providers:
        (cur_metadata_config, cur_metadata_class) = cur_metadata_tuple
        tmp_provider = cur_metadata_class.metadata_class()
        tmp_provider.set_config(cur_metadata_config)
        monkeypatch.setitem(metadata_provider_dict, tmp_provider.name, tmp_provider)

    section_data = NonEmptyDict()

    section_data['metadataProviders'] = NonEmptyDict()

    for provider in itervalues(app.metadata_provider_dict):
        json_repr = provider.to_json()
        section_data['metadataProviders'][json_repr['id']] = json_repr

    return section_data