Ejemplo n.º 1
0
#  app globals
# =================
app.SYS_ENCODING = 'UTF-8'

app.showList = []
app.QUALITY_DEFAULT = 4  # hdtv
app.FLATTEN_FOLDERS_DEFAULT = 0

app.NAMING_PATTERN = ''
app.NAMING_ABD_PATTERN = ''
app.NAMING_SPORTS_PATTERN = ''
app.NAMING_MULTI_EP = 1

app.PROVIDER_ORDER = ["app_index"]
app.newznabProviderList = NewznabProvider.get_providers_list(
    "'Application Index|http://lolo.medusa.com/|0|5030,5040|0|eponly|0|0|0!!!NZBs.org|"
    "https://nzbs.org/||5030,5040,5060,5070,5090|0|eponly|0|0|0!!!Usenet-Crawler|"
    "https://www.usenet-crawler.com/||5030,5040,5060|0|eponly|0|0|0'")
app.providerList = providers.make_provider_list()

app.PROG_DIR = os.path.abspath(os.path.join(TEST_DIR, '..'))
app.DATA_DIR = TEST_DIR
app.CONFIG_FILE = os.path.join(app.DATA_DIR, "config.ini")
app.CFG = ConfigObj(app.CONFIG_FILE)

app.BRANCH = config.check_setting_str(app.CFG, 'General', 'branch', '')
app.CUR_COMMIT_HASH = config.check_setting_str(app.CFG, 'General',
                                               'cur_commit_hash', '')
app.GIT_USERNAME = config.check_setting_str(app.CFG, 'General', 'git_username',
                                            '')
app.GIT_PASSWORD = config.check_setting_str(app.CFG,
                                            'General',
Ejemplo n.º 2
0
    def _migrate_v10(self):
        """
        Convert all csv stored items as 'real' lists. ConfigObj provides a way for storing lists. These are saved
        as comma separated values, using this the format documented here:
        http://configobj.readthedocs.io/en/latest/configobj.html?highlight=lists#list-values
        """

        def get_providers_from_data(providers_string):
            """Split the provider string into providers, and get the provider names."""
            return [provider.split('|')[0].upper() for provider in providers_string.split('!!!') if provider]

        def make_id(name):
            """Make ID of the provider."""
            if not name:
                return ''

            return re.sub(r'[^\w\d_]', '_', str(name).strip().upper())

        def get_rss_torrent_providers_list(data):
            """Get RSS torrent provider list."""
            providers_list = [_ for _ in (make_rss_torrent_provider(_) for _ in data.split('!!!')) if _]
            seen_values = set()
            providers_set = []

            for provider in providers_list:
                value = provider.name

                if value not in seen_values:
                    providers_set.append(provider)
                    seen_values.add(value)

            return [_ for _ in providers_set if _]

        def make_rss_torrent_provider(config):
            """Create new RSS provider."""
            if not config:
                return None

            cookies = ''
            enable_backlog = 0
            enable_daily = 0
            enable_manualsearch = 0
            search_fallback = 0
            search_mode = 'eponly'
            title_tag = 'title'

            try:
                values = config.split('|')

                if len(values) == 9:
                    name, url, cookies, title_tag, enabled, search_mode, search_fallback, enable_daily, enable_backlog = values
                elif len(values) == 10:
                    name, url, cookies, title_tag, enabled, search_mode, search_fallback, enable_daily, enable_backlog, enable_manualsearch = values
                elif len(values) == 8:
                    name, url, cookies, enabled, search_mode, search_fallback, enable_daily, enable_backlog = values
                else:
                    enabled = values[4]
                    name = values[0]
                    url = values[1]
            except ValueError:
                log.error('Skipping RSS Torrent provider string: {config}, incorrect format', {'config': config})
                return None

            new_provider = TorrentRssProvider(
                name, url, cookies=cookies, title_tag=title_tag, search_mode=search_mode,
                search_fallback=search_fallback,
                enable_daily=enable_daily, enable_backlog=enable_backlog, enable_manualsearch=enable_manualsearch
            )
            new_provider.enabled = enabled == '1'

            return new_provider

        # General
        app.GIT_RESET_BRANCHES = convert_csv_string_to_list(self.config_obj['General']['git_reset_branches'])
        app.ALLOWED_EXTENSIONS = convert_csv_string_to_list(self.config_obj['General']['allowed_extensions'])
        app.PROVIDER_ORDER = convert_csv_string_to_list(self.config_obj['General']['provider_order'], ' ')
        app.ROOT_DIRS = convert_csv_string_to_list(self.config_obj['General']['root_dirs'], '|')
        app.SYNC_FILES = convert_csv_string_to_list(self.config_obj['General']['sync_files'])
        app.IGNORE_WORDS = convert_csv_string_to_list(self.config_obj['General']['ignore_words'])
        app.PREFERRED_WORDS = convert_csv_string_to_list(self.config_obj['General']['preferred_words'])
        app.UNDESIRED_WORDS = convert_csv_string_to_list(self.config_obj['General']['undesired_words'])
        app.TRACKERS_LIST = convert_csv_string_to_list(self.config_obj['General']['trackers_list'])
        app.REQUIRE_WORDS = convert_csv_string_to_list(self.config_obj['General']['require_words'])
        app.IGNORED_SUBS_LIST = convert_csv_string_to_list(self.config_obj['General']['ignored_subs_list'])
        app.BROKEN_PROVIDERS = convert_csv_string_to_list(self.config_obj['General']['broken_providers'])
        app.EXTRA_SCRIPTS = convert_csv_string_to_list(self.config_obj['General']['extra_scripts'], '|')

        # Metadata
        app.METADATA_KODI = convert_csv_string_to_list(self.config_obj['General']['metadata_kodi'], '|')
        app.METADATA_KODI_12PLUS = convert_csv_string_to_list(self.config_obj['General']['metadata_kodi_12plus'], '|')
        app.METADATA_MEDIABROWSER = convert_csv_string_to_list(self.config_obj['General']['metadata_mediabrowser'], '|')
        app.METADATA_PS3 = convert_csv_string_to_list(self.config_obj['General']['metadata_ps3'], '|')
        app.METADATA_WDTV = convert_csv_string_to_list(self.config_obj['General']['metadata_wdtv'], '|')
        app.METADATA_TIVO = convert_csv_string_to_list(self.config_obj['General']['metadata_tivo'], '|')
        app.METADATA_MEDE8ER = convert_csv_string_to_list(self.config_obj['General']['metadata_mede8er'], '|')

        # Subtitles
        app.SUBTITLES_LANGUAGES = convert_csv_string_to_list(self.config_obj['Subtitles']['subtitles_languages'])
        app.SUBTITLES_SERVICES_LIST = convert_csv_string_to_list(self.config_obj['Subtitles']['SUBTITLES_SERVICES_LIST'])
        app.SUBTITLES_SERVICES_ENABLED = convert_csv_string_to_list(self.config_obj['Subtitles']['SUBTITLES_SERVICES_ENABLED'], '|')
        app.SUBTITLES_EXTRA_SCRIPTS = convert_csv_string_to_list(self.config_obj['Subtitles']['subtitles_extra_scripts'], '|')
        app.SUBTITLES_PRE_SCRIPTS = convert_csv_string_to_list(self.config_obj['Subtitles']['subtitles_pre_scripts'], '|')

        # Notifications
        app.KODI_HOST = convert_csv_string_to_list(self.config_obj['KODI']['kodi_host'])
        app.PLEX_SERVER_HOST = convert_csv_string_to_list(self.config_obj['Plex']['plex_server_host'])
        app.PLEX_CLIENT_HOST = convert_csv_string_to_list(self.config_obj['Plex']['plex_client_host'])
        app.PROWL_API = convert_csv_string_to_list(self.config_obj['Prowl']['prowl_api'])
        app.PUSHOVER_DEVICE = convert_csv_string_to_list(self.config_obj['Pushover']['pushover_device'])
        app.EMAIL_LIST = convert_csv_string_to_list(self.config_obj['Email']['email_list'])

        try:
            # migrate rsstorrent providers
            from medusa.providers.torrent.rss.rsstorrent import TorrentRssProvider

            # Create the new list of torrent rss providers, with only the id stored.
            app.TORRENTRSS_PROVIDERS = get_providers_from_data(self.config_obj['TorrentRss']['torrentrss_data'])

            # Create the torrent providers from the old rsstorrent piped separated data.
            app.torrentRssProviderList = get_rss_torrent_providers_list(self.config_obj['TorrentRss']['torrentrss_data'])
        except KeyError:
            app.TORRENTRSS_PROVIDERS = []

        try:
            # migrate newznab providers.
            # Newznabprovider needs to be imported lazy, as the module will also import other providers to early.
            from medusa.providers.nzb.newznab import NewznabProvider

            # Create the newznab providers from the old newznab piped separated data.
            app.newznabProviderList = NewznabProvider.get_providers_list(
                self.config_obj['Newznab']['newznab_data']
            )

            app.NEWZNAB_PROVIDERS = [make_id(provider.name) for provider in app.newznabProviderList if not provider.default]
        except KeyError:
            app.NEWZNAB_PROVIDERS = []
Ejemplo n.º 3
0
app.SYS_ENCODING = 'UTF-8'

app.showList = []
app.QUALITY_DEFAULT = 4  # hdtv
app.SEASON_FOLDERS_DEFAULT = 1

app.NAMING_PATTERN = ''
app.NAMING_ABD_PATTERN = ''
app.NAMING_SPORTS_PATTERN = ''
app.NAMING_MULTI_EP = 1


app.PROVIDER_ORDER = ["app_index"]
app.newznabProviderList = NewznabProvider.get_providers_list(
    'Application Index|http://lolo.medusa.com/|0|5030,5040|0|eponly|0|0|0|0!!!'
    'NZBs.org|https://nzbs.org/||5030,5040,5060,5070,5090|0|eponly|0|0|0|0!!!'
    'Usenet-Crawler|https://api.usenet-crawler.com/||5030,5040,5060|0|eponly|0|0|0|0'
)
app.providerList = providers.make_provider_list()

app.PROG_DIR = os.path.abspath(os.path.join(TEST_DIR, '..'))
app.DATA_DIR = TEST_DIR
app.CONFIG_FILE = os.path.join(app.DATA_DIR, "config.ini")
app.CFG = ConfigObj(app.CONFIG_FILE)

app.BRANCH = config.check_setting_str(app.CFG, 'General', 'branch', '')
app.CUR_COMMIT_HASH = config.check_setting_str(app.CFG, 'General', 'cur_commit_hash', '')
app.GIT_USERNAME = config.check_setting_str(app.CFG, 'General', 'git_username', '')
app.GIT_PASSWORD = config.check_setting_str(app.CFG, 'General', 'git_password', '', censor_log='low')

app.LOG_DIR = os.path.join(TEST_DIR, 'Logs')