Implement automatic saving of poster layout sorting options on show list

This commit is contained in:
Adam 2014-10-26 13:42:45 +08:00 committed by adam
parent 2707748219
commit 9903819ce0
4 changed files with 33 additions and 15 deletions

View File

@ -21,7 +21,7 @@
* Fix imdb and three other images rejected by IExplorer because they were corrupt. Turns out that they were .ico files renamed to either .gif or .png instead of being properly converted
* Fix "Subtitle Language" drop down font colour when entering text on the Subtitles Search settings
* Clean up text, correct quotations, use spaces for code lines, tabs for html
* Update changelog
* Implement automatic saving of poster layout sorting options on show list
### 0.2.1 (2014-10-22 06:41:00 UTC)

View File

@ -151,8 +151,8 @@
jQuery.each(\$container, function (j) {
this.isotope({
itemSelector: '.show',
sortBy : 'name',
sortAscending: 'true',
sortBy : '$sickbeard.POSTER_SORTBY',
sortAscending: $sickbeard.POSTER_SORTDIR,
layoutMode: 'masonry',
masonry: {
columnWidth: 12,
@ -168,13 +168,9 @@
#end if
},
network: '[data-network]',
date: function( itemElem ) {
date: function( itemElem ) {
var date = \$( itemElem ).attr('data-date');
if (sortDirection = 'true') {
return date.length && parseInt( date, 10 ) || Number.POSITIVE_INFINITY;
} else {
return date.length && parseInt( date, 10 ) * -1 || Number.POSITIVE_INFINITY;
}
return date.length && parseInt( date, 10 ) || Number.POSITIVE_INFINITY;
},
progress: function( itemElem ) {
var progress = \$( itemElem ).attr('data-progress');
@ -188,6 +184,7 @@
var sortValue = this.value;
\$('#container').isotope({ sortBy: sortValue });
\$('#container-anime').isotope({ sortBy: sortValue });
\$.get(this.options[this.selectedIndex].getAttribute('data-sort'));
});
\$('#postersortdirection').on( 'change', function() {
@ -195,6 +192,7 @@
sortDirection = sortDirection == 'true';
\$('#container').isotope({ sortAscending: sortDirection });
\$('#container-anime').isotope({ sortAscending: sortDirection });
\$.get(this.options[this.selectedIndex].getAttribute('data-sort'));
});
});
@ -222,17 +220,17 @@
 
<span> Sort By:
<select id="postersort" class="form-control form-control-inline input-sm">
<option value="name">Name</option>
<option value="date">Next Episode</option>
<option value="network">Network</option>
<option value="progress">Progress</option>
<option value="name" data-sort="$sbRoot/setPosterSortBy/?sort=name" #if $sickbeard.POSTER_SORTBY == "name" then "selected=\"selected\"" else ""#>Name</option>
<option value="date" data-sort="$sbRoot/setPosterSortBy/?sort=date" #if $sickbeard.POSTER_SORTBY == "date" then "selected=\"selected\"" else ""#>Next Episode</option>
<option value="network" data-sort="$sbRoot/setPosterSortBy/?sort=network" #if $sickbeard.POSTER_SORTBY == "network" then "selected=\"selected\"" else ""#>Network</option>
<option value="progress" data-sort="$sbRoot/setPosterSortBy/?sort=progress" #if $sickbeard.POSTER_SORTBY == "progress" then "selected=\"selected\"" else ""#>Progress</option>
</select>
</span>
&nbsp;
<span> Sort Order:
<select id="postersortdirection" class="form-control form-control-inline input-sm">
<option value="true">Asc</option>
<option value="false">Desc</option>
<option value="true" data-sort="$sbRoot/setPosterSortDir/?direction=1" #if $sickbeard.POSTER_SORTDIR == 1 then "selected=\"selected\"" else ""#>Asc</option>
<option value="false" data-sort="$sbRoot/setPosterSortDir/?direction=0" #if $sickbeard.POSTER_SORTDIR == 0 then "selected=\"selected\"" else ""#>Desc</option>
</select>
</span>
&nbsp;

View File

@ -428,6 +428,8 @@ TIME_PRESET = None
TIME_PRESET_W_SECONDS = None
TIMEZONE_DISPLAY = None
THEME_NAME = None
POSTER_SORTBY = None
POSTER_SORTDIR = None
USE_SUBTITLES = False
SUBTITLES_LANGUAGES = []
@ -496,6 +498,7 @@ def initialize(consoleLogging=True):
USE_LISTVIEW, METADATA_XBMC, METADATA_XBMC_12PLUS, METADATA_MEDIABROWSER, METADATA_PS3, metadata_provider_dict, \
NEWZBIN, NEWZBIN_USERNAME, NEWZBIN_PASSWORD, GIT_PATH, MOVE_ASSOCIATED_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, FUZZY_DATING, TRIM_ZERO, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, THEME_NAME, \
POSTER_SORTBY, POSTER_SORTDIR, \
METADATA_WDTV, METADATA_TIVO, METADATA_MEDE8ER, IGNORE_WORDS, REQUIRE_WORDS, CALENDAR_UNPROTECTED, 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, subtitlesFinderScheduler, \
USE_FAILED_DOWNLOADS, DELETE_FAILED, ANON_REDIRECT, LOCALHOST_IP, TMDB_API_KEY, DEBUG, PROXY_SETTING, PROXY_INDEXERS, \
@ -946,6 +949,8 @@ def initialize(consoleLogging=True):
TIME_PRESET_W_SECONDS = check_setting_str(CFG, 'GUI', 'time_preset', '%I:%M:%S %p')
TIME_PRESET = TIME_PRESET_W_SECONDS.replace(u":%S", u"")
TIMEZONE_DISPLAY = check_setting_str(CFG, 'GUI', 'timezone_display', 'network')
POSTER_SORTBY = check_setting_str(CFG, 'GUI', 'poster_sortby', 'name')
POSTER_SORTDIR = check_setting_int(CFG, 'GUI', 'poster_sortdir', 1)
# initialize NZB and TORRENT providers
providerList = providers.makeProviderList()
@ -1762,6 +1767,8 @@ def save_config():
new_config['GUI']['date_preset'] = DATE_PRESET
new_config['GUI']['time_preset'] = TIME_PRESET_W_SECONDS
new_config['GUI']['timezone_display'] = TIMEZONE_DISPLAY
new_config['GUI']['poster_sortby'] = POSTER_SORTBY
new_config['GUI']['poster_sortdir'] = POSTER_SORTDIR
new_config['Subtitles'] = {}
new_config['Subtitles']['use_subtitles'] = int(USE_SUBTITLES)

View File

@ -290,6 +290,19 @@ class MainHandler(RequestHandler):
redirect("/home/")
def setPosterSortBy(self, sort):
if sort not in ('name', 'date', 'network', 'progress'):
sort = 'name'
sickbeard.POSTER_SORTBY = sort
sickbeard.save_config()
def setPosterSortDir(self, direction):
sickbeard.POSTER_SORTDIR = int(direction)
sickbeard.save_config()
def setHistoryLayout(self, layout):
if layout not in ('compact', 'detailed'):