From 0c51d9403a64220f3387ea261bb26d52f8721c3b Mon Sep 17 00:00:00 2001 From: Nils Vogels <bacardicoke@gmail.com> Date: Sat, 25 Jul 2015 02:12:52 +0200 Subject: [PATCH] Adds saving history limit, fixes https://github.com/SiCKRAGETV/sickrage-issues/issues/1812 --- gui/slick/interfaces/default/history.tmpl | 11 ++++++----- sickbeard/__init__.py | 5 ++++- sickbeard/webserve.py | 9 +++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/gui/slick/interfaces/default/history.tmpl b/gui/slick/interfaces/default/history.tmpl index 9a1fc75c1..0babb59b8 100644 --- a/gui/slick/interfaces/default/history.tmpl +++ b/gui/slick/interfaces/default/history.tmpl @@ -12,6 +12,7 @@ #set global $sbPath=".." #set global $topmenu="history"# #set $layout = $sickbeard.HISTORY_LAYOUT +#set $history_limit = $sickbeard.HISTORY_LIMIT #include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_top.tmpl") @@ -87,11 +88,11 @@ <h1 class="title">$title</h1> #end if <div class="h2footer pull-right"><b>Limit:</b> - <select name="limit" id="limit" class="form-control form-control-inline input-sm"> - <option value="100" #if $limit == "100" then "selected=\"selected\"" else ""#>100</option> - <option value="250" #if $limit == "250" then "selected=\"selected\"" else ""#>250</option> - <option value="500" #if $limit == "500" then "selected=\"selected\"" else ""#>500</option> - <option value="0" #if $limit == "0" then "selected=\"selected\"" else ""#>All</option> + <select name="history_limit" id="history_limit" class="form-control form-control-inline input-sm" onchange="location = this.options[this.selectedIndex].value;"> + <option value="$sbRoot/setHistoryLimit/?history_limit=100" #if $history_limit == "100" then "selected=\"selected\"" else ""#>100</option> + <option value="$sbRoot/setHistoryLimit/?history_limit=250" #if $history_limit == "250" then "selected=\"selected\"" else ""#>250</option> + <option value="$sbRoot/setHistoryLimit/?history_limit=500" #if $history_limit == "500" then "selected=\"selected\"" else ""#>500</option> + <option value="$sbRoot/setHistoryLimit/?history_limit=0" #if $history_limit == "0" then "selected=\"selected\"" else ""#>All</option> </select> diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index e81ec3161..44ad39196 100644 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -487,6 +487,7 @@ EMAIL_LIST = None GUI_NAME = None HOME_LAYOUT = None HISTORY_LAYOUT = None +HISTORY_LIMIT = 0 DISPLAY_SHOW_SPECIALS = False COMING_EPS_LAYOUT = None COMING_EPS_DISPLAY_PAUSED = False @@ -583,7 +584,7 @@ def initialize(consoleLogging=True): USE_LISTVIEW, METADATA_KODI, METADATA_KODI_12PLUS, METADATA_MEDIABROWSER, METADATA_PS3, metadata_provider_dict, \ NEWZBIN, NEWZBIN_USERNAME, NEWZBIN_PASSWORD, GIT_PATH, MOVE_ASSOCIATED_FILES, SYNC_FILES, POSTPONE_IF_SYNC_FILES, dailySearchScheduler, NFO_RENAME, \ GUI_NAME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, COMING_EPS_LAYOUT, COMING_EPS_SORT, COMING_EPS_DISPLAY_PAUSED, COMING_EPS_MISSED_RANGE, DISPLAY_FILESIZE, FUZZY_DATING, TRIM_ZERO, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, THEME_NAME, FILTER_ROW, \ - POSTER_SORTBY, POSTER_SORTDIR, \ + POSTER_SORTBY, POSTER_SORTDIR, HISTORY_LIMIT, \ METADATA_WDTV, METADATA_TIVO, METADATA_MEDE8ER, IGNORE_WORDS, REQUIRE_WORDS, CALENDAR_UNPROTECTED, NO_RESTART, CREATE_MISSING_SHOW_DIRS, \ ADD_SHOWS_WO_DIR, USE_SUBTITLES, SUBTITLES_LANGUAGES, SUBTITLES_DIR, SUBTITLES_SERVICES_LIST, SUBTITLES_SERVICES_ENABLED, SUBTITLES_HISTORY, SUBTITLES_FINDER_FREQUENCY, SUBTITLES_MULTI, EMBEDDED_SUBTITLES_ALL, SUBTITLES_EXTRA_SCRIPTS, subtitlesFinderScheduler, \ USE_FAILED_DOWNLOADS, DELETE_FAILED, ANON_REDIRECT, LOCALHOST_IP, TMDB_API_KEY, DEBUG, DEFAULT_PAGE, PROXY_SETTING, PROXY_INDEXERS, \ @@ -1143,6 +1144,7 @@ def initialize(consoleLogging=True): HOME_LAYOUT = check_setting_str(CFG, 'GUI', 'home_layout', 'poster') HISTORY_LAYOUT = check_setting_str(CFG, 'GUI', 'history_layout', 'detailed') + HISTORY_LIMIT = check_setting_str(CFG, 'GUI', 'history_limit', '100') DISPLAY_SHOW_SPECIALS = bool(check_setting_int(CFG, 'GUI', 'display_show_specials', 1)) COMING_EPS_LAYOUT = check_setting_str(CFG, 'GUI', 'coming_eps_layout', 'banner') COMING_EPS_DISPLAY_PAUSED = bool(check_setting_int(CFG, 'GUI', 'coming_eps_display_paused', 0)) @@ -2077,6 +2079,7 @@ def save_config(): new_config['GUI']['theme_name'] = THEME_NAME new_config['GUI']['home_layout'] = HOME_LAYOUT new_config['GUI']['history_layout'] = HISTORY_LAYOUT + new_config['GUI']['history_limit'] = HISTORY_LIMIT new_config['GUI']['display_show_specials'] = int(DISPLAY_SHOW_SPECIALS) new_config['GUI']['coming_eps_layout'] = COMING_EPS_LAYOUT new_config['GUI']['coming_eps_display_paused'] = int(COMING_EPS_DISPLAY_PAUSED) diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index ffa29e2d5..86117ceb4 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -458,6 +458,15 @@ class WebRoot(WebHandler): return self.redirect("/history/") + def setHistoryLimit(self, history_limit): + + if not int(history_limit): + history_limit = 100 + + sickbeard.HISTORY_LIMIT = history_limit + + return self.redirect("/history/") + def toggleDisplayShowSpecials(self, show): sickbeard.DISPLAY_SHOW_SPECIALS = not sickbeard.DISPLAY_SHOW_SPECIALS -- GitLab