Example #1
0
    def get(self, *args, **kwargs):
        backup_file = self.get_argument('backupFile')
        restore_database = self.get_argument('restore_database')
        restore_config = self.get_argument('restore_config')
        restore_cache = self.get_argument('restore_cache')

        final_result = ''

        if backup_file:
            source = backup_file
            target_dir = os.path.join(sickrage.app.data_dir, 'restore')

            restore_database = checkbox_to_value(restore_database)
            restore_config = checkbox_to_value(restore_config)
            restore_cache = checkbox_to_value(restore_cache)

            if restore_config_zip(source, target_dir, restore_database,
                                  restore_config, restore_cache):
                final_result += _("Successfully extracted restore files to " +
                                  target_dir)
                final_result += _(
                    "<br>Restart sickrage to complete the restore.")
            else:
                final_result += _("Restore FAILED")
        else:
            final_result += _("You need to select a backup file to restore!")

        final_result += "<br>\n"

        return self.write(final_result)
Example #2
0
    def get(self, *args, **kwargs):
        default_status = self.get_argument('defaultStatus', '5')
        any_qualities = self.get_argument('anyQualities', '')
        best_qualities = self.get_argument('bestQualities', '')
        default_flatten_folders = self.get_argument('defaultFlattenFolders', None)
        subtitles = self.get_argument('subtitles', None)
        anime = self.get_argument('anime', None)
        scene = self.get_argument('scene', None)
        default_status_after = self.get_argument('defaultStatusAfter', common.WANTED)
        skip_downloaded = self.get_argument('skip_downloaded', None)
        add_show_year = self.get_argument('add_show_year', None)

        any_qualities = any_qualities.split(',') if len(any_qualities) else []
        best_qualities = best_qualities.split(',') if len(best_qualities) else []

        new_quality = Quality.combine_qualities(list(map(int, any_qualities)), list(map(int, best_qualities)))

        sickrage.app.config.status_default = int(default_status)
        sickrage.app.config.status_default_after = int(default_status_after)
        sickrage.app.config.quality_default = int(new_quality)

        sickrage.app.config.flatten_folders_default = checkbox_to_value(default_flatten_folders)
        sickrage.app.config.subtitles_default = checkbox_to_value(subtitles)

        sickrage.app.config.anime_default = checkbox_to_value(anime)
        sickrage.app.config.scene_default = checkbox_to_value(scene)
        sickrage.app.config.skip_downloaded_default = checkbox_to_value(skip_downloaded)
        sickrage.app.config.add_show_year_default = checkbox_to_value(add_show_year)

        sickrage.app.config.save()
Example #3
0
    def delete(self, series_slug):
        data = json_decode(self.request.body)

        series = find_show_by_slug(series_slug)
        if series is None:
            return self._not_found(
                error=
                f"Unable to find the specified series using slug: {series_slug}"
            )

        sickrage.app.show_queue.remove_show(
            series.series_id, series.series_provider_id,
            checkbox_to_value(data.get('delete')))

        return self.json_response({'message': True})
Example #4
0
    def handle_post(self):
        use_anidb = self.get_argument('use_anidb', '')
        anidb_username = self.get_argument('anidb_username', '')
        anidb_password = self.get_argument('anidb_password', '')
        anidb_use_mylist = self.get_argument('anidb_use_mylist', '')
        split_home = self.get_argument('split_home', '')

        results = []

        sickrage.app.config.use_anidb = checkbox_to_value(use_anidb)
        sickrage.app.config.anidb_username = anidb_username
        sickrage.app.config.anidb_password = anidb_password
        sickrage.app.config.anidb_use_mylist = checkbox_to_value(anidb_use_mylist)
        sickrage.app.config.anime_split_home = checkbox_to_value(split_home)

        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(_('[ANIME] Configuration Encrypted and Saved to disk'))

        return self.redirect("/config/anime/")
Example #5
0
    def post(self, *args, **kwargs):
        use_anidb = self.get_argument('use_anidb', '')
        anidb_username = self.get_argument('anidb_username', '')
        anidb_password = self.get_argument('anidb_password', '')
        anidb_use_mylist = self.get_argument('anidb_use_mylist', '')
        split_home = self.get_argument('split_home', '')

        results = []

        sickrage.app.config.anidb.enable = checkbox_to_value(use_anidb)
        sickrage.app.config.anidb.username = anidb_username
        sickrage.app.config.anidb.password = anidb_password
        sickrage.app.config.anidb.use_my_list = checkbox_to_value(anidb_use_mylist)
        sickrage.app.config.anidb.split_home = checkbox_to_value(split_home)

        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(_('[ANIME] Configuration Saved to Database'))

        return self.redirect("/config/anime/")
Example #6
0
    def get(self, *args, **kwargs):
        default_status = self.get_argument('defaultStatus', '5')
        quality_preset = self.get_argument('qualityPreset', '')
        any_qualities = self.get_argument('anyQualities', '')
        best_qualities = self.get_argument('bestQualities', '')
        default_flatten_folders = self.get_argument('defaultFlattenFolders',
                                                    None)
        subtitles = self.get_argument('subtitles', None)
        anime = self.get_argument('anime', None)
        search_format = self.get_argument('search_format', None)
        default_status_after = self.get_argument('defaultStatusAfter',
                                                 None) or EpisodeStatus.WANTED
        scene = self.get_argument('scene', None)
        skip_downloaded = self.get_argument('skip_downloaded', None)
        add_show_year = self.get_argument('add_show_year', None)

        any_qualities = any_qualities.split(',') if len(any_qualities) else []
        best_qualities = best_qualities.split(',') if len(
            best_qualities) else []

        try:
            new_quality = Qualities[quality_preset]
        except KeyError:
            new_quality = Quality.combine_qualities(
                [Qualities[x] for x in any_qualities],
                [Qualities[x] for x in best_qualities])

        sickrage.app.config.general.status_default = EpisodeStatus[
            default_status]
        sickrage.app.config.general.status_default_after = EpisodeStatus[
            default_status_after]
        sickrage.app.config.general.quality_default = new_quality

        sickrage.app.config.general.flatten_folders_default = not checkbox_to_value(
            default_flatten_folders)
        sickrage.app.config.subtitles.default = checkbox_to_value(subtitles)

        sickrage.app.config.general.anime_default = checkbox_to_value(anime)
        sickrage.app.config.general.search_format_default = SearchFormat[
            search_format]
        sickrage.app.config.general.scene_default = checkbox_to_value(scene)
        sickrage.app.config.general.skip_downloaded_default = checkbox_to_value(
            skip_downloaded)
        sickrage.app.config.general.add_show_year_default = checkbox_to_value(
            add_show_year)

        sickrage.app.config.save()
Example #7
0
    def post(self, *args, **kwargs):
        use_nzbs = self.get_argument('use_nzbs', None)
        use_torrents = self.get_argument('use_torrents', None)
        nzb_dir = self.get_argument('nzb_dir', None)
        sab_username = self.get_argument('sab_username', None)
        sab_password = self.get_argument('sab_password', None)
        sab_apikey = self.get_argument('sab_apikey', None)
        sab_category = self.get_argument('sab_category', None)
        sab_category_anime = self.get_argument('sab_category_anime', None)
        sab_category_backlog = self.get_argument('sab_category_backlog', None)
        sab_category_anime_backlog = self.get_argument(
            'sab_category_anime_backlog', None)
        sab_host = self.get_argument('sab_host', None)
        nzbget_username = self.get_argument('nzbget_username', None)
        nzbget_password = self.get_argument('nzbget_password', None)
        nzbget_category = self.get_argument('nzbget_category', None)
        nzbget_category_backlog = self.get_argument('nzbget_category_backlog',
                                                    None)
        nzbget_category_anime = self.get_argument('nzbget_category_anime',
                                                  None)
        nzbget_category_anime_backlog = self.get_argument(
            'nzbget_category_anime_backlog', None)
        nzbget_priority = self.get_argument('nzbget_priority', None)
        nzbget_host = self.get_argument('nzbget_host', None)
        nzbget_use_https = self.get_argument('nzbget_use_https', None)
        backlog_frequency = self.get_argument('backlog_frequency', None)
        dailysearch_frequency = self.get_argument('dailysearch_frequency',
                                                  None)
        nzb_method = self.get_argument('nzb_method', None)
        torrent_method = self.get_argument('torrent_method', None)
        usenet_retention = self.get_argument('usenet_retention', None)
        download_propers = self.get_argument('download_propers', None)
        check_propers_interval = self.get_argument('check_propers_interval',
                                                   None)
        allow_high_priority = self.get_argument('allow_high_priority', None)
        sab_forced = self.get_argument('sab_forced', None)
        randomize_providers = self.get_argument('randomize_providers', None)
        use_failed_snatcher = self.get_argument('use_failed_snatcher', None)
        failed_snatch_age = self.get_argument('failed_snatch_age', None)
        torrent_dir = self.get_argument('torrent_dir', None)
        torrent_username = self.get_argument('torrent_username', None)
        torrent_password = self.get_argument('torrent_password', None)
        torrent_host = self.get_argument('torrent_host', None)
        torrent_label = self.get_argument('torrent_label', None)
        torrent_label_anime = self.get_argument('torrent_label_anime', None)
        torrent_path = self.get_argument('torrent_path', None)
        torrent_verify_cert = self.get_argument('torrent_verify_cert', None)
        torrent_seed_time = self.get_argument('torrent_seed_time', None)
        torrent_paused = self.get_argument('torrent_paused', None)
        torrent_high_bandwidth = self.get_argument('torrent_high_bandwidth',
                                                   None)
        torrent_rpcurl = self.get_argument('torrent_rpcurl', None)
        torrent_auth_type = self.get_argument('torrent_auth_type', None)
        ignore_words = self.get_argument('ignore_words', None)
        require_words = self.get_argument('require_words', None)
        ignored_subs_list = self.get_argument('ignored_subs_list', None)
        enable_rss_cache = self.get_argument('enable_rss_cache', None)
        torrent_file_to_magnet = self.get_argument('torrent_file_to_magnet',
                                                   None)
        download_unverified_magnet_link = self.get_argument(
            'download_unverified_magnet_link', None)

        results = []

        if not sickrage.app.config.change_nzb_dir(nzb_dir):
            results += [
                _("Unable to create directory ") + os.path.normpath(nzb_dir) +
                _(", dir not changed.")
            ]

        if not sickrage.app.config.change_torrent_dir(torrent_dir):
            results += [
                _("Unable to create directory ") +
                os.path.normpath(torrent_dir) + _(", dir not changed.")
            ]

        sickrage.app.config.change_failed_snatch_age(failed_snatch_age)
        sickrage.app.config.use_failed_snatcher = checkbox_to_value(
            use_failed_snatcher)
        sickrage.app.config.change_daily_searcher_freq(dailysearch_frequency)
        sickrage.app.config.change_backlog_searcher_freq(backlog_frequency)
        sickrage.app.config.use_nzbs = checkbox_to_value(use_nzbs)
        sickrage.app.config.use_torrents = checkbox_to_value(use_torrents)
        sickrage.app.config.nzb_method = nzb_method
        sickrage.app.config.torrent_method = torrent_method
        sickrage.app.config.usenet_retention = try_int(usenet_retention, 500)
        sickrage.app.config.ignore_words = ignore_words if ignore_words else ""
        sickrage.app.config.require_words = require_words if require_words else ""
        sickrage.app.config.ignored_subs_list = ignored_subs_list if ignored_subs_list else ""
        sickrage.app.config.randomize_providers = checkbox_to_value(
            randomize_providers)
        sickrage.app.config.enable_rss_cache = checkbox_to_value(
            enable_rss_cache)
        sickrage.app.config.torrent_file_to_magnet = checkbox_to_value(
            torrent_file_to_magnet)
        sickrage.app.config.download_unverified_magnet_link = checkbox_to_value(
            download_unverified_magnet_link)
        sickrage.app.config.download_propers = checkbox_to_value(
            download_propers)
        sickrage.app.config.proper_searcher_interval = check_propers_interval
        sickrage.app.config.allow_high_priority = checkbox_to_value(
            allow_high_priority)
        sickrage.app.config.sab_username = sab_username
        sickrage.app.config.sab_password = sab_password
        sickrage.app.config.sab_apikey = sab_apikey.strip()
        sickrage.app.config.sab_category = sab_category
        sickrage.app.config.sab_category_backlog = sab_category_backlog
        sickrage.app.config.sab_category_anime = sab_category_anime
        sickrage.app.config.sab_category_anime_backlog = sab_category_anime_backlog
        sickrage.app.config.sab_host = clean_url(sab_host)
        sickrage.app.config.sab_forced = checkbox_to_value(sab_forced)
        sickrage.app.config.nzbget_username = nzbget_username
        sickrage.app.config.nzbget_password = nzbget_password
        sickrage.app.config.nzbget_category = nzbget_category
        sickrage.app.config.nzbget_category_backlog = nzbget_category_backlog
        sickrage.app.config.nzbget_category_anime = nzbget_category_anime
        sickrage.app.config.nzbget_category_anime_backlog = nzbget_category_anime_backlog
        sickrage.app.config.nzbget_host = clean_host(nzbget_host)
        sickrage.app.config.nzbget_use_https = checkbox_to_value(
            nzbget_use_https)
        sickrage.app.config.nzbget_priority = try_int(nzbget_priority, 100)
        sickrage.app.config.torrent_username = torrent_username
        sickrage.app.config.torrent_password = torrent_password
        sickrage.app.config.torrent_label = torrent_label
        sickrage.app.config.torrent_label_anime = torrent_label_anime
        sickrage.app.config.torrent_verify_cert = checkbox_to_value(
            torrent_verify_cert)
        sickrage.app.config.torrent_path = torrent_path.rstrip('/\\')
        sickrage.app.config.torrent_seed_time = torrent_seed_time
        sickrage.app.config.torrent_paused = checkbox_to_value(torrent_paused)
        sickrage.app.config.torrent_high_bandwidth = checkbox_to_value(
            torrent_high_bandwidth)
        sickrage.app.config.torrent_host = clean_url(torrent_host)
        sickrage.app.config.torrent_rpcurl = torrent_rpcurl
        sickrage.app.config.torrent_auth_type = torrent_auth_type

        torrent_webui_url(True)

        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'),
                                      '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(
                _('[SEARCH] Configuration Encrypted and Saved to disk'))

        return self.redirect("/config/search/")
Example #8
0
    def post(self, *args, **kwargs):
        log_nr = self.get_argument('log_nr', '5')
        log_size = self.get_argument('log_size', '1048576')
        web_port = self.get_argument('web_port', None)
        web_ipv6 = self.get_argument('web_ipv6', None)
        trash_remove_show = self.get_argument('trash_remove_show', None)
        trash_rotate_logs = self.get_argument('trash_rotate_logs', None)
        update_frequency = self.get_argument('update_frequency', None)
        skip_removed_files = self.get_argument('skip_removed_files', None)
        indexerDefaultLang = self.get_argument('indexerDefaultLang', 'en')
        ep_default_deleted_status = self.get_argument('ep_default_deleted_status', None)
        launch_browser = self.get_argument('launch_browser', None)
        showupdate_hour = self.get_argument('showupdate_hour', '3')
        api_key = self.get_argument('api_key', None)
        indexer_default = self.get_argument('indexer_default', None)
        timezone_display = self.get_argument('timezone_display', None)
        cpu_preset = self.get_argument('cpu_preset', 'NORMAL')
        version_notify = self.get_argument('version_notify', None)
        enable_https = self.get_argument('enable_https', None)
        https_cert = self.get_argument('https_cert', None)
        https_key = self.get_argument('https_key', None)
        handle_reverse_proxy = self.get_argument('handle_reverse_proxy', None)
        sort_article = self.get_argument('sort_article', None)
        auto_update = self.get_argument('auto_update', None)
        notify_on_update = self.get_argument('notify_on_update', None)
        proxy_setting = self.get_argument('proxy_setting', None)
        proxy_indexers = self.get_argument('proxy_indexers', None)
        anon_redirect = self.get_argument('anon_redirect', None)
        git_path = self.get_argument('git_path', None)
        pip3_path = self.get_argument('pip3_path', None)
        calendar_unprotected = self.get_argument('calendar_unprotected', None)
        calendar_icons = self.get_argument('calendar_icons', None)
        debug = self.get_argument('debug', None)
        ssl_verify = self.get_argument('ssl_verify', None)
        no_restart = self.get_argument('no_restart', None)
        coming_eps_missed_range = self.get_argument('coming_eps_missed_range', None)
        filter_row = self.get_argument('filter_row', None)
        fuzzy_dating = self.get_argument('fuzzy_dating', None)
        trim_zero = self.get_argument('trim_zero', None)
        date_preset = self.get_argument('date_preset', None)
        time_preset = self.get_argument('time_preset', None)
        indexer_timeout = self.get_argument('indexer_timeout', None)
        download_url = self.get_argument('download_url', None)
        theme_name = self.get_argument('theme_name', None)
        default_page = self.get_argument('default_page', None)
        git_username = self.get_argument('git_username', None)
        git_password = self.get_argument('git_password', None)
        git_autoissues = self.get_argument('git_autoissues', None)
        gui_language = self.get_argument('gui_language', None)
        display_all_seasons = self.get_argument('display_all_seasons', None)
        showupdate_stale = self.get_argument('showupdate_stale', None)
        notify_on_login = self.get_argument('notify_on_login', None)
        allowed_video_file_exts = self.get_argument('allowed_video_file_exts', '')
        enable_api_providers_cache = self.get_argument('enable_api_providers_cache', None)
        enable_upnp = self.get_argument('enable_upnp', None)
        strip_special_file_bits = self.get_argument('strip_special_file_bits', None)
        max_queue_workers = self.get_argument('max_queue_workers', None)
        web_root = self.get_argument('web_root', '')

        results = []

        # API
        sickrage.app.config.enable_api_providers_cache = checkbox_to_value(enable_api_providers_cache)

        # Language
        sickrage.app.config.change_gui_lang(gui_language)

        # Debug
        sickrage.app.config.debug = checkbox_to_value(debug)
        sickrage.app.log.set_level()

        # Misc
        sickrage.app.config.enable_upnp = checkbox_to_value(enable_upnp)
        sickrage.app.config.download_url = download_url
        sickrage.app.config.indexer_default_language = indexerDefaultLang
        sickrage.app.config.ep_default_deleted_status = ep_default_deleted_status
        sickrage.app.config.skip_removed_files = checkbox_to_value(skip_removed_files)
        sickrage.app.config.launch_browser = checkbox_to_value(launch_browser)
        sickrage.app.config.change_showupdate_hour(showupdate_hour)
        sickrage.app.config.change_version_notify(checkbox_to_value(version_notify))
        sickrage.app.config.auto_update = checkbox_to_value(auto_update)
        sickrage.app.config.notify_on_update = checkbox_to_value(notify_on_update)
        sickrage.app.config.notify_on_login = checkbox_to_value(notify_on_login)
        sickrage.app.config.showupdate_stale = checkbox_to_value(showupdate_stale)
        sickrage.app.config.log_nr = log_nr
        sickrage.app.config.log_size = log_size

        sickrage.app.config.trash_remove_show = checkbox_to_value(trash_remove_show)
        sickrage.app.config.trash_rotate_logs = checkbox_to_value(trash_rotate_logs)
        sickrage.app.config.change_updater_freq(update_frequency)
        sickrage.app.config.launch_browser = checkbox_to_value(launch_browser)
        sickrage.app.config.sort_article = checkbox_to_value(sort_article)
        sickrage.app.config.cpu_preset = cpu_preset
        sickrage.app.config.anon_redirect = anon_redirect
        sickrage.app.config.proxy_setting = proxy_setting
        sickrage.app.config.proxy_indexers = checkbox_to_value(proxy_indexers)
        sickrage.app.config.git_username = git_username
        sickrage.app.config.git_password = git_password
        sickrage.app.config.git_reset = 1
        sickrage.app.config.git_autoissues = checkbox_to_value(git_autoissues)
        sickrage.app.config.git_path = git_path
        sickrage.app.config.pip3_path = pip3_path
        sickrage.app.config.calendar_unprotected = checkbox_to_value(calendar_unprotected)
        sickrage.app.config.calendar_icons = checkbox_to_value(calendar_icons)
        sickrage.app.config.no_restart = checkbox_to_value(no_restart)

        sickrage.app.config.ssl_verify = checkbox_to_value(ssl_verify)
        sickrage.app.config.coming_eps_missed_range = try_int(coming_eps_missed_range, 7)
        sickrage.app.config.display_all_seasons = checkbox_to_value(display_all_seasons)

        sickrage.app.config.web_port = try_int(web_port)
        sickrage.app.config.web_ipv6 = checkbox_to_value(web_ipv6)

        sickrage.app.config.filter_row = checkbox_to_value(filter_row)
        sickrage.app.config.fuzzy_dating = checkbox_to_value(fuzzy_dating)
        sickrage.app.config.trim_zero = checkbox_to_value(trim_zero)

        sickrage.app.config.allowed_video_file_exts = [x.lower() for x in allowed_video_file_exts.split(',')]

        sickrage.app.config.strip_special_file_bits = checkbox_to_value(strip_special_file_bits)

        sickrage.app.config.web_root = web_root

        # sickrage.app.config.change_web_external_port(web_external_port)

        if date_preset:
            sickrage.app.config.date_preset = date_preset

        if indexer_default:
            sickrage.app.config.indexer_default = try_int(indexer_default)

        if indexer_timeout:
            sickrage.app.config.indexer_timeout = try_int(indexer_timeout)

        if time_preset:
            sickrage.app.config.time_preset_w_seconds = time_preset
            sickrage.app.config.time_preset = sickrage.app.config.time_preset_w_seconds.replace(":%S", "")

        sickrage.app.config.timezone_display = timezone_display

        sickrage.app.config.api_key = api_key

        sickrage.app.config.enable_https = checkbox_to_value(enable_https)

        if not sickrage.app.config.change_https_cert(https_cert):
            results += [
                "Unable to create directory " + os.path.normpath(https_cert) + ", https cert directory not changed."]

        if not sickrage.app.config.change_https_key(https_key):
            results += [
                "Unable to create directory " + os.path.normpath(https_key) + ", https key directory not changed."]

        sickrage.app.config.handle_reverse_proxy = checkbox_to_value(handle_reverse_proxy)

        sickrage.app.config.theme_name = theme_name

        sickrage.app.config.default_page = default_page

        sickrage.app.config.max_queue_workers = try_int(max_queue_workers)

        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(_('[GENERAL] Configuration Encrypted and Saved to disk'))

        return self.redirect("/config/general/")
Example #9
0
    def post(self, *args, **kwargs):
        use_kodi = self.get_argument('use_kodi', None)
        kodi_always_on = self.get_argument('kodi_always_on', None)
        kodi_notify_on_snatch = self.get_argument('kodi_notify_on_snatch',
                                                  None)
        kodi_notify_on_download = self.get_argument('kodi_notify_on_download',
                                                    None)
        kodi_notify_on_subtitle_download = self.get_argument(
            'kodi_notify_on_subtitle_download', None)
        kodi_update_only_first = self.get_argument('kodi_update_only_first',
                                                   None)
        kodi_update_library = self.get_argument('kodi_update_library', None)
        kodi_update_full = self.get_argument('kodi_update_full', None)
        kodi_host = self.get_argument('kodi_host', None)
        kodi_username = self.get_argument('kodi_username', None)
        kodi_password = self.get_argument('kodi_password', None)
        use_plex = self.get_argument('use_plex', None)
        plex_notify_on_snatch = self.get_argument('plex_notify_on_snatch',
                                                  None)
        plex_notify_on_download = self.get_argument('plex_notify_on_download',
                                                    None)
        plex_notify_on_subtitle_download = self.get_argument(
            'plex_notify_on_subtitle_download', None)
        plex_update_library = self.get_argument('plex_update_library', None)
        plex_server_host = self.get_argument('plex_server_host', None)
        plex_server_token = self.get_argument('plex_server_token', None)
        plex_host = self.get_argument('plex_host', None)
        plex_username = self.get_argument('plex_username', None)
        plex_password = self.get_argument('plex_password', None)
        use_emby = self.get_argument('use_emby', None)
        emby_notify_on_snatch = self.get_argument('emby_notify_on_snatch',
                                                  None)
        emby_notify_on_download = self.get_argument('emby_notify_on_download',
                                                    None)
        emby_notify_on_subtitle_download = self.get_argument(
            'emby_notify_on_subtitle_download', None)
        emby_host = self.get_argument('emby_host', None)
        emby_apikey = self.get_argument('emby_apikey', None)
        use_growl = self.get_argument('use_growl', None)
        growl_notify_on_snatch = self.get_argument('growl_notify_on_snatch',
                                                   None)
        growl_notify_on_download = self.get_argument(
            'growl_notify_on_download', None)
        growl_notify_on_subtitle_download = self.get_argument(
            'growl_notify_on_subtitle_download', None)
        growl_host = self.get_argument('growl_host', None)
        growl_password = self.get_argument('growl_password', None)
        use_freemobile = self.get_argument('use_freemobile', None)
        freemobile_notify_on_snatch = self.get_argument(
            'freemobile_notify_on_snatch', None)
        freemobile_notify_on_download = self.get_argument(
            'freemobile_notify_on_download', None)
        freemobile_notify_on_subtitle_download = self.get_argument(
            'freemobile_notify_on_subtitle_download', None)
        freemobile_id = self.get_argument('freemobile_id', None)
        freemobile_apikey = self.get_argument('freemobile_apikey', None)
        use_telegram = self.get_argument('use_telegram', None)
        telegram_notify_on_snatch = self.get_argument(
            'telegram_notify_on_snatch', None)
        telegram_notify_on_download = self.get_argument(
            'telegram_notify_on_download', None)
        telegram_notify_on_subtitle_download = self.get_argument(
            'telegram_notify_on_subtitle_download', None)
        telegram_id = self.get_argument('telegram_id', None)
        telegram_apikey = self.get_argument('telegram_apikey', None)
        use_join = self.get_argument('use_join', None)
        join_notify_on_snatch = self.get_argument('join_notify_on_snatch',
                                                  None)
        join_notify_on_download = self.get_argument('join_notify_on_download',
                                                    None)
        join_notify_on_subtitle_download = self.get_argument(
            'join_notify_on_subtitle_download', None)
        join_id = self.get_argument('join_id', None)
        join_apikey = self.get_argument('join_apikey', None)
        use_prowl = self.get_argument('use_prowl', None)
        prowl_notify_on_snatch = self.get_argument('prowl_notify_on_snatch',
                                                   None)
        prowl_notify_on_download = self.get_argument(
            'prowl_notify_on_download', None)
        prowl_notify_on_subtitle_download = self.get_argument(
            'prowl_notify_on_subtitle_download', None)
        prowl_apikey = self.get_argument('prowl_apikey', None)
        prowl_priority = self.get_argument('prowl_priority', None) or 0
        use_twitter = self.get_argument('use_twitter', None)
        twitter_notify_on_snatch = self.get_argument(
            'twitter_notify_on_snatch', None)
        twitter_notify_on_download = self.get_argument(
            'twitter_notify_on_download', None)
        twitter_notify_on_subtitle_download = self.get_argument(
            'twitter_notify_on_subtitle_download', None)
        twitter_usedm = self.get_argument('twitter_usedm', None)
        twitter_dmto = self.get_argument('twitter_dmto', None)
        use_twilio = self.get_argument('use_twilio', None)
        twilio_notify_on_snatch = self.get_argument('twilio_notify_on_snatch',
                                                    None)
        twilio_notify_on_download = self.get_argument(
            'twilio_notify_on_download', None)
        twilio_notify_on_subtitle_download = self.get_argument(
            'twilio_notify_on_subtitle_download', None)
        twilio_phone_sid = self.get_argument('twilio_phone_sid', None)
        twilio_account_sid = self.get_argument('twilio_account_sid', None)
        twilio_auth_token = self.get_argument('twilio_auth_token', None)
        twilio_to_number = self.get_argument('twilio_to_number', None)
        use_boxcar2 = self.get_argument('use_boxcar2', None)
        boxcar2_notify_on_snatch = self.get_argument(
            'boxcar2_notify_on_snatch', None)
        boxcar2_notify_on_download = self.get_argument(
            'boxcar2_notify_on_download', None)
        boxcar2_notify_on_subtitle_download = self.get_argument(
            'boxcar2_notify_on_subtitle_download', None)
        boxcar2_accesstoken = self.get_argument('boxcar2_accesstoken', None)
        use_pushover = self.get_argument('use_pushover', None)
        pushover_notify_on_snatch = self.get_argument(
            'pushover_notify_on_snatch', None)
        pushover_notify_on_download = self.get_argument(
            'pushover_notify_on_download', None)
        pushover_notify_on_subtitle_download = self.get_argument(
            'pushover_notify_on_subtitle_download', None)
        pushover_userkey = self.get_argument('pushover_userkey', None)
        pushover_apikey = self.get_argument('pushover_apikey', None)
        pushover_device = self.get_argument('pushover_device', None)
        pushover_sound = self.get_argument('pushover_sound', None)
        use_libnotify = self.get_argument('use_libnotify', None)
        libnotify_notify_on_snatch = self.get_argument(
            'libnotify_notify_on_snatch', None)
        libnotify_notify_on_download = self.get_argument(
            'libnotify_notify_on_download', None)
        libnotify_notify_on_subtitle_download = self.get_argument(
            'libnotify_notify_on_subtitle_download', None)
        use_nmj = self.get_argument('use_nmj', None)
        nmj_host = self.get_argument('nmj_host', None)
        nmj_database = self.get_argument('nmj_database', None)
        nmj_mount = self.get_argument('nmj_mount', None)
        use_synoindex = self.get_argument('use_synoindex', None)
        use_nmjv2 = self.get_argument('use_nmjv2', None)
        nmjv2_host = self.get_argument('nmjv2_host', None)
        nmjv2_dbloc = self.get_argument('nmjv2_dbloc', None)
        nmjv2_database = self.get_argument('nmjv2_database', None)
        use_trakt = self.get_argument('use_trakt', None)
        trakt_username = self.get_argument('trakt_username', None)
        trakt_remove_watchlist = self.get_argument('trakt_remove_watchlist',
                                                   None)
        trakt_sync_watchlist = self.get_argument('trakt_sync_watchlist', None)
        trakt_remove_show_from_sickrage = self.get_argument(
            'trakt_remove_show_from_sickrage', None)
        trakt_method_add = self.get_argument('trakt_method_add', None)
        trakt_start_paused = self.get_argument('trakt_start_paused', None)
        trakt_use_recommended = self.get_argument('trakt_use_recommended',
                                                  None)
        trakt_sync = self.get_argument('trakt_sync', None)
        trakt_sync_remove = self.get_argument('trakt_sync_remove', None)
        trakt_default_series_provider = self.get_argument(
            'trakt_default_series_provider', None)
        trakt_remove_serieslist = self.get_argument('trakt_remove_serieslist',
                                                    None)
        trakt_timeout = self.get_argument('trakt_timeout', None)
        trakt_blacklist_name = self.get_argument('trakt_blacklist_name', None)
        use_synology_notification_provider = self.get_argument(
            'use_synology_notification_provider', None)
        synology_notification_provider_notify_on_snatch = self.get_argument(
            'synology_notification_provider_notify_on_snatch', None)
        synology_notification_provider_notify_on_download = self.get_argument(
            'synology_notification_provider_notify_on_download', None)
        synology_notification_provider_notify_on_subtitle_download = self.get_argument(
            'synology_notification_provider_notify_on_subtitle_download', None)
        use_pytivo = self.get_argument('use_pytivo', None)
        pytivo_notify_on_snatch = self.get_argument('pytivo_notify_on_snatch',
                                                    None)
        pytivo_notify_on_download = self.get_argument(
            'pytivo_notify_on_download', None)
        pytivo_notify_on_subtitle_download = self.get_argument(
            'pytivo_notify_on_subtitle_download', None)
        pytivo_update_library = self.get_argument('pytivo_update_library',
                                                  None)
        pytivo_host = self.get_argument('pytivo_host', None)
        pytivo_share_name = self.get_argument('pytivo_share_name', None)
        pytivo_tivo_name = self.get_argument('pytivo_tivo_name', None)
        use_nma = self.get_argument('use_nma', None)
        nma_notify_on_snatch = self.get_argument('nma_notify_on_snatch', None)
        nma_notify_on_download = self.get_argument('nma_notify_on_download',
                                                   None)
        nma_notify_on_subtitle_download = self.get_argument(
            'nma_notify_on_subtitle_download', None)
        nma_api = self.get_argument('nma_api', None)
        nma_priority = self.get_argument('nma_priority', None) or 0
        use_pushalot = self.get_argument('use_pushalot', None)
        pushalot_notify_on_snatch = self.get_argument(
            'pushalot_notify_on_snatch', None)
        pushalot_notify_on_download = self.get_argument(
            'pushalot_notify_on_download', None)
        pushalot_notify_on_subtitle_download = self.get_argument(
            'pushalot_notify_on_subtitle_download', None)
        pushalot_authorizationtoken = self.get_argument(
            'pushalot_authorizationtoken', None)
        use_pushbullet = self.get_argument('use_pushbullet', None)
        pushbullet_notify_on_snatch = self.get_argument(
            'pushbullet_notify_on_snatch', None)
        pushbullet_notify_on_download = self.get_argument(
            'pushbullet_notify_on_download', None)
        pushbullet_notify_on_subtitle_download = self.get_argument(
            'pushbullet_notify_on_subtitle_download', None)
        pushbullet_api = self.get_argument('pushbullet_api', None)
        pushbullet_device_list = self.get_argument('pushbullet_device_list',
                                                   None)
        use_email = self.get_argument('use_email', None)
        email_notify_on_snatch = self.get_argument('email_notify_on_snatch',
                                                   None)
        email_notify_on_download = self.get_argument(
            'email_notify_on_download', None)
        email_notify_on_subtitle_download = self.get_argument(
            'email_notify_on_subtitle_download', None)
        email_host = self.get_argument('email_host', None)
        email_port = self.get_argument('email_port', None) or 25
        email_from = self.get_argument('email_from', None)
        email_tls = self.get_argument('email_tls', None)
        email_user = self.get_argument('email_user', None)
        email_password = self.get_argument('email_password', None)
        email_list = self.get_argument('email_list', None)
        use_slack = self.get_argument('use_slack', None)
        slack_notify_on_snatch = self.get_argument('slack_notify_on_snatch',
                                                   None)
        slack_notify_on_download = self.get_argument(
            'slack_notify_on_download', None)
        slack_notify_on_subtitle_download = self.get_argument(
            'slack_notify_on_subtitle_download', None)
        slack_webhook = self.get_argument('slack_webhook', None)
        use_discord = self.get_argument('use_discord', None)
        discord_notify_on_snatch = self.get_argument(
            'discord_notify_on_snatch', None)
        discord_notify_on_download = self.get_argument(
            'discord_notify_on_download', None)
        discord_notify_on_subtitle_download = self.get_argument(
            'discord_notify_on_subtitle_download', None)
        discord_webhook = self.get_argument('discord_webhook', None)
        discord_name = self.get_argument('discord_name', None)
        discord_avatar_url = self.get_argument('discord_avatar_url', None)
        discord_tts = self.get_argument('discord_tts', None)
        use_alexa = self.get_argument('use_alexa', None)
        alexa_notify_on_snatch = self.get_argument('alexa_notify_on_snatch',
                                                   None)
        alexa_notify_on_download = self.get_argument(
            'alexa_notify_on_download', None)
        alexa_notify_on_subtitle_download = self.get_argument(
            'alexa_notify_on_subtitle_download', None)

        results = []

        sickrage.app.config.kodi.enable = checkbox_to_value(use_kodi)
        sickrage.app.config.kodi.always_on = checkbox_to_value(kodi_always_on)
        sickrage.app.config.kodi.notify_on_snatch = checkbox_to_value(
            kodi_notify_on_snatch)
        sickrage.app.config.kodi.notify_on_download = checkbox_to_value(
            kodi_notify_on_download)
        sickrage.app.config.kodi.notify_on_subtitle_download = checkbox_to_value(
            kodi_notify_on_subtitle_download)
        sickrage.app.config.kodi.update_library = checkbox_to_value(
            kodi_update_library)
        sickrage.app.config.kodi.update_full = checkbox_to_value(
            kodi_update_full)
        sickrage.app.config.kodi.update_only_first = checkbox_to_value(
            kodi_update_only_first)
        sickrage.app.config.kodi.host = clean_hosts(kodi_host)
        sickrage.app.config.kodi.username = kodi_username
        sickrage.app.config.kodi.password = kodi_password

        sickrage.app.config.plex.enable = checkbox_to_value(use_plex)
        sickrage.app.config.plex.notify_on_snatch = checkbox_to_value(
            plex_notify_on_snatch)
        sickrage.app.config.plex.notify_on_download = checkbox_to_value(
            plex_notify_on_download)
        sickrage.app.config.plex.notify_on_subtitle_download = checkbox_to_value(
            plex_notify_on_subtitle_download)
        sickrage.app.config.plex.update_library = checkbox_to_value(
            plex_update_library)
        sickrage.app.config.plex.host = clean_hosts(plex_host)
        sickrage.app.config.plex.server_host = clean_hosts(plex_server_host)
        sickrage.app.config.plex.server_token = clean_host(plex_server_token)
        sickrage.app.config.plex.username = plex_username
        sickrage.app.config.plex.password = plex_password
        sickrage.app.config.plex.enable_client = checkbox_to_value(use_plex)
        sickrage.app.config.plex.client_username = plex_username
        sickrage.app.config.plex.client_password = plex_password

        sickrage.app.config.emby.enable = checkbox_to_value(use_emby)
        sickrage.app.config.emby.notify_on_snatch = checkbox_to_value(
            emby_notify_on_snatch)
        sickrage.app.config.emby.notify_on_download = checkbox_to_value(
            emby_notify_on_download)
        sickrage.app.config.emby.notify_on_subtitle_download = checkbox_to_value(
            emby_notify_on_subtitle_download)
        sickrage.app.config.emby.host = clean_host(emby_host)
        sickrage.app.config.emby.apikey = emby_apikey

        sickrage.app.config.growl.enable = checkbox_to_value(use_growl)
        sickrage.app.config.growl.notify_on_snatch = checkbox_to_value(
            growl_notify_on_snatch)
        sickrage.app.config.growl.notify_on_download = checkbox_to_value(
            growl_notify_on_download)
        sickrage.app.config.growl.notify_on_subtitle_download = checkbox_to_value(
            growl_notify_on_subtitle_download)
        sickrage.app.config.growl.host = clean_host(growl_host,
                                                    default_port=23053)
        sickrage.app.config.growl.password = growl_password

        sickrage.app.config.freemobile.enable = checkbox_to_value(
            use_freemobile)
        sickrage.app.config.freemobile.notify_on_snatch = checkbox_to_value(
            freemobile_notify_on_snatch)
        sickrage.app.config.freemobile.notify_on_download = checkbox_to_value(
            freemobile_notify_on_download)
        sickrage.app.config.freemobile.notify_on_subtitle_download = checkbox_to_value(
            freemobile_notify_on_subtitle_download)
        sickrage.app.config.freemobile.user_id = freemobile_id
        sickrage.app.config.freemobile.apikey = freemobile_apikey

        sickrage.app.config.telegram.enable = checkbox_to_value(use_telegram)
        sickrage.app.config.telegram.notify_on_snatch = checkbox_to_value(
            telegram_notify_on_snatch)
        sickrage.app.config.telegram.notify_on_download = checkbox_to_value(
            telegram_notify_on_download)
        sickrage.app.config.telegram.notify_on_subtitle_download = checkbox_to_value(
            telegram_notify_on_subtitle_download)
        sickrage.app.config.telegram.user_id = telegram_id
        sickrage.app.config.telegram.apikey = telegram_apikey

        sickrage.app.config.join_app.enable = checkbox_to_value(use_join)
        sickrage.app.config.join_app.notify_on_snatch = checkbox_to_value(
            join_notify_on_snatch)
        sickrage.app.config.join_app.notify_on_download = checkbox_to_value(
            join_notify_on_download)
        sickrage.app.config.join_app.notify_on_subtitle_download = checkbox_to_value(
            join_notify_on_subtitle_download)
        sickrage.app.config.join_app.user_id = join_id
        sickrage.app.config.join_app.apikey = join_apikey

        sickrage.app.config.prowl.enable = checkbox_to_value(use_prowl)
        sickrage.app.config.prowl.notify_on_snatch = checkbox_to_value(
            prowl_notify_on_snatch)
        sickrage.app.config.prowl.notify_on_download = checkbox_to_value(
            prowl_notify_on_download)
        sickrage.app.config.prowl.notify_on_subtitle_download = checkbox_to_value(
            prowl_notify_on_subtitle_download)
        sickrage.app.config.prowl.apikey = prowl_apikey
        sickrage.app.config.prowl.priority = prowl_priority

        sickrage.app.config.twitter.enable = checkbox_to_value(use_twitter)
        sickrage.app.config.twitter.notify_on_snatch = checkbox_to_value(
            twitter_notify_on_snatch)
        sickrage.app.config.twitter.notify_on_download = checkbox_to_value(
            twitter_notify_on_download)
        sickrage.app.config.twitter.notify_on_subtitle_download = checkbox_to_value(
            twitter_notify_on_subtitle_download)
        sickrage.app.config.twitter.use_dm = checkbox_to_value(twitter_usedm)
        sickrage.app.config.twitter.dm_to = twitter_dmto

        sickrage.app.config.twilio.enable = checkbox_to_value(use_twilio)
        sickrage.app.config.twilio.notify_on_snatch = checkbox_to_value(
            twilio_notify_on_snatch)
        sickrage.app.config.twilio.notify_on_download = checkbox_to_value(
            twilio_notify_on_download)
        sickrage.app.config.twilio.notify_on_subtitle_download = checkbox_to_value(
            twilio_notify_on_subtitle_download)
        sickrage.app.config.twilio.phone_sid = twilio_phone_sid
        sickrage.app.config.twilio.account_sid = twilio_account_sid
        sickrage.app.config.twilio.auth_token = twilio_auth_token
        sickrage.app.config.twilio.to_number = twilio_to_number

        sickrage.app.config.alexa.enable = checkbox_to_value(use_alexa)
        sickrage.app.config.alexa.notify_on_snatch = checkbox_to_value(
            alexa_notify_on_snatch)
        sickrage.app.config.alexa.notify_on_download = checkbox_to_value(
            alexa_notify_on_download)
        sickrage.app.config.alexa.notify_on_subtitle_download = checkbox_to_value(
            alexa_notify_on_subtitle_download)

        sickrage.app.config.slack.enable = checkbox_to_value(use_slack)
        sickrage.app.config.slack.notify_on_snatch = checkbox_to_value(
            slack_notify_on_snatch)
        sickrage.app.config.slack.notify_on_download = checkbox_to_value(
            slack_notify_on_download)
        sickrage.app.config.slack.notify_on_subtitle_download = checkbox_to_value(
            slack_notify_on_subtitle_download)
        sickrage.app.config.slack.webhook = slack_webhook

        sickrage.app.config.discord.enable = checkbox_to_value(use_discord)
        sickrage.app.config.discord.notify_on_snatch = checkbox_to_value(
            discord_notify_on_snatch)
        sickrage.app.config.discord.notify_on_download = checkbox_to_value(
            discord_notify_on_download)
        sickrage.app.config.discord.notify_on_subtitle_download = checkbox_to_value(
            discord_notify_on_subtitle_download)
        sickrage.app.config.discord.webhook = discord_webhook
        sickrage.app.config.discord.name = discord_name
        sickrage.app.config.discord.avatar_url = discord_avatar_url
        sickrage.app.config.discord.tts = checkbox_to_value(discord_tts)

        sickrage.app.config.boxcar2.enable = checkbox_to_value(use_boxcar2)
        sickrage.app.config.boxcar2.notify_on_snatch = checkbox_to_value(
            boxcar2_notify_on_snatch)
        sickrage.app.config.boxcar2.notify_on_download = checkbox_to_value(
            boxcar2_notify_on_download)
        sickrage.app.config.boxcar2.notify_on_subtitle_download = checkbox_to_value(
            boxcar2_notify_on_subtitle_download)
        sickrage.app.config.boxcar2.access_token = boxcar2_accesstoken

        sickrage.app.config.pushover.enable = checkbox_to_value(use_pushover)
        sickrage.app.config.pushover.notify_on_snatch = checkbox_to_value(
            pushover_notify_on_snatch)
        sickrage.app.config.pushover.notify_on_download = checkbox_to_value(
            pushover_notify_on_download)
        sickrage.app.config.pushover.notify_on_subtitle_download = checkbox_to_value(
            pushover_notify_on_subtitle_download)
        sickrage.app.config.pushover.user_key = pushover_userkey
        sickrage.app.config.pushover.apikey = pushover_apikey
        sickrage.app.config.pushover.device = pushover_device
        sickrage.app.config.pushover.sound = pushover_sound

        sickrage.app.config.libnotify.enable = checkbox_to_value(use_libnotify)
        sickrage.app.config.libnotify.notify_on_snatch = checkbox_to_value(
            libnotify_notify_on_snatch)
        sickrage.app.config.libnotify.notify_on_download = checkbox_to_value(
            libnotify_notify_on_download)
        sickrage.app.config.libnotify.notify_on_subtitle_download = checkbox_to_value(
            libnotify_notify_on_subtitle_download)

        sickrage.app.config.nmj.enable = checkbox_to_value(use_nmj)
        sickrage.app.config.nmj.host = clean_host(nmj_host)
        sickrage.app.config.nmj.database = nmj_database
        sickrage.app.config.nmj.mount = nmj_mount

        sickrage.app.config.nmjv2.enable = checkbox_to_value(use_nmjv2)
        sickrage.app.config.nmjv2.host = clean_host(nmjv2_host)
        sickrage.app.config.nmjv2.database = nmjv2_database
        sickrage.app.config.nmjv2.db_loc = NMJv2Location[nmjv2_dbloc]

        sickrage.app.config.synology.enable_index = checkbox_to_value(
            use_synoindex)

        sickrage.app.config.synology.enable_notifications = checkbox_to_value(
            use_synology_notification_provider)
        sickrage.app.config.synology.notify_on_snatch = checkbox_to_value(
            synology_notification_provider_notify_on_snatch)
        sickrage.app.config.synology.notify_on_download = checkbox_to_value(
            synology_notification_provider_notify_on_download)
        sickrage.app.config.synology.notify_on_subtitle_download = checkbox_to_value(
            synology_notification_provider_notify_on_subtitle_download)

        sickrage.app.config.trakt.enable = checkbox_to_value(use_trakt)
        sickrage.app.config.trakt.username = trakt_username
        sickrage.app.config.trakt.remove_watchlist = checkbox_to_value(
            trakt_remove_watchlist)
        sickrage.app.config.trakt.remove_serieslist = checkbox_to_value(
            trakt_remove_serieslist)
        sickrage.app.config.trakt.remove_show_from_sickrage = checkbox_to_value(
            trakt_remove_show_from_sickrage)
        sickrage.app.config.trakt.sync_watchlist = checkbox_to_value(
            trakt_sync_watchlist)
        sickrage.app.config.trakt.method_add = TraktAddMethod[trakt_method_add]
        sickrage.app.config.trakt.start_paused = checkbox_to_value(
            trakt_start_paused)
        sickrage.app.config.trakt.use_recommended = checkbox_to_value(
            trakt_use_recommended)
        sickrage.app.config.trakt.sync = checkbox_to_value(trakt_sync)
        sickrage.app.config.trakt.sync_remove = checkbox_to_value(
            trakt_sync_remove)
        sickrage.app.config.trakt.series_provider_default = SeriesProviderID[
            trakt_default_series_provider]
        sickrage.app.config.trakt.timeout = int(trakt_timeout)
        sickrage.app.config.trakt.blacklist_name = trakt_blacklist_name

        sickrage.app.config.email.enable = checkbox_to_value(use_email)
        sickrage.app.config.email.notify_on_snatch = checkbox_to_value(
            email_notify_on_snatch)
        sickrage.app.config.email.notify_on_download = checkbox_to_value(
            email_notify_on_download)
        sickrage.app.config.email.notify_on_subtitle_download = checkbox_to_value(
            email_notify_on_subtitle_download)
        sickrage.app.config.email.host = clean_host(email_host)
        sickrage.app.config.email.port = try_int(email_port, 25)
        sickrage.app.config.email.send_from = email_from
        sickrage.app.config.email.tls = checkbox_to_value(email_tls)
        sickrage.app.config.email.username = email_user
        sickrage.app.config.email.password = email_password
        sickrage.app.config.email.send_to_list = email_list

        sickrage.app.config.pytivo.enable = checkbox_to_value(use_pytivo)
        sickrage.app.config.pytivo.notify_on_snatch = checkbox_to_value(
            pytivo_notify_on_snatch)
        sickrage.app.config.pytivo.notify_on_download = checkbox_to_value(
            pytivo_notify_on_download)
        sickrage.app.config.pytivo.notify_on_subtitle_download = checkbox_to_value(
            pytivo_notify_on_subtitle_download)
        sickrage.app.config.pytivo.update_library = checkbox_to_value(
            pytivo_update_library)
        sickrage.app.config.pytivo.host = clean_host(pytivo_host)
        sickrage.app.config.pytivo.share_name = pytivo_share_name
        sickrage.app.config.pytivo.tivo_name = pytivo_tivo_name

        sickrage.app.config.nma.enable = checkbox_to_value(use_nma)
        sickrage.app.config.nma.notify_on_snatch = checkbox_to_value(
            nma_notify_on_snatch)
        sickrage.app.config.nma.notify_on_download = checkbox_to_value(
            nma_notify_on_download)
        sickrage.app.config.nma.notify_on_subtitle_download = checkbox_to_value(
            nma_notify_on_subtitle_download)
        sickrage.app.config.nma.api_keys = nma_api
        sickrage.app.config.nma.priority = nma_priority

        sickrage.app.config.pushalot.enable = checkbox_to_value(use_pushalot)
        sickrage.app.config.pushalot.notify_on_snatch = checkbox_to_value(
            pushalot_notify_on_snatch)
        sickrage.app.config.pushalot.notify_on_download = checkbox_to_value(
            pushalot_notify_on_download)
        sickrage.app.config.pushalot.notify_on_subtitle_download = checkbox_to_value(
            pushalot_notify_on_subtitle_download)
        sickrage.app.config.pushalot.auth_token = pushalot_authorizationtoken

        sickrage.app.config.pushbullet.enable = checkbox_to_value(
            use_pushbullet)
        sickrage.app.config.pushbullet.notify_on_snatch = checkbox_to_value(
            pushbullet_notify_on_snatch)
        sickrage.app.config.pushbullet.notify_on_download = checkbox_to_value(
            pushbullet_notify_on_download)
        sickrage.app.config.pushbullet.notify_on_subtitle_download = checkbox_to_value(
            pushbullet_notify_on_subtitle_download)
        sickrage.app.config.pushbullet.api_key = pushbullet_api
        sickrage.app.config.pushbullet.device = pushbullet_device_list

        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'),
                                      '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(
                _('[NOTIFICATIONS] Configuration Saved to Database'))

        return self.redirect("/config/notifications/")
Example #10
0
    def post(self, *args, **kwargs):
        results = []

        # custom search providers
        for curProviderStr in self.get_argument('provider_strings', '').split('!!!'):
            if not len(curProviderStr):
                continue

            cur_provider_type, cur_provider_data = curProviderStr.split('|', 1)
            if SearchProviderType(cur_provider_type) == SearchProviderType.NEWZNAB:
                cur_name, cur_url, cur_key, cur_cat = cur_provider_data.split('|')
                provider_obj = NewznabProvider(cur_name, cur_url, cur_key, cur_cat)
                sickrage.app.search_providers.newznab().update(**{provider_obj.id: provider_obj})
            elif SearchProviderType(cur_provider_type) == SearchProviderType.TORRENT_RSS:
                cur_name, cur_url, cur_cookies, cur_title_tag = cur_provider_data.split('|')
                provider_obj = TorrentRssProvider(cur_name, cur_url, cur_cookies, cur_title_tag)
                sickrage.app.search_providers.torrentrss().update(**{provider_obj.id: provider_obj})

        # remove deleted custom search providers
        for p in sickrage.app.search_providers.all().copy():
            if p not in [x.split(':')[0] for x in self.get_argument('provider_order', '').split('!!!')]:
                provider_obj = sickrage.app.search_providers.all()[p]
                if provider_obj.provider_type in [SearchProviderType.TORRENT_RSS, SearchProviderType.NEWZNAB] and not provider_obj.default:
                    provider_obj.provider_deleted = True

        # enable/disable/sort search providers
        for curProviderIdx, curProviderStr in enumerate(self.get_argument('provider_order', '').split('!!!')):
            cur_provider, cur_enabled = curProviderStr.split(':')
            if cur_provider in sickrage.app.search_providers.all():
                cur_prov_obj = sickrage.app.search_providers.all()[cur_provider]
                cur_prov_obj.sort_order = curProviderIdx
                cur_prov_obj.enabled = bool(try_int(cur_enabled))

        # search provider settings
        for providerID, provider_obj in sickrage.app.search_providers.all().items():
            provider_obj.search_mode = self.get_argument(providerID + '_search_mode', 'eponly').strip()
            provider_obj.search_fallback = checkbox_to_value(self.get_argument(providerID + '_search_fallback', None) or False)
            provider_obj.enable_daily = checkbox_to_value(self.get_argument(providerID + '_enable_daily', None) or False)
            provider_obj.enable_backlog = checkbox_to_value(self.get_argument(providerID + '_enable_backlog', None) or False)
            provider_obj.cookies = self.get_argument(providerID + '_cookies', '').strip().rstrip(';')

            if provider_obj.provider_type in [SearchProviderType.TORRENT, SearchProviderType.TORRENT_RSS]:
                provider_obj.ratio = int(self.get_argument(providerID + '_ratio', None) or 0)
            elif provider_obj.provider_type in [SearchProviderType.NZB, SearchProviderType.NEWZNAB]:
                provider_obj.username = self.get_argument(providerID + '_username', '').strip()
                provider_obj.api_key = self.get_argument(providerID + '_api_key', '').strip()

            custom_settings = {
                'minseed': int(self.get_argument(providerID + '_minseed', None) or 0),
                'minleech': int(self.get_argument(providerID + '_minleech', None) or 0),
                'digest': self.get_argument(providerID + '_digest', '').strip(),
                'hash': self.get_argument(providerID + '_hash', '').strip(),
                'api_key': self.get_argument(providerID + '_api_key', '').strip(),
                'username': self.get_argument(providerID + '_username', '').strip(),
                'password': self.get_argument(providerID + '_password', '').strip(),
                'passkey': self.get_argument(providerID + '_passkey', '').strip(),
                'pin': self.get_argument(providerID + '_pin', '').strip(),
                'confirmed': checkbox_to_value(self.get_argument(providerID + '_confirmed', None) or False),
                'ranked': checkbox_to_value(self.get_argument(providerID + '_ranked', None) or False),
                'engrelease': checkbox_to_value(self.get_argument(providerID + '_engrelease', None) or False),
                'onlyspasearch': checkbox_to_value(self.get_argument(providerID + '_onlyspasearch', None) or False),
                'sorting': self.get_argument(providerID + '_sorting', 'seeders').strip(),
                'freeleech': checkbox_to_value(self.get_argument(providerID + '_freeleech', None) or False),
                'reject_m2ts': checkbox_to_value(self.get_argument(providerID + '_reject_m2ts', None) or False),
                # 'cat': int(self.get_argument(providerID + '_cat', None) or 0),
                'subtitle': checkbox_to_value(self.get_argument(providerID + '_subtitle', None) or False),
                'custom_url': self.get_argument(providerID + '_custom_url', '').strip()
            }

            # update provider object
            provider_obj.custom_settings.update((k, v) for k, v in custom_settings.items() if k in provider_obj.custom_settings)

        # save provider settings
        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(_('[PROVIDERS] Configuration Saved to Database'))

        return self.redirect("/config/providers/")
Example #11
0
    def patch(self, series_slug):
        warnings, errors = [], []

        do_update = False
        do_update_exceptions = False

        data = json_decode(self.request.body)

        series = find_show_by_slug(series_slug)
        if series is None:
            return self.send_error(
                404,
                error=
                f"Unable to find the specified series using slug: {series_slug}"
            )

        # if we changed the language then kick off an update
        if data.get('lang') is not None and data['lang'] != series.lang:
            do_update = True

        if data.get('paused') is not None:
            series.paused = checkbox_to_value(data['paused'])

        if data.get('anime') is not None:
            series.anime = checkbox_to_value(data['anime'])

        if data.get('scene') is not None:
            series.scene = checkbox_to_value(data['scene'])

        if data.get('searchFormat') is not None:
            series.search_format = SearchFormat[data['searchFormat']]

        if data.get('subtitles') is not None:
            series.subtitles = checkbox_to_value(data['subtitles'])

        if data.get('subUseSrMetadata') is not None:
            series.sub_use_sr_metadata = checkbox_to_value(
                data['subUseSrMetadata'])

        if data.get('defaultEpStatus') is not None:
            series.default_ep_status = int(data['defaultEpStatus'])

        if data.get('skipDownloaded') is not None:
            series.skip_downloaded = checkbox_to_value(data['skipDownloaded'])

        if data.get('sceneExceptions') is not None and set(
                data['sceneExceptions']) != set(series.scene_exceptions):
            do_update_exceptions = True

        if data.get('whitelist') is not None:
            shortwhitelist = short_group_names(data['whitelist'])
            series.release_groups.set_white_keywords(shortwhitelist)

        if data.get('blacklist') is not None:
            shortblacklist = short_group_names(data['blacklist'])
            series.release_groups.set_black_keywords(shortblacklist)

        if data.get('qualityPreset') is not None:
            try:
                new_quality = Qualities[data['qualityPreset']]
            except KeyError:
                new_quality = Quality.combine_qualities(
                    [Qualities[x] for x in data['allowedQualities']],
                    [Qualities[x] for x in data['preferredQualities']])

            series.quality = new_quality

        if data.get('flattenFolders') is not None and bool(
                series.flatten_folders) != bool(data['flattenFolders']):
            series.flatten_folders = data['flattenFolders']
            try:
                sickrage.app.show_queue.refresh_show(series.series_id,
                                                     series.series_provider_id,
                                                     True)
            except CantRefreshShowException as e:
                errors.append(_(f"Unable to refresh this show: {e}"))

        if data.get('language') is not None:
            series.lang = data['language']

        if data.get('dvdOrder') is not None:
            series.dvd_order = checkbox_to_value(data['dvdOrder'])

        if data.get('rlsIgnoreWords') is not None:
            series.rls_ignore_words = data['rlsIgnoreWords']

        if data.get('rlsRequireWords') is not None:
            series.rls_require_words = data['rlsRequireWords']

        # series.search_delay = int(data['search_delay'])

        # if we change location clear the db of episodes, change it, write to db, and rescan
        if data.get('location') is not None and os.path.normpath(
                series.location) != os.path.normpath(data['location']):
            sickrage.app.log.debug(
                os.path.normpath(series.location) + " != " +
                os.path.normpath(data['location']))
            if not os.path.isdir(
                    data['location']
            ) and not sickrage.app.config.general.create_missing_show_dirs:
                warnings.append(
                    f"New location {data['location']} does not exist")

            # don't bother if we're going to update anyway
            elif not do_update:
                # change it
                try:
                    series.location = data['location']
                    try:
                        sickrage.app.show_queue.refresh_show(
                            series.series_id, series.series_provider_id, True)
                    except CantRefreshShowException as e:
                        errors.append(_(f"Unable to refresh this show: {e}"))
                        # grab updated info from TVDB
                        # showObj.loadEpisodesFromSeriesProvider()
                        # rescan the episodes in the new folder
                except NoNFOException:
                    warnings.append(
                        _(f"The folder at {data['location']} doesn't contain a tvshow.nfo - copy your files to that folder before you change the directory in SiCKRAGE."
                          ))

        # force the update
        if do_update:
            try:
                sickrage.app.show_queue.update_show(series.series_id,
                                                    series.series_provider_id,
                                                    force=True)
            except CantUpdateShowException as e:
                errors.append(_(f"Unable to update show: {e}"))

        if do_update_exceptions:
            try:
                series.scene_exceptions = set(
                    data['sceneExceptions'].split(','))
            except CantUpdateShowException:
                warnings.append(
                    _("Unable to force an update on scene exceptions of the show."
                      ))

        # if do_update_scene_numbering:
        #     try:
        #         xem_refresh(series.series_id, series.series_provider_id, True)
        #     except CantUpdateShowException:
        #         warnings.append(_("Unable to force an update on scene numbering of the show."))

        # commit changes to database
        series.save()

        return self.write_json(series.to_json(episodes=True, details=True))
Example #12
0
    def post(self, *args, **kwargs):
        results = []

        # custom providers
        custom_providers = ''
        for curProviderStr in self.get_argument('provider_strings',
                                                '').split('!!!'):
            if not len(curProviderStr):
                continue

            custom_providers += '{}!!!'.format(curProviderStr)
            cur_type, cur_provider_data = curProviderStr.split('|', 1)

            if cur_type == "newznab":
                cur_name, cur_url, cur_key, cur_cat = cur_provider_data.split(
                    '|')
                provider_obj = NewznabProvider(cur_name, cur_url, cur_key,
                                               cur_cat)
                provider_obj.name = cur_name
                provider_obj.key = cur_key
                provider_obj.catIDs = cur_cat
                sickrage.app.search_providers.newznab().update(
                    **{provider_obj.id: provider_obj})
            elif cur_type == "torrentrss":
                cur_name, cur_url, cur_cookies, cur_title_tag = cur_provider_data.split(
                    '|')
                provider_obj = TorrentRssProvider(cur_name, cur_url,
                                                  cur_cookies, cur_title_tag)
                provider_obj.name = cur_name
                provider_obj.cookies = cur_cookies
                provider_obj.titleTAG = cur_title_tag
                sickrage.app.search_providers.torrentrss().update(
                    **{provider_obj.id: provider_obj})

        sickrage.app.config.custom_providers = custom_providers

        # remove providers
        for p in list(
                set(sickrage.app.search_providers.provider_order).difference([
                    x.split(':')[0] for x in self.get_argument(
                        'provider_order', '').split('!!!')
                ])):
            provider_obj = sickrage.app.search_providers.all()[p]
            del sickrage.app.search_providers[provider_obj.type][p]

        # enable/disable/sort providers
        sickrage.app.search_providers.provider_order = []
        for curProviderStr in self.get_argument('provider_order',
                                                '').split('!!!'):
            cur_provider, cur_enabled = curProviderStr.split(':')
            sickrage.app.search_providers.provider_order += [cur_provider]
            if cur_provider in sickrage.app.search_providers.all():
                cur_prov_obj = sickrage.app.search_providers.all(
                )[cur_provider]
                cur_prov_obj.enabled = bool(try_int(cur_enabled))

        # dynamically load provider settings
        for providerID, provider_obj in sickrage.app.search_providers.all(
        ).items():
            try:
                provider_settings = {
                    'minseed':
                    try_int(self.get_argument(providerID + '_minseed', 0)),
                    'minleech':
                    try_int(self.get_argument(providerID + '_minleech', 0)),
                    'ratio':
                    str(self.get_argument(providerID + '_ratio', '')).strip(),
                    'digest':
                    str(self.get_argument(providerID + '_digest', '')).strip(),
                    'hash':
                    str(self.get_argument(providerID + '_hash', '')).strip(),
                    'key':
                    str(self.get_argument(providerID + '_key', '')).strip(),
                    'api_key':
                    str(self.get_argument(providerID + '_api_key',
                                          '')).strip(),
                    'username':
                    str(self.get_argument(providerID + '_username',
                                          '')).strip(),
                    'password':
                    str(self.get_argument(providerID + '_password',
                                          '')).strip(),
                    'passkey':
                    str(self.get_argument(providerID + '_passkey',
                                          '')).strip(),
                    'pin':
                    str(self.get_argument(providerID + '_pin', '')).strip(),
                    'confirmed':
                    checkbox_to_value(
                        self.get_argument(providerID + '_confirmed', 0)),
                    'ranked':
                    checkbox_to_value(
                        self.get_argument(providerID + '_ranked', 0)),
                    'engrelease':
                    checkbox_to_value(
                        self.get_argument(providerID + '_engrelease', 0)),
                    'onlyspasearch':
                    checkbox_to_value(
                        self.get_argument(providerID + '_onlyspasearch', 0)),
                    'sorting':
                    str(self.get_argument(providerID + '_sorting',
                                          'seeders')).strip(),
                    'freeleech':
                    checkbox_to_value(
                        self.get_argument(providerID + '_freeleech', 0)),
                    'reject_m2ts':
                    checkbox_to_value(
                        self.get_argument(providerID + '_reject_m2ts', 0)),
                    'search_mode':
                    str(
                        self.get_argument(providerID + '_search_mode',
                                          'eponly')).strip(),
                    'search_fallback':
                    checkbox_to_value(
                        self.get_argument(providerID + '_search_fallback', 0)),
                    'enable_daily':
                    checkbox_to_value(
                        self.get_argument(providerID + '_enable_daily', 0)),
                    'enable_backlog':
                    checkbox_to_value(
                        self.get_argument(providerID + '_enable_backlog', 0)),
                    'cat':
                    try_int(self.get_argument(providerID + '_cat', 0)),
                    'subtitle':
                    checkbox_to_value(
                        self.get_argument(providerID + '_subtitle', 0)),
                    'cookies':
                    str(self.get_argument(providerID + '_cookies',
                                          '')).strip().rstrip(';'),
                    'custom_url':
                    str(self.get_argument(providerID + '_custom_url',
                                          '')).strip()
                }

                # update provider object
                [
                    setattr(provider_obj, k, v)
                    for k, v in provider_settings.items()
                    if hasattr(provider_obj, k)
                ]
            except Exception as e:
                continue

        # save provider settings
        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'),
                                      '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(
                _('[PROVIDERS] Configuration Encrypted and Saved to disk'))

        return self.redirect("/config/providers/")
Example #13
0
def edit_show(show, any_qualities, best_qualities, exceptions_list, location=None, flatten_folders=None, paused=None, direct_call=None, air_by_date=None,
              sports=None, dvdorder=None, indexer_lang=None, subtitles=None, sub_use_sr_metadata=None, skip_downloaded=None, rls_ignore_words=None,
              rls_require_words=None, anime=None, blacklist=None, whitelist=None, scene=None, default_ep_status=None, quality_preset=None, search_delay=None,
              session=None):
    show_obj = find_show(int(show), session=session)

    if not show_obj:
        err_msg = _("Unable to find the specified show: ") + str(show)
        if direct_call:
            sickrage.app.alerts.error(_('Error'), err_msg)
        return False, err_msg

    show_obj.exceptions = get_scene_exceptions(show_obj.indexer_id)

    flatten_folders = not checkbox_to_value(flatten_folders)  # UI inverts this value
    dvdorder = checkbox_to_value(dvdorder)
    skip_downloaded = checkbox_to_value(skip_downloaded)
    paused = checkbox_to_value(paused)
    air_by_date = checkbox_to_value(air_by_date)
    scene = checkbox_to_value(scene)
    sports = checkbox_to_value(sports)
    anime = checkbox_to_value(anime)
    subtitles = checkbox_to_value(subtitles)
    sub_use_sr_metadata = checkbox_to_value(sub_use_sr_metadata)

    if indexer_lang and indexer_lang in IndexerApi(show_obj.indexer).indexer().languages.keys():
        indexer_lang = indexer_lang
    else:
        indexer_lang = show_obj.lang

    # if we changed the language then kick off an update
    if indexer_lang == show_obj.lang:
        do_update = False
    else:
        do_update = True

    if scene == show_obj.scene or anime == show_obj.anime:
        do_update_scene_numbering = False
    else:
        do_update_scene_numbering = True

    show_obj.paused = paused
    show_obj.scene = scene
    show_obj.anime = anime
    show_obj.sports = sports
    show_obj.subtitles = subtitles
    show_obj.sub_use_sr_metadata = sub_use_sr_metadata
    show_obj.air_by_date = air_by_date
    show_obj.default_ep_status = int(default_ep_status)
    show_obj.skip_downloaded = skip_downloaded

    # If directCall from mass_edit_update no scene exceptions handling or blackandwhite list handling
    if direct_call:
        do_update_exceptions = False
    else:
        if set(exceptions_list) == set(show_obj.exceptions):
            do_update_exceptions = False
        else:
            do_update_exceptions = True

        if anime:
            if whitelist:
                shortwhitelist = short_group_names(whitelist)
                show_obj.release_groups.set_white_keywords(shortwhitelist)
            else:
                show_obj.release_groups.set_white_keywords([])

            if blacklist:
                shortblacklist = short_group_names(blacklist)
                show_obj.release_groups.set_black_keywords(shortblacklist)
            else:
                show_obj.release_groups.set_black_keywords([])

    warnings, errors = [], []

    new_quality = try_int(quality_preset, None)
    if not new_quality:
        new_quality = Quality.combine_qualities(list(map(int, any_qualities)), list(map(int, best_qualities)))

    show_obj.quality = new_quality

    # reversed for now
    if bool(show_obj.flatten_folders) != bool(flatten_folders):
        show_obj.flatten_folders = flatten_folders
        try:
            sickrage.app.show_queue.refresh_show(show_obj.indexer_id, True)
        except CantRefreshShowException as e:
            errors.append(_("Unable to refresh this show: {}").format(e))

    if not direct_call:
        show_obj.lang = indexer_lang
        show_obj.dvdorder = dvdorder
        show_obj.rls_ignore_words = rls_ignore_words.strip()
        show_obj.rls_require_words = rls_require_words.strip()
        show_obj.search_delay = int(search_delay)

    # if we change location clear the db of episodes, change it, write to db, and rescan
    if os.path.normpath(show_obj.location) != os.path.normpath(location):
        sickrage.app.log.debug(os.path.normpath(show_obj.location) + " != " + os.path.normpath(location))
        if not os.path.isdir(location) and not sickrage.app.config.create_missing_show_dirs:
            warnings.append("New location {} does not exist".format(location))

        # don't bother if we're going to update anyway
        elif not do_update:
            # change it
            try:
                show_obj.location = location
                try:
                    sickrage.app.show_queue.refresh_show(show_obj.indexer_id, True)
                except CantRefreshShowException as e:
                    errors.append(_("Unable to refresh this show:{}").format(e))
                    # grab updated info from TVDB
                    # showObj.loadEpisodesFromIndexer()
                    # rescan the episodes in the new folder
            except NoNFOException:
                warnings.append(
                    _("The folder at %s doesn't contain a tvshow.nfo - copy your files to that folder before "
                      "you change the directory in SiCKRAGE.") % location)

    # force the update
    if do_update:
        try:
            sickrage.app.show_queue.update_show(show_obj.indexer_id, force=True)
        except CantUpdateShowException as e:
            errors.append(_("Unable to update show: {}").format(e))

    if do_update_exceptions:
        try:
            update_scene_exceptions(show_obj.indexer_id, exceptions_list)
        except CantUpdateShowException:
            warnings.append(_("Unable to force an update on scene exceptions of the show."))

    if do_update_scene_numbering:
        try:
            xem_refresh(show_obj.indexer_id, show_obj.indexer, True)
        except CantUpdateShowException:
            warnings.append(_("Unable to force an update on scene numbering of the show."))

    if direct_call:
        return True if len(warnings) == 0 and len(errors) == 0 else False, json_encode({'warnings': warnings, 'errors': errors})

    if len(warnings) > 0:
        sickrage.app.alerts.message(
            _('{num_warnings:d} warning{plural} while saving changes:').format(num_warnings=len(warnings),
                                                                               plural="" if len(
                                                                                   warnings) == 1 else "s"),
            '<ul>' + '\n'.join(['<li>{0}</li>'.format(warning) for warning in warnings]) + "</ul>")

    if len(errors) > 0:
        sickrage.app.alerts.error(
            _('{num_errors:d} error{plural} while saving changes:').format(num_errors=len(errors),
                                                                           plural="" if len(errors) == 1 else "s"),
            '<ul>' + '\n'.join(['<li>{0}</li>'.format(error) for error in errors]) + "</ul>")

    return True, ""
Example #14
0
    async def post(self, *args, **kwargs):
        """
        Receive tvdb id, dir, and other options and create a show from them. If extra show dirs are
        provided then it forwards back to newShow, if not it goes to /home.
        """

        whichSeries = self.get_argument('whichSeries', None)
        rootDir = self.get_argument('rootDir', None)
        fullShowPath = self.get_argument('fullShowPath', None)
        providedName = self.get_argument('providedName', None)
        indexerLang = self.get_argument('indexerLang', None)
        defaultStatus = self.get_argument('defaultStatus', None)
        quality_preset = self.get_argument('quality_preset', None)
        anyQualities = self.get_arguments('anyQualities')
        bestQualities = self.get_arguments('bestQualities')
        flatten_folders = self.get_argument('flatten_folders', None)
        subtitles = self.get_argument('subtitles', None)
        sub_use_sr_metadata = self.get_argument('sub_use_sr_metadata', None)
        other_shows = self.get_arguments('other_shows')
        skipShow = self.get_argument('skipShow', None)
        providedIndexer = self.get_argument('providedIndexer', None)
        anime = self.get_argument('anime', None)
        scene = self.get_argument('scene', None)
        blacklist = self.get_argument('blacklist', None)
        whitelist = self.get_argument('whitelist', None)
        defaultStatusAfter = self.get_argument('defaultStatusAfter', None)
        skip_downloaded = self.get_argument('skip_downloaded', None)
        add_show_year = self.get_argument('add_show_year', None)

        indexerLang = indexerLang or sickrage.app.config.indexer_default_language

        # if we're skipping then behave accordingly
        if skipShow:
            return self.write(await self.finish_add_show(other_shows))

        if not whichSeries:
            return self.redirect("/home/")

        # figure out what show we're adding and where
        series_pieces = whichSeries.split('|')
        if (whichSeries and rootDir
                or whichSeries and fullShowPath) and len(series_pieces) > 1:
            if len(series_pieces) < 6:
                sickrage.app.log.error(
                    'Unable to add show due to show selection. Not anough arguments: %s'
                    % (repr(series_pieces)))
                sickrage.app.alerts.error(
                    _('Unknown error. Unable to add show due to problem with show selection.'
                      ))
                return self.redirect('/home/addShows/existingShows/')

            indexer = int(series_pieces[1])
            indexer_id = int(series_pieces[3])
            show_name = series_pieces[4]
        else:
            indexer = int(providedIndexer
                          or sickrage.app.config.indexer_default)
            indexer_id = int(whichSeries)
            if fullShowPath:
                show_name = os.path.basename(os.path.normpath(fullShowPath))
            else:
                show_name = providedName

        # use the whole path if it's given, or else append the show name to the root dir to get the full show path
        if fullShowPath:
            show_dir = os.path.normpath(fullShowPath)
        else:
            show_dir = os.path.join(rootDir, sanitize_file_name(show_name))
            if add_show_year and not re.match(r'.*\(\d+\)$',
                                              show_dir) and re.search(
                                                  r'\d{4}', series_pieces[5]):
                show_dir = "{} ({})".format(
                    show_dir,
                    re.search(r'\d{4}', series_pieces[5]).group(0))

        # blanket policy - if the dir exists you should have used "add existing show" numbnuts
        if os.path.isdir(show_dir) and not fullShowPath:
            sickrage.app.alerts.error(
                _("Unable to add show"),
                _("Folder ") + show_dir + _(" exists already"))
            return self.redirect('/home/addShows/existingShows/')

        # don't create show dir if config says not to
        if sickrage.app.config.add_shows_wo_dir:
            sickrage.app.log.info("Skipping initial creation of " + show_dir +
                                  " due to SiCKRAGE configuation setting")
        else:
            dir_exists = make_dir(show_dir)
            if not dir_exists:
                sickrage.app.log.warning("Unable to create the folder " +
                                         show_dir + ", can't add the show")
                sickrage.app.alerts.error(
                    _("Unable to add show"),
                    _("Unable to create the folder " + show_dir +
                      ", can't add the show"))

                # Don't redirect to default page because user wants to see the new show
                return self.redirect("/home/")
            else:
                chmod_as_parent(show_dir)

        # prepare the inputs for passing along
        scene = checkbox_to_value(scene)
        anime = checkbox_to_value(anime)
        flatten_folders = checkbox_to_value(flatten_folders)
        subtitles = checkbox_to_value(subtitles)
        sub_use_sr_metadata = checkbox_to_value(sub_use_sr_metadata)
        skip_downloaded = checkbox_to_value(skip_downloaded)

        if whitelist:
            whitelist = short_group_names(whitelist)
        if blacklist:
            blacklist = short_group_names(blacklist)

        newQuality = try_int(quality_preset, None)
        if not newQuality:
            newQuality = Quality.combine_qualities(map(int, anyQualities),
                                                   map(int, bestQualities))

        # add the show
        sickrage.app.show_queue.add_show(
            indexer=indexer,
            indexer_id=indexer_id,
            showDir=show_dir,
            default_status=int(defaultStatus),
            quality=newQuality,
            flatten_folders=flatten_folders,
            lang=indexerLang,
            subtitles=subtitles,
            sub_use_sr_metadata=sub_use_sr_metadata,
            anime=anime,
            scene=scene,
            paused=None,
            blacklist=blacklist,
            whitelist=whitelist,
            default_status_after=int(defaultStatusAfter),
            skip_downloaded=skip_downloaded)

        sickrage.app.alerts.message(
            _('Adding Show'),
            _('Adding the specified show into ') + show_dir)

        return self.write(await self.finish_add_show(other_shows))
Example #15
0
    def post(self, *args, **kwargs):
        use_subtitles = self.get_argument('use_subtitles', None)
        subtitles_dir = self.get_argument('subtitles_dir', None)
        service_order = self.get_argument('service_order', None)
        subtitles_history = self.get_argument('subtitles_history', None)
        subtitles_finder_frequency = self.get_argument(
            'subtitles_finder_frequency', None)
        subtitles_multi = self.get_argument('subtitles_multi', None)
        enable_embedded_subtitles = self.get_argument(
            'enable_embedded_subtitles', None)
        subtitles_extra_scripts = self.get_argument('subtitles_extra_scripts',
                                                    '')
        subtitles_hearing_impaired = self.get_argument(
            'subtitles_hearing_impaired', None)
        itasa_user = self.get_argument('itasa_user', None)
        itasa_pass = self.get_argument('itasa_pass', None)
        addic7ed_user = self.get_argument('addic7ed_user', None)
        addic7ed_pass = self.get_argument('addic7ed_pass', None)
        legendastv_user = self.get_argument('legendastv_user', None)
        legendastv_pass = self.get_argument('legendastv_pass', None)
        opensubtitles_user = self.get_argument('opensubtitles_user', None)
        opensubtitles_pass = self.get_argument('opensubtitles_pass', None)
        subtitles_languages = self.get_arguments('subtitles_languages[]')

        results = []

        change_subtitle_searcher_freq(subtitles_finder_frequency)

        sickrage.app.config.subtitles.enable = checkbox_to_value(use_subtitles)
        sickrage.app.config.subtitles.dir = subtitles_dir
        sickrage.app.config.subtitles.history = checkbox_to_value(
            subtitles_history)
        sickrage.app.config.subtitles.enable_embedded = checkbox_to_value(
            enable_embedded_subtitles)
        sickrage.app.config.subtitles.hearing_impaired = checkbox_to_value(
            subtitles_hearing_impaired)
        sickrage.app.config.subtitles.multi = checkbox_to_value(
            subtitles_multi)
        sickrage.app.config.subtitles.extra_scripts = subtitles_extra_scripts

        # Subtitle languages
        sickrage.app.config.subtitles.languages = ','.join(
            subtitles_languages) or 'eng'

        # 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(cur_enabled)

        sickrage.app.config.subtitles.services_list = ','.join(
            subtitles_services_list)
        sickrage.app.config.subtitles.services_enabled = '|'.join(
            subtitles_services_enabled)

        sickrage.app.config.subtitles.addic7ed_user = addic7ed_user or ''
        sickrage.app.config.subtitles.addic7ed_pass = addic7ed_pass or ''
        sickrage.app.config.subtitles.legendastv_user = legendastv_user or ''
        sickrage.app.config.subtitles.legendastv_pass = legendastv_pass or ''
        sickrage.app.config.subtitles.itasa_user = itasa_user or ''
        sickrage.app.config.subtitles.itasa_pass = itasa_pass or ''
        sickrage.app.config.subtitles.opensubtitles_user = opensubtitles_user or ''
        sickrage.app.config.subtitles.opensubtitles_pass = opensubtitles_pass or ''

        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'),
                                      '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(
                _('[SUBTITLES] Configuration Saved to Database'))

        return self.redirect("/config/subtitles/")
Example #16
0
    async def post(self, *args, **kwargs):
        naming_pattern = self.get_argument('naming_pattern', '')
        naming_multi_ep = self.get_argument('naming_multi_ep', '')
        kodi_data = self.get_argument('kodi_data', '')
        kodi_12plus_data = self.get_argument('kodi_12plus_data', '')
        mediabrowser_data = self.get_argument('mediabrowser_data', '')
        sony_ps3_data = self.get_argument('sony_ps3_data', '')
        wdtv_data = self.get_argument('wdtv_data', '')
        tivo_data = self.get_argument('tivo_data', '')
        mede8er_data = self.get_argument('mede8er_data', '')
        keep_processed_dir = self.get_argument('keep_processed_dir', '')
        process_method = self.get_argument('process_method', '')
        del_rar_contents = self.get_argument('del_rar_contents', '')
        process_automatically = self.get_argument('process_automatically', '')
        no_delete = self.get_argument('no_delete', '')
        rename_episodes = self.get_argument('rename_episodes', '')
        airdate_episodes = self.get_argument('airdate_episodes', '')
        file_timestamp_timezone = self.get_argument('file_timestamp_timezone',
                                                    '')
        unpack = self.get_argument('unpack', '')
        move_associated_files = self.get_argument('move_associated_files', '')
        sync_files = self.get_argument('sync_files', '')
        postpone_if_sync_files = self.get_argument('postpone_if_sync_files',
                                                   '')
        nfo_rename = self.get_argument('nfo_rename', '')
        tv_download_dir = self.get_argument('tv_download_dir', '')
        naming_custom_abd = self.get_argument('naming_custom_abd', '')
        naming_anime = self.get_argument('naming_anime', '')
        create_missing_show_dirs = self.get_argument(
            'create_missing_show_dirs', '')
        add_shows_wo_dir = self.get_argument('add_shows_wo_dir', '')
        naming_abd_pattern = self.get_argument('naming_abd_pattern', '')
        naming_strip_year = self.get_argument('naming_strip_year', '')
        delete_failed = self.get_argument('delete_failed', '')
        extra_scripts = self.get_argument('extra_scripts', '')
        naming_custom_sports = self.get_argument('naming_custom_sports', '')
        naming_sports_pattern = self.get_argument('naming_sports_pattern', '')
        naming_custom_anime = self.get_argument('naming_custom_anime', '')
        naming_anime_pattern = self.get_argument('naming_anime_pattern', '')
        naming_anime_multi_ep = self.get_argument('naming_anime_multi_ep', '')
        autopostprocessor_frequency = self.get_argument(
            'autopostprocessor_frequency', '')
        delete_non_associated_files = self.get_argument(
            'delete_non_associated_files', '')
        allowed_extensions = self.get_argument('allowed_extensions', '')
        processor_follow_symlinks = self.get_argument(
            'processor_follow_symlinks', '')
        unpack_dir = self.get_argument('unpack_dir', '')

        results = []

        if not sickrage.app.config.change_tv_download_dir(tv_download_dir):
            results += [
                _("Unable to create directory ") +
                os.path.normpath(tv_download_dir) + _(", dir not changed.")
            ]

        sickrage.app.config.change_autopostprocessor_freq(
            autopostprocessor_frequency)
        sickrage.app.config.process_automatically = checkbox_to_value(
            process_automatically)

        if unpack:
            if is_rar_supported() != "not supported":
                sickrage.app.config.unpack = checkbox_to_value(unpack)
                sickrage.app.config.unpack_dir = unpack_dir
            else:
                sickrage.app.config.unpack = 0
                results.append(
                    _("Unpacking Not Supported, disabling unpack setting"))
        else:
            sickrage.app.config.unpack = checkbox_to_value(unpack)

        sickrage.app.config.no_delete = checkbox_to_value(no_delete)
        sickrage.app.config.keep_processed_dir = checkbox_to_value(
            keep_processed_dir)
        sickrage.app.config.create_missing_show_dirs = checkbox_to_value(
            create_missing_show_dirs)
        sickrage.app.config.add_shows_wo_dir = checkbox_to_value(
            add_shows_wo_dir)
        sickrage.app.config.process_method = process_method
        sickrage.app.config.delrarcontents = checkbox_to_value(
            del_rar_contents)
        sickrage.app.config.extra_scripts = [
            x.strip() for x in extra_scripts.split('|') if x.strip()
        ]
        sickrage.app.config.rename_episodes = checkbox_to_value(
            rename_episodes)
        sickrage.app.config.airdate_episodes = checkbox_to_value(
            airdate_episodes)
        sickrage.app.config.file_timestamp_timezone = file_timestamp_timezone
        sickrage.app.config.move_associated_files = checkbox_to_value(
            move_associated_files)
        sickrage.app.config.sync_files = sync_files
        sickrage.app.config.postpone_if_sync_files = checkbox_to_value(
            postpone_if_sync_files)
        sickrage.app.config.allowed_extensions = ','.join(
            {x.strip()
             for x in allowed_extensions.split(',') if x.strip()})
        sickrage.app.config.naming_custom_abd = checkbox_to_value(
            naming_custom_abd)
        sickrage.app.config.naming_custom_sports = checkbox_to_value(
            naming_custom_sports)
        sickrage.app.config.naming_custom_anime = checkbox_to_value(
            naming_custom_anime)
        sickrage.app.config.naming_strip_year = checkbox_to_value(
            naming_strip_year)
        sickrage.app.config.delete_failed = checkbox_to_value(delete_failed)
        sickrage.app.config.nfo_rename = checkbox_to_value(nfo_rename)
        sickrage.app.config.delete_non_associated_files = checkbox_to_value(
            delete_non_associated_files)
        sickrage.app.config.processor_follow_symlinks = checkbox_to_value(
            processor_follow_symlinks)

        if is_naming_pattern_valid(pattern=naming_pattern,
                                   multi=naming_multi_ep) != "invalid":
            sickrage.app.config.naming_pattern = naming_pattern
            sickrage.app.config.naming_multi_ep = int(naming_multi_ep)
            sickrage.app.config.naming_force_folders = validator.check_force_season_folders(
            )
        else:
            results.append(
                _("You tried saving an invalid naming config, not saving your naming settings"
                  ))

        if is_naming_pattern_valid(pattern=naming_anime_pattern,
                                   multi=naming_anime_multi_ep,
                                   anime_type=naming_anime) != "invalid":
            sickrage.app.config.naming_anime_pattern = naming_anime_pattern
            sickrage.app.config.naming_anime_multi_ep = int(
                naming_anime_multi_ep)
            sickrage.app.config.naming_anime = int(naming_anime)
        else:
            results.append(
                _("You tried saving an invalid anime naming config, not saving your naming settings"
                  ))

        if is_naming_pattern_valid(pattern=naming_abd_pattern,
                                   abd=True) != "invalid":
            sickrage.app.config.naming_abd_pattern = naming_abd_pattern
        else:
            results.append(
                _("You tried saving an invalid air-by-date naming config, not saving your air-by-date settings"
                  ))

        if is_naming_pattern_valid(pattern=naming_sports_pattern,
                                   multi=naming_multi_ep,
                                   sports=True) != "invalid":
            sickrage.app.config.naming_sports_pattern = naming_sports_pattern
        else:
            results.append(
                _("You tried saving an invalid sports naming config, not saving your sports settings"
                  ))

        sickrage.app.metadata_providers['kodi'].config = kodi_data
        sickrage.app.metadata_providers[
            'kodi_12plus'].config = kodi_12plus_data
        sickrage.app.metadata_providers[
            'mediabrowser'].config = mediabrowser_data
        sickrage.app.metadata_providers['sony_ps3'].config = sony_ps3_data
        sickrage.app.metadata_providers['wdtv'].config = wdtv_data
        sickrage.app.metadata_providers['tivo'].config = tivo_data
        sickrage.app.metadata_providers['mede8er'].config = mede8er_data

        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.warning(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'),
                                      '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(
                _('[POST-PROCESSING] Configuration Encrypted and Saved to disk'
                  ))

        return self.redirect("/config/postProcessing/")
Example #17
0
    def handle_post(self):
        use_subtitles = self.get_argument('use_subtitles', None)
        subtitles_dir = self.get_argument('subtitles_dir', None)
        service_order = self.get_argument('service_order', None)
        subtitles_history = self.get_argument('subtitles_history', None)
        subtitles_finder_frequency = self.get_argument('subtitles_finder_frequency', None)
        subtitles_multi = self.get_argument('subtitles_multi', None)
        embedded_subtitles_all = self.get_argument('embedded_subtitles_all', None)
        subtitles_extra_scripts = self.get_argument('subtitles_extra_scripts', '')
        subtitles_hearing_impaired = self.get_argument('subtitles_hearing_impaired', None)
        itasa_user = self.get_argument('itasa_user', None)
        itasa_pass = self.get_argument('itasa_pass', None)
        addic7ed_user = self.get_argument('addic7ed_user', None)
        addic7ed_pass = self.get_argument('addic7ed_pass', None)
        legendastv_user = self.get_argument('legendastv_user', None)
        legendastv_pass = self.get_argument('legendastv_pass', None)
        opensubtitles_user = self.get_argument('opensubtitles_user', None)
        opensubtitles_pass = self.get_argument('opensubtitles_pass', None)
        subtitles_languages = self.get_arguments('subtitles_languages[]')

        results = []

        sickrage.app.config.change_subtitle_searcher_freq(subtitles_finder_frequency)
        sickrage.app.config.use_subtitles = checkbox_to_value(use_subtitles)
        sickrage.app.config.subtitles_dir = subtitles_dir
        sickrage.app.config.subtitles_history = checkbox_to_value(subtitles_history)
        sickrage.app.config.embedded_subtitles_all = checkbox_to_value(embedded_subtitles_all)
        sickrage.app.config.subtitles_hearing_impaired = checkbox_to_value(subtitles_hearing_impaired)
        sickrage.app.config.subtitles_multi = checkbox_to_value(subtitles_multi)
        sickrage.app.config.subtitles_extra_scripts = [x.strip() for x in subtitles_extra_scripts.split('|') if x.strip()]

        # Subtitle languages
        sickrage.app.config.subtitles_languages = subtitles_languages or ['eng']

        # 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))

        sickrage.app.config.subtitles_services_list = subtitles_services_list
        sickrage.app.config.subtitles_services_enabled = subtitles_services_enabled

        sickrage.app.config.addic7ed_user = addic7ed_user or ''
        sickrage.app.config.addic7ed_pass = addic7ed_pass or ''
        sickrage.app.config.legendastv_user = legendastv_user or ''
        sickrage.app.config.legendastv_pass = legendastv_pass or ''
        sickrage.app.config.itasa_user = itasa_user or ''
        sickrage.app.config.itasa_pass = itasa_pass or ''
        sickrage.app.config.opensubtitles_user = opensubtitles_user or ''
        sickrage.app.config.opensubtitles_pass = opensubtitles_pass or ''

        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(_('[SUBTITLES] Configuration Encrypted and Saved to disk'))

        return self.redirect("/config/subtitles/")
Example #18
0
    def post(self, *args, **kwargs):
        use_kodi = self.get_argument('use_kodi', None)
        kodi_always_on = self.get_argument('kodi_always_on', None)
        kodi_notify_onsnatch = self.get_argument('kodi_notify_onsnatch', None)
        kodi_notify_ondownload = self.get_argument('kodi_notify_ondownload', None)
        kodi_notify_onsubtitledownload = self.get_argument('kodi_notify_onsubtitledownload', None)
        kodi_update_onlyfirst = self.get_argument('kodi_update_onlyfirst', None)
        kodi_update_library = self.get_argument('kodi_update_library', None)
        kodi_update_full = self.get_argument('kodi_update_full', None)
        kodi_host = self.get_argument('kodi_host', None)
        kodi_username = self.get_argument('kodi_username', None)
        kodi_password = self.get_argument('kodi_password', None)
        use_plex = self.get_argument('use_plex', None)
        plex_notify_onsnatch = self.get_argument('plex_notify_onsnatch', None)
        plex_notify_ondownload = self.get_argument('plex_notify_ondownload', None)
        plex_notify_onsubtitledownload = self.get_argument('plex_notify_onsubtitledownload', None)
        plex_update_library = self.get_argument('plex_update_library', None)
        plex_server_host = self.get_argument('plex_server_host', None)
        plex_server_token = self.get_argument('plex_server_token', None)
        plex_host = self.get_argument('plex_host', None)
        plex_username = self.get_argument('plex_username', None)
        plex_password = self.get_argument('plex_password', None)
        use_emby = self.get_argument('use_emby', None)
        emby_notify_onsnatch = self.get_argument('emby_notify_onsnatch', None)
        emby_notify_ondownload = self.get_argument('emby_notify_ondownload', None)
        emby_notify_onsubtitledownload = self.get_argument('emby_notify_onsubtitledownload', None)
        emby_host = self.get_argument('emby_host', None)
        emby_apikey = self.get_argument('emby_apikey', None)
        use_growl = self.get_argument('use_growl', None)
        growl_notify_onsnatch = self.get_argument('growl_notify_onsnatch', None)
        growl_notify_ondownload = self.get_argument('growl_notify_ondownload', None)
        growl_notify_onsubtitledownload = self.get_argument('growl_notify_onsubtitledownload', None)
        growl_host = self.get_argument('growl_host', None)
        growl_password = self.get_argument('growl_password', None)
        use_freemobile = self.get_argument('use_freemobile', None)
        freemobile_notify_onsnatch = self.get_argument('freemobile_notify_onsnatch', None)
        freemobile_notify_ondownload = self.get_argument('freemobile_notify_ondownload', None)
        freemobile_notify_onsubtitledownload = self.get_argument('freemobile_notify_onsubtitledownload', None)
        freemobile_id = self.get_argument('freemobile_id', None)
        freemobile_apikey = self.get_argument('freemobile_apikey', None)
        use_telegram = self.get_argument('use_telegram', None)
        telegram_notify_onsnatch = self.get_argument('telegram_notify_onsnatch', None)
        telegram_notify_ondownload = self.get_argument('telegram_notify_ondownload', None)
        telegram_notify_onsubtitledownload = self.get_argument('telegram_notify_onsubtitledownload', None)
        telegram_id = self.get_argument('telegram_id', None)
        telegram_apikey = self.get_argument('telegram_apikey', None)
        use_join = self.get_argument('use_join', None)
        join_notify_onsnatch = self.get_argument('join_notify_onsnatch', None)
        join_notify_ondownload = self.get_argument('join_notify_ondownload', None)
        join_notify_onsubtitledownload = self.get_argument('join_notify_onsubtitledownload', None)
        join_id = self.get_argument('join_id', None)
        join_apikey = self.get_argument('join_apikey', None)
        use_prowl = self.get_argument('use_prowl', None)
        prowl_notify_onsnatch = self.get_argument('prowl_notify_onsnatch', None)
        prowl_notify_ondownload = self.get_argument('prowl_notify_ondownload', None)
        prowl_notify_onsubtitledownload = self.get_argument('prowl_notify_onsubtitledownload', None)
        prowl_api = self.get_argument('prowl_api', None)
        prowl_priority = self.get_argument('prowl_priority', 0)
        use_twitter = self.get_argument('use_twitter', None)
        twitter_notify_onsnatch = self.get_argument('twitter_notify_onsnatch', None)
        twitter_notify_ondownload = self.get_argument('twitter_notify_ondownload', None)
        twitter_notify_onsubtitledownload = self.get_argument('twitter_notify_onsubtitledownload', None)
        twitter_usedm = self.get_argument('twitter_usedm', None)
        twitter_dmto = self.get_argument('twitter_dmto', None)
        use_twilio = self.get_argument('use_twilio', None)
        twilio_notify_onsnatch = self.get_argument('twilio_notify_onsnatch', None)
        twilio_notify_ondownload = self.get_argument('twilio_notify_ondownload', None)
        twilio_notify_onsubtitledownload = self.get_argument('twilio_notify_onsubtitledownload', None)
        twilio_phone_sid = self.get_argument('twilio_phone_sid', None)
        twilio_account_sid = self.get_argument('twilio_account_sid', None)
        twilio_auth_token = self.get_argument('twilio_auth_token', None)
        twilio_to_number = self.get_argument('twilio_to_number', None)
        use_boxcar2 = self.get_argument('use_boxcar2', None)
        boxcar2_notify_onsnatch = self.get_argument('boxcar2_notify_onsnatch', None)
        boxcar2_notify_ondownload = self.get_argument('boxcar2_notify_ondownload', None)
        boxcar2_notify_onsubtitledownload = self.get_argument('boxcar2_notify_onsubtitledownload', None)
        boxcar2_accesstoken = self.get_argument('boxcar2_accesstoken', None)
        use_pushover = self.get_argument('use_pushover', None)
        pushover_notify_onsnatch = self.get_argument('pushover_notify_onsnatch', None)
        pushover_notify_ondownload = self.get_argument('pushover_notify_ondownload', None)
        pushover_notify_onsubtitledownload = self.get_argument('pushover_notify_onsubtitledownload', None)
        pushover_userkey = self.get_argument('pushover_userkey', None)
        pushover_apikey = self.get_argument('pushover_apikey', None)
        pushover_device = self.get_argument('pushover_device', None)
        pushover_sound = self.get_argument('pushover_sound', None)
        use_libnotify = self.get_argument('use_libnotify', None)
        libnotify_notify_onsnatch = self.get_argument('libnotify_notify_onsnatch', None)
        libnotify_notify_ondownload = self.get_argument('libnotify_notify_ondownload', None)
        libnotify_notify_onsubtitledownload = self.get_argument('libnotify_notify_onsubtitledownload', None)
        use_nmj = self.get_argument('use_nmj', None)
        nmj_host = self.get_argument('nmj_host', None)
        nmj_database = self.get_argument('nmj_database', None)
        nmj_mount = self.get_argument('nmj_mount', None)
        use_synoindex = self.get_argument('use_synoindex', None)
        use_nmjv2 = self.get_argument('use_nmjv2', None)
        nmjv2_host = self.get_argument('nmjv2_host', None)
        nmjv2_dbloc = self.get_argument('nmjv2_dbloc', None)
        nmjv2_database = self.get_argument('nmjv2_database', None)
        use_trakt = self.get_argument('use_trakt', None)
        trakt_username = self.get_argument('trakt_username', None)
        trakt_remove_watchlist = self.get_argument('trakt_remove_watchlist', None)
        trakt_sync_watchlist = self.get_argument('trakt_sync_watchlist', None)
        trakt_remove_show_from_sickrage = self.get_argument('trakt_remove_show_from_sickrage', None)
        trakt_method_add = self.get_argument('trakt_method_add', None)
        trakt_start_paused = self.get_argument('trakt_start_paused', None)
        trakt_use_recommended = self.get_argument('trakt_use_recommended', None)
        trakt_sync = self.get_argument('trakt_sync', None)
        trakt_sync_remove = self.get_argument('trakt_sync_remove', None)
        trakt_default_indexer = self.get_argument('trakt_default_indexer', None)
        trakt_remove_serieslist = self.get_argument('trakt_remove_serieslist', None)
        trakt_timeout = self.get_argument('trakt_timeout', None)
        trakt_blacklist_name = self.get_argument('trakt_blacklist_name', None)
        use_synologynotifier = self.get_argument('use_synologynotifier', None)
        synologynotifier_notify_onsnatch = self.get_argument('synologynotifier_notify_onsnatch', None)
        synologynotifier_notify_ondownload = self.get_argument('synologynotifier_notify_ondownload', None)
        synologynotifier_notify_onsubtitledownload = self.get_argument('synologynotifier_notify_onsubtitledownload', None)
        use_pytivo = self.get_argument('use_pytivo', None)
        pytivo_notify_onsnatch = self.get_argument('pytivo_notify_onsnatch', None)
        pytivo_notify_ondownload = self.get_argument('pytivo_notify_ondownload', None)
        pytivo_notify_onsubtitledownload = self.get_argument('pytivo_notify_onsubtitledownload', None)
        pytivo_update_library = self.get_argument('pytivo_update_library', None)
        pytivo_host = self.get_argument('pytivo_host', None)
        pytivo_share_name = self.get_argument('pytivo_share_name', None)
        pytivo_tivo_name = self.get_argument('pytivo_tivo_name', None)
        use_nma = self.get_argument('use_nma', None)
        nma_notify_onsnatch = self.get_argument('nma_notify_onsnatch', None)
        nma_notify_ondownload = self.get_argument('nma_notify_ondownload', None)
        nma_notify_onsubtitledownload = self.get_argument('nma_notify_onsubtitledownload', None)
        nma_api = self.get_argument('nma_api', None)
        nma_priority = self.get_argument('nma_priority', 0)
        use_pushalot = self.get_argument('use_pushalot', None)
        pushalot_notify_onsnatch = self.get_argument('pushalot_notify_onsnatch', None)
        pushalot_notify_ondownload = self.get_argument('pushalot_notify_ondownload', None)
        pushalot_notify_onsubtitledownload = self.get_argument('pushalot_notify_onsubtitledownload', None)
        pushalot_authorizationtoken = self.get_argument('pushalot_authorizationtoken', None)
        use_pushbullet = self.get_argument('use_pushbullet', None)
        pushbullet_notify_onsnatch = self.get_argument('pushbullet_notify_onsnatch', None)
        pushbullet_notify_ondownload = self.get_argument('pushbullet_notify_ondownload', None)
        pushbullet_notify_onsubtitledownload = self.get_argument('pushbullet_notify_onsubtitledownload', None)
        pushbullet_api = self.get_argument('pushbullet_api', None)
        pushbullet_device_list = self.get_argument('pushbullet_device_list', None)
        use_email = self.get_argument('use_email', None)
        email_notify_onsnatch = self.get_argument('email_notify_onsnatch', None)
        email_notify_ondownload = self.get_argument('email_notify_ondownload', None)
        email_notify_onsubtitledownload = self.get_argument('email_notify_onsubtitledownload', None)
        email_host = self.get_argument('email_host', None)
        email_port = self.get_argument('email_port', 25)
        email_from = self.get_argument('email_from', None)
        email_tls = self.get_argument('email_tls', None)
        email_user = self.get_argument('email_user', None)
        email_password = self.get_argument('email_password', None)
        email_list = self.get_argument('email_list', None)
        use_slack = self.get_argument('use_slack', None)
        slack_notify_onsnatch = self.get_argument('slack_notify_onsnatch', None)
        slack_notify_ondownload = self.get_argument('slack_notify_ondownload', None)
        slack_notify_onsubtitledownload = self.get_argument('slack_notify_onsubtitledownload', None)
        slack_webhook = self.get_argument('slack_webhook', None)
        use_discord = self.get_argument('use_discord', False)
        discord_notify_onsnatch = self.get_argument('discord_notify_onsnatch', None)
        discord_notify_ondownload = self.get_argument('discord_notify_ondownload', None)
        discord_notify_onsubtitledownload = self.get_argument('discord_notify_onsubtitledownload', None)
        discord_webhook = self.get_argument('discord_webhook', None)
        discord_name = self.get_argument('discord_name', None)
        discord_avatar_url = self.get_argument('discord_avatar_url', None)
        discord_tts = self.get_argument('discord_tts', None)

        results = []

        sickrage.app.config.use_kodi = checkbox_to_value(use_kodi)
        sickrage.app.config.kodi_always_on = checkbox_to_value(kodi_always_on)
        sickrage.app.config.kodi_notify_onsnatch = checkbox_to_value(kodi_notify_onsnatch)
        sickrage.app.config.kodi_notify_ondownload = checkbox_to_value(kodi_notify_ondownload)
        sickrage.app.config.kodi_notify_onsubtitledownload = checkbox_to_value(kodi_notify_onsubtitledownload)
        sickrage.app.config.kodi_update_library = checkbox_to_value(kodi_update_library)
        sickrage.app.config.kodi_update_full = checkbox_to_value(kodi_update_full)
        sickrage.app.config.kodi_update_onlyfirst = checkbox_to_value(kodi_update_onlyfirst)
        sickrage.app.config.kodi_host = clean_hosts(kodi_host)
        sickrage.app.config.kodi_username = kodi_username
        sickrage.app.config.kodi_password = kodi_password

        sickrage.app.config.use_plex = checkbox_to_value(use_plex)
        sickrage.app.config.plex_notify_onsnatch = checkbox_to_value(plex_notify_onsnatch)
        sickrage.app.config.plex_notify_ondownload = checkbox_to_value(plex_notify_ondownload)
        sickrage.app.config.plex_notify_onsubtitledownload = checkbox_to_value(plex_notify_onsubtitledownload)
        sickrage.app.config.plex_update_library = checkbox_to_value(plex_update_library)
        sickrage.app.config.plex_host = clean_hosts(plex_host)
        sickrage.app.config.plex_server_host = clean_hosts(plex_server_host)
        sickrage.app.config.plex_server_token = clean_host(plex_server_token)
        sickrage.app.config.plex_username = plex_username
        sickrage.app.config.plex_password = plex_password
        sickrage.app.config.use_plex_client = checkbox_to_value(use_plex)
        sickrage.app.config.plex_client_username = plex_username
        sickrage.app.config.plex_client_password = plex_password

        sickrage.app.config.use_emby = checkbox_to_value(use_emby)
        sickrage.app.config.emby_notify_onsnatch = checkbox_to_value(emby_notify_onsnatch)
        sickrage.app.config.emby_notify_ondownload = checkbox_to_value(emby_notify_ondownload)
        sickrage.app.config.emby_notify_onsubtitledownload = checkbox_to_value(emby_notify_onsubtitledownload)
        sickrage.app.config.emby_host = clean_host(emby_host)
        sickrage.app.config.emby_apikey = emby_apikey

        sickrage.app.config.use_growl = checkbox_to_value(use_growl)
        sickrage.app.config.growl_notify_onsnatch = checkbox_to_value(growl_notify_onsnatch)
        sickrage.app.config.growl_notify_ondownload = checkbox_to_value(growl_notify_ondownload)
        sickrage.app.config.growl_notify_onsubtitledownload = checkbox_to_value(growl_notify_onsubtitledownload)
        sickrage.app.config.growl_host = clean_host(growl_host, default_port=23053)
        sickrage.app.config.growl_password = growl_password

        sickrage.app.config.use_freemobile = checkbox_to_value(use_freemobile)
        sickrage.app.config.freemobile_notify_onsnatch = checkbox_to_value(freemobile_notify_onsnatch)
        sickrage.app.config.freemobile_notify_ondownload = checkbox_to_value(freemobile_notify_ondownload)
        sickrage.app.config.freemobile_notify_onsubtitledownload = checkbox_to_value(freemobile_notify_onsubtitledownload)
        sickrage.app.config.freemobile_id = freemobile_id
        sickrage.app.config.freemobile_apikey = freemobile_apikey

        sickrage.app.config.use_telegram = checkbox_to_value(use_telegram)
        sickrage.app.config.telegram_notify_onsnatch = checkbox_to_value(telegram_notify_onsnatch)
        sickrage.app.config.telegram_notify_ondownload = checkbox_to_value(telegram_notify_ondownload)
        sickrage.app.config.telegram_notify_onsubtitledownload = checkbox_to_value(telegram_notify_onsubtitledownload)
        sickrage.app.config.telegram_id = telegram_id
        sickrage.app.config.telegram_apikey = telegram_apikey

        sickrage.app.config.use_join = checkbox_to_value(use_join)
        sickrage.app.config.join_notify_onsnatch = checkbox_to_value(join_notify_onsnatch)
        sickrage.app.config.join_notify_ondownload = checkbox_to_value(join_notify_ondownload)
        sickrage.app.config.join_notify_onsubtitledownload = checkbox_to_value(join_notify_onsubtitledownload)
        sickrage.app.config.join_id = join_id
        sickrage.app.config.join_apikey = join_apikey

        sickrage.app.config.use_prowl = checkbox_to_value(use_prowl)
        sickrage.app.config.prowl_notify_onsnatch = checkbox_to_value(prowl_notify_onsnatch)
        sickrage.app.config.prowl_notify_ondownload = checkbox_to_value(prowl_notify_ondownload)
        sickrage.app.config.prowl_notify_onsubtitledownload = checkbox_to_value(prowl_notify_onsubtitledownload)
        sickrage.app.config.prowl_api = prowl_api
        sickrage.app.config.prowl_priority = prowl_priority

        sickrage.app.config.use_twitter = checkbox_to_value(use_twitter)
        sickrage.app.config.twitter_notify_onsnatch = checkbox_to_value(twitter_notify_onsnatch)
        sickrage.app.config.twitter_notify_ondownload = checkbox_to_value(twitter_notify_ondownload)
        sickrage.app.config.twitter_notify_onsubtitledownload = checkbox_to_value(twitter_notify_onsubtitledownload)
        sickrage.app.config.twitter_usedm = checkbox_to_value(twitter_usedm)
        sickrage.app.config.twitter_dmto = twitter_dmto

        sickrage.app.config.use_twilio = checkbox_to_value(use_twilio)
        sickrage.app.config.twilio_notify_onsnatch = checkbox_to_value(twilio_notify_onsnatch)
        sickrage.app.config.twilio_notify_ondownload = checkbox_to_value(twilio_notify_ondownload)
        sickrage.app.config.twilio_notify_onsubtitledownload = checkbox_to_value(twilio_notify_onsubtitledownload)
        sickrage.app.config.twilio_phone_sid = twilio_phone_sid
        sickrage.app.config.twilio_account_sid = twilio_account_sid
        sickrage.app.config.twilio_auth_token = twilio_auth_token
        sickrage.app.config.twilio_to_number = twilio_to_number

        sickrage.app.config.use_slack = checkbox_to_value(use_slack)
        sickrage.app.config.slack_notify_onsnatch = checkbox_to_value(slack_notify_onsnatch)
        sickrage.app.config.slack_notify_ondownload = checkbox_to_value(slack_notify_ondownload)
        sickrage.app.config.slack_notify_onsubtitledownload = checkbox_to_value(slack_notify_onsubtitledownload)
        sickrage.app.config.slack_webhook = slack_webhook

        sickrage.app.config.use_discord = checkbox_to_value(use_discord)
        sickrage.app.config.discord_notify_onsnatch = checkbox_to_value(discord_notify_onsnatch)
        sickrage.app.config.discord_notify_ondownload = checkbox_to_value(discord_notify_ondownload)
        sickrage.app.config.discord_notify_onsubtitledownload = checkbox_to_value(discord_notify_onsubtitledownload)
        sickrage.app.config.discord_webhook = discord_webhook
        sickrage.app.config.discord_name = discord_name
        sickrage.app.config.discord_avatar_url = discord_avatar_url
        sickrage.app.config.discord_tts = checkbox_to_value(discord_tts)

        sickrage.app.config.use_boxcar2 = checkbox_to_value(use_boxcar2)
        sickrage.app.config.boxcar2_notify_onsnatch = checkbox_to_value(boxcar2_notify_onsnatch)
        sickrage.app.config.boxcar2_notify_ondownload = checkbox_to_value(boxcar2_notify_ondownload)
        sickrage.app.config.boxcar2_notify_onsubtitledownload = checkbox_to_value(boxcar2_notify_onsubtitledownload)
        sickrage.app.config.boxcar2_accesstoken = boxcar2_accesstoken

        sickrage.app.config.use_pushover = checkbox_to_value(use_pushover)
        sickrage.app.config.pushover_notify_onsnatch = checkbox_to_value(pushover_notify_onsnatch)
        sickrage.app.config.pushover_notify_ondownload = checkbox_to_value(pushover_notify_ondownload)
        sickrage.app.config.pushover_notify_onsubtitledownload = checkbox_to_value(pushover_notify_onsubtitledownload)
        sickrage.app.config.pushover_userkey = pushover_userkey
        sickrage.app.config.pushover_apikey = pushover_apikey
        sickrage.app.config.pushover_device = pushover_device
        sickrage.app.config.pushover_sound = pushover_sound

        sickrage.app.config.use_libnotify = checkbox_to_value(use_libnotify)
        sickrage.app.config.libnotify_notify_onsnatch = checkbox_to_value(libnotify_notify_onsnatch)
        sickrage.app.config.libnotify_notify_ondownload = checkbox_to_value(libnotify_notify_ondownload)
        sickrage.app.config.libnotify_notify_onsubtitledownload = checkbox_to_value(libnotify_notify_onsubtitledownload)

        sickrage.app.config.use_nmj = checkbox_to_value(use_nmj)
        sickrage.app.config.nmj_host = clean_host(nmj_host)
        sickrage.app.config.nmj_database = nmj_database
        sickrage.app.config.nmj_mount = nmj_mount

        sickrage.app.config.use_nmjv2 = checkbox_to_value(use_nmjv2)
        sickrage.app.config.nmjv2_host = clean_host(nmjv2_host)
        sickrage.app.config.nmjv2_database = nmjv2_database
        sickrage.app.config.nmjv2_dbloc = nmjv2_dbloc

        sickrage.app.config.use_synoindex = checkbox_to_value(use_synoindex)

        sickrage.app.config.use_synologynotifier = checkbox_to_value(use_synologynotifier)
        sickrage.app.config.synologynotifier_notify_onsnatch = checkbox_to_value(synologynotifier_notify_onsnatch)
        sickrage.app.config.synologynotifier_notify_ondownload = checkbox_to_value(synologynotifier_notify_ondownload)
        sickrage.app.config.synologynotifier_notify_onsubtitledownload = checkbox_to_value(synologynotifier_notify_onsubtitledownload)

        sickrage.app.config.use_trakt = checkbox_to_value(use_trakt)
        sickrage.app.config.trakt_username = trakt_username
        sickrage.app.config.trakt_remove_watchlist = checkbox_to_value(trakt_remove_watchlist)
        sickrage.app.config.trakt_remove_serieslist = checkbox_to_value(trakt_remove_serieslist)
        sickrage.app.config.trakt_remove_show_from_sickrage = checkbox_to_value(trakt_remove_show_from_sickrage)
        sickrage.app.config.trakt_sync_watchlist = checkbox_to_value(trakt_sync_watchlist)
        sickrage.app.config.trakt_method_add = int(trakt_method_add)
        sickrage.app.config.trakt_start_paused = checkbox_to_value(trakt_start_paused)
        sickrage.app.config.trakt_use_recommended = checkbox_to_value(trakt_use_recommended)
        sickrage.app.config.trakt_sync = checkbox_to_value(trakt_sync)
        sickrage.app.config.trakt_sync_remove = checkbox_to_value(trakt_sync_remove)
        sickrage.app.config.trakt_default_indexer = int(trakt_default_indexer)
        sickrage.app.config.trakt_timeout = int(trakt_timeout)
        sickrage.app.config.trakt_blacklist_name = trakt_blacklist_name

        sickrage.app.config.use_email = checkbox_to_value(use_email)
        sickrage.app.config.email_notify_onsnatch = checkbox_to_value(email_notify_onsnatch)
        sickrage.app.config.email_notify_ondownload = checkbox_to_value(email_notify_ondownload)
        sickrage.app.config.email_notify_onsubtitledownload = checkbox_to_value(email_notify_onsubtitledownload)
        sickrage.app.config.email_host = clean_host(email_host)
        sickrage.app.config.email_port = try_int(email_port, 25)
        sickrage.app.config.email_from = email_from
        sickrage.app.config.email_tls = checkbox_to_value(email_tls)
        sickrage.app.config.email_user = email_user
        sickrage.app.config.email_password = email_password
        sickrage.app.config.email_list = email_list

        sickrage.app.config.use_pytivo = checkbox_to_value(use_pytivo)
        sickrage.app.config.pytivo_notify_onsnatch = checkbox_to_value(pytivo_notify_onsnatch)
        sickrage.app.config.pytivo_notify_ondownload = checkbox_to_value(pytivo_notify_ondownload)
        sickrage.app.config.pytivo_notify_onsubtitledownload = checkbox_to_value(pytivo_notify_onsubtitledownload)
        sickrage.app.config.pytivo_update_library = checkbox_to_value(pytivo_update_library)
        sickrage.app.config.pytivo_host = clean_host(pytivo_host)
        sickrage.app.config.pytivo_share_name = pytivo_share_name
        sickrage.app.config.pytivo_tivo_name = pytivo_tivo_name

        sickrage.app.config.use_nma = checkbox_to_value(use_nma)
        sickrage.app.config.nma_notify_onsnatch = checkbox_to_value(nma_notify_onsnatch)
        sickrage.app.config.nma_notify_ondownload = checkbox_to_value(nma_notify_ondownload)
        sickrage.app.config.nma_notify_onsubtitledownload = checkbox_to_value(nma_notify_onsubtitledownload)
        sickrage.app.config.nma_api = nma_api
        sickrage.app.config.nma_priority = nma_priority

        sickrage.app.config.use_pushalot = checkbox_to_value(use_pushalot)
        sickrage.app.config.pushalot_notify_onsnatch = checkbox_to_value(pushalot_notify_onsnatch)
        sickrage.app.config.pushalot_notify_ondownload = checkbox_to_value(pushalot_notify_ondownload)
        sickrage.app.config.pushalot_notify_onsubtitledownload = checkbox_to_value(pushalot_notify_onsubtitledownload)
        sickrage.app.config.pushalot_authorizationtoken = pushalot_authorizationtoken

        sickrage.app.config.use_pushbullet = checkbox_to_value(use_pushbullet)
        sickrage.app.config.pushbullet_notify_onsnatch = checkbox_to_value(pushbullet_notify_onsnatch)
        sickrage.app.config.pushbullet_notify_ondownload = checkbox_to_value(pushbullet_notify_ondownload)
        sickrage.app.config.pushbullet_notify_onsubtitledownload = checkbox_to_value(pushbullet_notify_onsubtitledownload)
        sickrage.app.config.pushbullet_api = pushbullet_api
        sickrage.app.config.pushbullet_device = pushbullet_device_list

        sickrage.app.config.save()

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'), '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(_('[NOTIFICATIONS] Configuration Encrypted and Saved to disk'))

        return self.redirect("/config/notifications/")
Example #19
0
    async def post(self, *args, **kwargs):
        """
        Receives a dir list and add them. Adds the ones with given TVDB IDs first, then forwards
        along to the newShow page.
        """
        shows_to_add = self.get_arguments('shows_to_add')
        prompt_for_settings = self.get_argument('promptForSettings')

        # grab a list of other shows to add, if provided
        shows_to_add = [unquote_plus(x) for x in shows_to_add]

        prompt_for_settings = checkbox_to_value(prompt_for_settings)

        indexer_id_given = []
        dirs_only = []
        # separate all the ones with Indexer IDs
        for cur_dir in shows_to_add:
            split_vals = cur_dir.split('|')
            if split_vals:
                if len(split_vals) > 2:
                    indexer, show_dir, indexer_id, show_name = split_extra_show(
                        cur_dir)
                    if all([show_dir, indexer_id, show_name]):
                        indexer_id_given.append((int(indexer), show_dir,
                                                 int(indexer_id), show_name))
                else:
                    dirs_only.append(cur_dir)
            else:
                dirs_only.append(cur_dir)

        # if they want me to prompt for settings then I will just carry on to the newShow page
        if prompt_for_settings and shows_to_add:
            response = await TornadoHTTP().get(
                self.get_url("/home/addShows/newShow?" + urlencode(
                    {
                        'show_to_add': shows_to_add[0],
                        'other_shows': shows_to_add[1:]
                    }, True)))

            return self.write(response.body)

        # if they don't want me to prompt for settings then I can just add all the nfo shows now
        num_added = 0
        for cur_show in indexer_id_given:
            indexer, show_dir, indexer_id, show_name = cur_show

            if indexer is not None and indexer_id is not None:
                # add the show
                sickrage.app.show_queue.add_show(
                    indexer,
                    indexer_id,
                    show_dir,
                    default_status=sickrage.app.config.status_default,
                    quality=sickrage.app.config.quality_default,
                    flatten_folders=sickrage.app.config.
                    flatten_folders_default,
                    subtitles=sickrage.app.config.subtitles_default,
                    anime=sickrage.app.config.anime_default,
                    scene=sickrage.app.config.scene_default,
                    default_status_after=sickrage.app.config.
                    status_default_after,
                    skip_downloaded=sickrage.app.config.skip_downloaded_default
                )
                num_added += 1

        if num_added:
            sickrage.app.alerts.message(
                _("Shows Added"),
                _("Automatically added ") + str(num_added) +
                _(" from their existing metadata files"))

        # if we're done then go home
        if not dirs_only:
            return self.redirect('/home/')

        # for the remaining shows we need to prompt for each one, so forward this on to the newShow page
        response = await TornadoHTTP().get(
            self.get_url("/home/addShows/newShow?" + urlencode(
                {
                    'show_to_add': dirs_only[0],
                    'other_shows': dirs_only[1:]
                }, True)))

        return self.write(response.body)
Example #20
0
    def post(self, *args, **kwargs):
        log_nr = self.get_argument('log_nr', '5')
        log_size = self.get_argument('log_size', '1048576')
        web_port = self.get_argument('web_port', None)
        web_ipv6 = self.get_argument('web_ipv6', None)
        web_host = self.get_argument('web_host', None)
        trash_remove_show = self.get_argument('trash_remove_show', None)
        trash_rotate_logs = self.get_argument('trash_rotate_logs', None)
        update_frequency = self.get_argument('update_frequency', None)
        skip_removed_files = self.get_argument('skip_removed_files', None)
        series_provider_default_language = self.get_argument(
            'series_provider_default_language', 'en')
        ep_default_deleted_status = self.get_argument(
            'ep_default_deleted_status', None)
        launch_browser = self.get_argument('launch_browser', None)
        show_update_hour = self.get_argument('show_update_hour', '3')
        api_key = self.get_argument('api_key', None)
        series_provider_default = self.get_argument('series_provider_default',
                                                    None)
        timezone_display = self.get_argument('timezone_display', None)
        cpu_preset = self.get_argument('cpu_preset', 'NORMAL')
        version_notify = self.get_argument('version_notify', None)
        enable_https = self.get_argument('enable_https', None)
        https_cert = self.get_argument('https_cert', None)
        https_key = self.get_argument('https_key', None)
        handle_reverse_proxy = self.get_argument('handle_reverse_proxy', None)
        sort_article = self.get_argument('sort_article', None)
        auto_update = self.get_argument('auto_update', None)
        notify_on_update = self.get_argument('notify_on_update', None)
        backup_on_update = self.get_argument('backup_on_update', None)
        proxy_setting = self.get_argument('proxy_setting', None)
        proxy_series_providers = self.get_argument('proxy_series_providers',
                                                   None)
        anon_redirect = self.get_argument('anon_redirect', None)
        git_path = self.get_argument('git_path', None)
        pip3_path = self.get_argument('pip3_path', None)
        calendar_unprotected = self.get_argument('calendar_unprotected', None)
        calendar_icons = self.get_argument('calendar_icons', None)
        debug = self.get_argument('debug', None)
        ssl_verify = self.get_argument('ssl_verify', None)
        no_restart = self.get_argument('no_restart', None)
        coming_eps_missed_range = self.get_argument('coming_eps_missed_range',
                                                    None)
        filter_row = self.get_argument('filter_row', None)
        fuzzy_dating = self.get_argument('fuzzy_dating', None)
        trim_zero = self.get_argument('trim_zero', None)
        date_preset = self.get_argument('date_preset', None)
        time_preset = self.get_argument('time_preset', None)
        series_provider_timeout = self.get_argument('series_provider_timeout',
                                                    None)
        download_url = self.get_argument('download_url', None)
        theme_name = self.get_argument('theme_name', None)
        default_page = self.get_argument('default_page', None)
        gui_language = self.get_argument('gui_language', None)
        display_all_seasons = self.get_argument('display_all_seasons', None)
        show_update_stale = self.get_argument('show_update_stale', None)
        notify_on_login = self.get_argument('notify_on_login', None)
        allowed_video_file_exts = self.get_argument('allowed_video_file_exts',
                                                    '')
        enable_upnp = self.get_argument('enable_upnp', None)
        strip_special_file_bits = self.get_argument('strip_special_file_bits',
                                                    None)
        max_queue_workers = self.get_argument('max_queue_workers', None)
        web_root = self.get_argument('web_root', '')
        ip_whitelist_localhost_enabled = self.get_argument(
            'ip_whitelist_localhost_enabled', None)
        ip_whitelist_enabled = self.get_argument('ip_whitelist_enabled', None)
        ip_whitelist = self.get_argument('ip_whitelist', '')
        web_auth_method = self.get_argument('web_auth_method', '')
        web_username = self.get_argument('web_username', '')
        web_password = self.get_argument('web_password', '')
        enable_sickrage_api = self.get_argument('enable_sickrage_api', None)

        results = []

        change_gui_lang(gui_language)
        change_show_update_hour(show_update_hour)
        change_version_notify(checkbox_to_value(version_notify))

        # Debug
        sickrage.app.config.general.debug = sickrage.app.debug = checkbox_to_value(
            debug)
        sickrage.app.log.set_level()

        # Misc
        sickrage.app.config.general.enable_upnp = checkbox_to_value(
            enable_upnp)
        sickrage.app.config.general.download_url = download_url
        sickrage.app.config.general.series_provider_default_language = series_provider_default_language
        sickrage.app.config.general.ep_default_deleted_status = EpisodeStatus[
            ep_default_deleted_status]
        sickrage.app.config.general.skip_removed_files = checkbox_to_value(
            skip_removed_files)
        sickrage.app.config.general.launch_browser = checkbox_to_value(
            launch_browser)
        sickrage.app.config.general.auto_update = checkbox_to_value(
            auto_update)
        sickrage.app.config.general.notify_on_update = checkbox_to_value(
            notify_on_update)
        sickrage.app.config.general.backup_on_update = checkbox_to_value(
            backup_on_update)
        sickrage.app.config.general.notify_on_login = checkbox_to_value(
            notify_on_login)
        sickrage.app.config.general.show_update_stale = checkbox_to_value(
            show_update_stale)
        sickrage.app.config.general.log_nr = int(log_nr)
        sickrage.app.config.general.log_size = int(log_size)

        sickrage.app.config.general.trash_remove_show = checkbox_to_value(
            trash_remove_show)
        sickrage.app.config.general.trash_rotate_logs = checkbox_to_value(
            trash_rotate_logs)
        sickrage.app.config.general.launch_browser = checkbox_to_value(
            launch_browser)
        sickrage.app.config.general.sort_article = checkbox_to_value(
            sort_article)
        sickrage.app.config.general.cpu_preset = CpuPreset[cpu_preset]
        sickrage.app.config.general.anon_redirect = anon_redirect
        sickrage.app.config.general.proxy_setting = proxy_setting
        sickrage.app.config.general.proxy_series_providers = checkbox_to_value(
            proxy_series_providers)
        sickrage.app.config.general.git_reset = 1
        sickrage.app.config.general.git_path = git_path
        sickrage.app.config.general.pip3_path = pip3_path
        sickrage.app.config.general.calendar_unprotected = checkbox_to_value(
            calendar_unprotected)
        sickrage.app.config.general.calendar_icons = checkbox_to_value(
            calendar_icons)
        sickrage.app.config.general.no_restart = checkbox_to_value(no_restart)

        sickrage.app.config.general.ssl_verify = checkbox_to_value(ssl_verify)
        sickrage.app.config.gui.coming_eps_missed_range = try_int(
            coming_eps_missed_range, 7)
        sickrage.app.config.general.display_all_seasons = checkbox_to_value(
            display_all_seasons)

        sickrage.app.config.general.web_port = int(web_port)
        sickrage.app.config.general.web_ipv6 = checkbox_to_value(web_ipv6)

        sickrage.app.config.gui.filter_row = checkbox_to_value(filter_row)
        sickrage.app.config.gui.fuzzy_dating = checkbox_to_value(fuzzy_dating)
        sickrage.app.config.gui.trim_zero = checkbox_to_value(trim_zero)

        sickrage.app.config.general.allowed_video_file_exts = ','.join(
            [x.lower() for x in allowed_video_file_exts.split(',')])

        sickrage.app.config.general.strip_special_file_bits = checkbox_to_value(
            strip_special_file_bits)

        sickrage.app.config.general.web_root = web_root

        sickrage.app.config.general.ip_whitelist_enabled = checkbox_to_value(
            ip_whitelist_enabled)
        sickrage.app.config.general.ip_whitelist_localhost_enabled = checkbox_to_value(
            ip_whitelist_localhost_enabled)
        sickrage.app.config.general.ip_whitelist = ip_whitelist

        if web_auth_method == 'sso_auth':
            auth_method_changed = not sickrage.app.config.general.sso_auth_enabled
            sickrage.app.config.general.sso_auth_enabled = True
            sickrage.app.config.general.local_auth_enabled = False
        else:
            auth_method_changed = not sickrage.app.config.general.local_auth_enabled
            sickrage.app.config.general.sso_auth_enabled = False
            sickrage.app.config.general.local_auth_enabled = True
            sickrage.app.config.user.username = web_username
            sickrage.app.config.user.password = web_password

        sickrage.app.config.general.enable_sickrage_api = checkbox_to_value(
            enable_sickrage_api)

        # change_web_external_port(web_external_port)

        if date_preset:
            sickrage.app.config.gui.date_preset = date_preset

        if series_provider_default:
            sickrage.app.config.general.series_provider_default = SeriesProviderID[
                series_provider_default]

        if series_provider_timeout:
            sickrage.app.config.general.series_provider_timeout = try_int(
                series_provider_timeout)

        if time_preset:
            sickrage.app.config.gui.time_preset_w_seconds = time_preset
            sickrage.app.config.gui.time_preset = sickrage.app.config.gui.time_preset_w_seconds.replace(
                ":%S", "")

        sickrage.app.config.gui.timezone_display = TimezoneDisplay[
            timezone_display]

        sickrage.app.config.general.api_v1_key = api_key

        sickrage.app.config.general.enable_https = checkbox_to_value(
            enable_https)

        # if not change_https_cert(https_cert):
        #     results += ["Unable to create directory " + os.path.normpath(https_cert) + ", https cert directory not changed."]
        #
        # if not change_https_key(https_key):
        #     results += ["Unable to create directory " + os.path.normpath(https_key) + ", https key directory not changed."]

        sickrage.app.config.general.handle_reverse_proxy = checkbox_to_value(
            handle_reverse_proxy)

        sickrage.app.config.gui.theme_name = UITheme[theme_name]

        sickrage.app.config.general.default_page = DefaultHomePage[
            default_page]

        sickrage.app.config.general.max_queue_workers = try_int(
            max_queue_workers)

        sickrage.app.config.save()

        if auth_method_changed:
            return self.redirect('/logout')

        if len(results) > 0:
            [sickrage.app.log.error(x) for x in results]
            sickrage.app.alerts.error(_('Error(s) Saving Configuration'),
                                      '<br>\n'.join(results))
        else:
            sickrage.app.alerts.message(
                _('[GENERAL] Configuration Saved to Database'))

        return self.redirect("/config/general/")