Change Show List sort Next Ep, and restore sort on Downloads.

Add sort by quality to Poster layout.
Change +n snatches to links on all Show List layouts.
This commit is contained in:
JackDandy 2016-03-30 15:49:22 +01:00
parent ddca1273af
commit 0d81453c1f
8 changed files with 79 additions and 26 deletions

View file

@ -45,7 +45,10 @@
* Remove redundant Adult Swim logos
* Add scene qualities WEB.h264 to SDTV, 720p.WEB.h264 to WEB DL 720p, and 1080p.WEB.h264 to WEB DL 1080p
* Change improve handling when provider PiSexy is missing expected data
* Change show list second level sort criteria
* Change Show List second level sort criteria
* Change Show List sort Next Ep, and restore sort on Downloads
* Add sort by quality to Poster layout
* Change +n snatches to links on all Show List layouts
* Change adding show processing to be highest priority
* Use timezones to check unaired status during show update/adding
* Fix syntax error causing renamer to error out

View file

@ -216,7 +216,8 @@ home.tmpl
border:1px solid #111
}
.progressbarText{
.ui-font,
a.ui-font{
text-shadow:0 0 0.1em #000;
color:#fff
}

View file

@ -212,7 +212,8 @@ home.tmpl
border:1px solid #ccc
}
.progressbarText{
.ui-font,
a.ui-font{
text-shadow:0 0 0.1em #fff;
color:#000
}

View file

@ -593,10 +593,8 @@ home.tmpl
height:100%;
overflow:visible;
text-align:center;
text-shadow:0 0 0.1em #fff;
vertical-align:middle;
font-size:12px;
color:#000
}
.progress-80{

View file

@ -40,6 +40,7 @@
<option value="date" data-sort="$sbRoot/setPosterSortBy/?sort=date"#echo $selected if 'date' == sickbeard.POSTER_SORTBY else ''#>Next Episode</option>
<option value="network" data-sort="$sbRoot/setPosterSortBy/?sort=network"#echo $selected if 'network' == sickbeard.POSTER_SORTBY else ''#>Network</option>
<option value="progress" data-sort="$sbRoot/setPosterSortBy/?sort=progress"#echo $selected if 'progress' == sickbeard.POSTER_SORTBY else ''#>Progress</option>
<option value="quality" data-sort="$sbRoot/setPosterSortBy/?sort=quality"#echo $selected if 'quality' == sickbeard.POSTER_SORTBY else ''#>Quality</option>
</select>
</span>
@ -147,7 +148,7 @@
#set $download_stat = str($cur_downloaded)
#set $download_stat_tip = 'Downloaded: ' + str($cur_downloaded)
#if $cur_snatched > 0
#set $download_stat = download_stat
#set $download_stat = '%s<a class="ui-font" href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">+%s</a>' % ($download_stat, $sbRoot, $cur_snatched)
#set $download_stat_tip = download_stat_tip + '&#013;' + 'Snatched: ' + str($cur_snatched)
#end if
#set $download_stat = download_stat + ' / ' + str($cur_total)
@ -326,7 +327,7 @@
#set $download_stat = str($cur_downloaded)
#set $download_stat_tip = 'Downloaded: ' + str($cur_downloaded)
#if $cur_snatched > 0
#set $download_stat = download_stat + '+' + str($cur_snatched)
#set $download_stat = '%s<a class="ui-font" href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">+%s</a>' % ($download_stat, $sbRoot, $cur_snatched)
#set $download_stat_tip = download_stat_tip + '&#013;' + 'Snatched: ' + str($cur_snatched)
#end if
#set $download_stat = download_stat + ' / ' + str($cur_total)
@ -343,6 +344,9 @@
#end if
##
#set $progressbar_percent = $nom * 100 / $den
#if not $progressbar_percent
#set $progressbar_percent = (0, -1)['?' == $download_stat]
#end if
##
<tr>
#if $cur_airs_next
@ -369,7 +373,7 @@
<img src="$sbRoot/showPoster/?show=$curShow.indexerid&amp;which=banner" class="$layout" alt="$curShow.indexerid" title="$curShow.name" />
</a>
</div>
<span class="sort-data">$display_name/span>
<span class="sort-data">$display_name</span>
</td>
#else if 'simple' == $layout
@ -390,6 +394,7 @@
<td class="text-left">
<span>$curShow.network</span>
<span class="sort-data">$curShow.network</span>
</td>
#end if
#if $curShow.quality in $qualityPresets
@ -402,7 +407,7 @@
<td>
<div id="progressbar$curShow.indexerid" style="position:relative">
<div class="progressbarText" title="$download_stat_tip">$download_stat</div>
<div class="progressbarText ui-font" title="$download_stat_tip">$download_stat</div>
</div>
<span class="sort-data" data-progress="$progressbar_percent"></span>
</td>

View file

@ -1,13 +1,21 @@
/** @namespace config.sortArticle */
/** @namespace config.homeSearchFocus */
/** @namespace config.fuzzyDating */
/** @namespace config.fuzzydate */
/** @namespace config.datePreset */
/** @namespace config.timePreset */
/** @namespace config.isPoster */
/** @namespace config.posterSortby */
/** @namespace config.posterSortdir */
$.tablesorter.addParser({
id: 'loadingNames',
is: function (s) {
return !1;
},
format: function (s) {
var name = (s || '');
if (0 == name.indexOf('Loading...'))
return name.replace('Loading...', '000');
return config.sortArticle ? name : name.replace(/^(?:(?:A(?!\s+to)n?)|The)\s(\w)/i, '$1');
var name = (s.toLowerCase() || '');
return (0 == name.indexOf('loading...')) ? name.replace('loading...', '000')
: config.sortArticle ? name : name.replace(/^(?:(?:A(?!\s+to)n?)|The)\s(\w)/i, '$1');
},
type: 'text'
});
@ -18,11 +26,41 @@ $.tablesorter.addParser({
return !1;
},
format: function (s) {
return s.replace('hd1080p', 5).replace('hd720p', 4).replace('hd', 3).replace('sd', 2).replace('any', 1).replace('custom', 7);
return s.replace('hd1080p', 22).replace('hd720p', 21).replace('hd', 20)
.replace('sd', 10).replace('any', 1).replace('custom', 50);
},
type: 'numeric'
});
$.tablesorter.addParser({
id: 'downloads',
is: function (s) {
return !1;
},
format: function(s) {
return valueDownloads(s);
},
type: 'numeric'
});
function valueDownloads(s) {
var match = s.match(/^(\?|\d+)(?:[^/]+[^\d]+(\d+))?$/);
if (null == match || '?' == match[1])
return -10;
var dlCnt = parseInt(match[1], 10), epsCnt = parseInt(match[2], 10);
if (0 == dlCnt)
return epsCnt;
var perNum = parseInt(1000000000 * parseFloat(dlCnt / epsCnt), 10), finalNum = perNum;
if (0 < finalNum)
finalNum += dlCnt;
return finalNum;
}
$(document).ready(function () {
if (config.homeSearchFocus) {
$('#search_show_name').focus();
@ -40,9 +78,11 @@ $(document).ready(function () {
}
$('div[id^="progressbar"]').each(function (k, v) {
var progress = parseInt($(this).siblings('span[class="sort-data"]').attr('data-progress'), 10), elId = '#' + $(this).attr('id'), v = 80;
var progress = parseInt($(this).siblings('span[class="sort-data"]').attr('data-progress'), 10),
elId = '#' + $(this).attr('id');
v = 80;
$(elId).progressbar({value: progress});
if (progress < 80) {
if (progress < v) {
v = progress >= 40 ? 60 : (progress >= 20 ? 40 : 20);
}
$(elId + ' > .ui-progressbar-value').addClass('progress-' + v);
@ -61,6 +101,9 @@ $(document).ready(function () {
case 'progress':
sortCriteria = ['progress', 'name', 'date', 'network'];
break;
case 'quality':
sortCriteria = ['quality', 'name', 'date', 'network', 'progress'];
break;
default:
sortCriteria = ['name', 'date', 'network', 'progress'];
break;
@ -90,8 +133,11 @@ $(document).ready(function () {
.replace(/^(.*?)\W*[(]\w{2,3}[)]|1$/i, '$1') || '';
},
progress: function (itemElem) {
var progress = $(itemElem).children('.sort-data').attr('data-progress');
return progress.length && parseInt(progress, 10) || Number.NEGATIVE_INFINITY;
var progress = $(itemElem).find('.show-dlstats').text();
return valueDownloads(progress);
},
quality: function (itemElem) {
return $(itemElem).find('.show-quality').text().toLowerCase();
}
}
});
@ -123,16 +169,16 @@ $(document).ready(function () {
sortList: [[5, 1], [1, 0]],
textExtraction: {
0: function (node) {
return $(node).find('span').text().toLowerCase();
return $(node).find('span.sort-data').text();
},
2: function (node) {
return $(node).find('span').text().toLowerCase();
return $(node).find('span.sort-data').text().toLowerCase();
},
3: function (node) {
return $(node).find('span').text().toLowerCase();
},
4: function (node) {
return $(node).find('span').attr('data-progress');
return $(node).find('.progressbarText').text();
},
5: function (node) {
return $(node).find('i').attr('alt');
@ -140,10 +186,9 @@ $(document).ready(function () {
},
widgets: ['saveSort', 'zebra', 'stickyHeaders', 'filter'],
headers: {
0: {sorter: 'isoDate'},
1: {sorter: 'loadingNames'},
3: {sorter: 'quality'},
4: {sorter: 'eps'}
4: {sorter: 'downloads'}
},
widgetOptions: {
filter_columnFilters: !1

View file

@ -295,12 +295,12 @@ class GenericMetadata():
indexerid = showXML.find('id')
root = showXML.getroot()
if indexer:
if None is not indexer:
indexer.text = show_obj.indexer
else:
etree.SubElement(root, "indexer").text = str(show_obj.indexer)
if indexerid:
if None is not indexerid:
indexerid.text = show_obj.indexerid
else:
etree.SubElement(root, "id").text = str(show_obj.indexerid)

View file

@ -382,7 +382,7 @@ class MainHandler(WebHandler):
def setPosterSortBy(self, sort):
if sort not in ('name', 'date', 'network', 'progress'):
if sort not in ('name', 'date', 'network', 'progress', 'quality'):
sort = 'name'
sickbeard.POSTER_SORTBY = sort