Change UI footer tweaks + only display footer propers time if option is actually enabled.

This commit is contained in:
JackDandy 2018-01-27 16:17:21 +00:00
parent 6e2788fd8e
commit 56d8fffb9f
8 changed files with 61 additions and 31 deletions

View file

@ -8,6 +8,9 @@
* Add failure handling, skip provider for x hour(s) depending on count of failures
* Add detection of Too Many Requests (Supporting providers UC and BTN)
* Add footer icon button to switch time layouts
* Add performance gains for proper search by integrating it into recent search
* Add the once per day proper finder time to footer, this process catches any propers missed during recent searches
* Add ability to differentiate webdl/rip sources so overwriting propers is always done from the same source (e.g. AMZN)
[develop changelog]

View file

@ -643,7 +643,7 @@ inc_bottom.tmpl
opacity:0.4;filter:alpha(opacity=40);
float:none;
display:inline-block;
margin:0 0 -2px 0;
margin:0 0 -1px 2px;
height:12px;
width:14px
}
@ -653,11 +653,11 @@ inc_bottom.tmpl
}
.footer .icon-glyph.timeleft,
.footer .icon-glyph.time:hover{
background-position:-48px -25px
background-position:-49px -25px
}
.footer .icon-glyph.time,
.footer .icon-glyph.timeleft:hover{
background-position:-192px -121px
background-position:-193px -121px
}
/* =======================================================================

View file

@ -69,13 +69,13 @@ if min_output:
% (localRoot, str(ep_snatched))
)[0 < ep_snatched]
%>&nbsp;/&nbsp;<span class="footerhighlight">$ep_total</span> episodes downloaded $ep_percentage
#for i, event in enumerate($MainHandler.getFooterTime(ajax_layout=False))
#for i, event in enumerate($MainHandler.getFooterTime(change_layout=False, json_dump=False))
#for k, v in event.items()
#set info = re.findall('(.*)_(timeleft|time)', k)[0]
#if not i
<br><i class="icon-glyph layout $info[1]" title="Change time layout"></i>
<br>next connect <i class="icon-glyph layout $info[1]" title="Change time layout"></i> for...
#end if
| $info[0].replace('-', ' '): <span class="footerhighlight $info[0]">$v</span>
<span id="next-connect-$info[0]">| $info[0].replace('-', ' '): <span class="footerhighlight $info[0]">$v</span></span>
#end for
#end for
#if diskfree
@ -106,18 +106,31 @@ if min_output:
<script>
var footerTimeUrl = '$localRoot/getFooterTime';
#raw
$(function(){
$('.footer').find('.layout').click(function(){
$.getJSON(footerTimeUrl, function(data){
var info, footerIcon$ = $('.footer').find('.icon-glyph.layout');
$.each(data, function(i, eventItems){
$.each(eventItems, function(k, v){
info = k.match(/(.*)_(timeleft|time)/);
$('.footer').find('.' + info[1]).html(v);
footerIcon$.removeClass('time').removeClass('timeleft').addClass(info[2])
});
function getFooterTime(params){
params = /undefined/.test(params) && {} || params;
$.getJSON(footerTimeUrl, params, function(data){
var info, footerIcon$ = $('.footer').find('.icon-glyph.layout'), enabledPropers = !1;
$.each(data, function(i, eventItems){
$.each(eventItems, function(k, v){
info = k.match(/(.*)_(timeleft|time)/);
$('.footer').find('.' + info[1]).html(v);
footerIcon$.removeClass('time').removeClass('timeleft').addClass(info[2]);
enabledPropers |= /propers/.test(info[1]); // enable only if key is found in response
});
});
var propers$ = $('#next-connect-propers');
if(enabledPropers){
propers$.show();
} else {
propers$.hide();
}
});
}
$(function(){
$('.footer').find('.layout').click(function(){
getFooterTime();
});
});
#end raw

View file

@ -118,7 +118,7 @@
#if $fail['http']['count']
#set $title=$fail['http']['code']
#end if
<td>#if $fail['http']['count']#<span title="#if $child#$title#else#Expand for fail codes#end if#">$fail['http']['count']</span>#else#$blank#end if# / #echo $fail['timeout'].get('count', 0) or $blank#</td>
<td>#if $fail['http']['count']#<span title="#if $child or not $fail['multirow']#$title#else#Expand for fail codes#end if#">$fail['http']['count']</span>#else#$blank#end if# / #echo $fail['timeout'].get('count', 0) or $blank#</td>
<td>#echo ($fail['connection'].get('count', 0) + $fail['connection_timeout'].get('count', 0)) or $blank#</td>
<td>#echo $fail['nodata'].get('count', 0) or $blank#</td>
<td>#echo $fail['other'].get('count', 0) or $blank#</td>

View file

@ -262,6 +262,11 @@ function config_success(response) {
$(this).show();
});
$('#email_show').trigger('notify');
// update footer only on the config page for the propers option
if('saveSearch' == $('#configForm').attr('action')){
getFooterTime({'change_layout': 0});
}
}
function fetch_pullrequests() {

View file

@ -41,7 +41,7 @@ def search_propers(proper_list=None):
if not sickbeard.DOWNLOAD_PROPERS:
return
logger.log(('Checking propers from Recent search', 'Beginning search for new propers')[None is proper_list])
logger.log(('Checking propers from recent search', 'Beginning search for new propers')[None is proper_list])
age_shows, age_anime = sickbeard.BACKLOG_DAYS + 2, 14
aired_since_shows = datetime.datetime.today() - datetime.timedelta(days=age_shows)
@ -71,10 +71,10 @@ def search_propers(proper_list=None):
minutes, seconds = divmod(remainder, 60)
run_at += u'in approx. ' + ('%dh, %dm' % (hours, minutes) if 0 < hours else
'%dm, %ds' % (minutes, seconds))
else:
run_at = ' send from recent search'
logger.log(u'Completed the search for new propers%s' % run_at)
logger.log(u'Completed search for new propers%s' % run_at)
else:
logger.log(u'Completed checking propers from recent search')
def get_old_proper_level(show_obj, indexer, indexerid, season, episodes, old_status, new_quality,

View file

@ -278,7 +278,7 @@ class RecentSearchQueueItem(generic_queue.QueueItem):
Proper(s['name'], s['url'], datetime.datetime.fromtimestamp(s['time']), show, parsed_show=show))
if propers:
logger.log('Found Proper/Repack/Real in Recent Search, sending data to properfinder')
logger.log('Found Proper/Repack/Real in recent search, sending data to properfinder')
propersearch_queue_item = sickbeard.search_queue.ProperSearchQueueItem(propers=propers)
sickbeard.searchQueueScheduler.action.add_item(propersearch_queue_item)

View file

@ -603,26 +603,35 @@ class MainHandler(WebHandler):
sickbeard.save_config()
@staticmethod
def getFooterTime(ajax_layout=True, *args, **kwargs):
def getFooterTime(change_layout=True, json_dump=True, *args, **kwargs):
now = datetime.datetime.now()
events = [
('search-recent', sickbeard.recentSearchScheduler.timeLeft()),
('search-backlog', sickbeard.backlogSearchScheduler.next_backlog_timeleft()),
('recent', sickbeard.recentSearchScheduler.timeLeft),
('backlog', sickbeard.backlogSearchScheduler.next_backlog_timeleft),
]
if ajax_layout:
if sickbeard.DOWNLOAD_PROPERS:
events += [('propers', sickbeard.properFinder.next_proper_timeleft)]
if change_layout not in (False, 0, '0', '', None):
sickbeard.FOOTER_TIME_LAYOUT += 1
if sickbeard.FOOTER_TIME_LAYOUT == 2: # 2 layouts = time + delta
sickbeard.FOOTER_TIME_LAYOUT = 0
sickbeard.save_config()
if 0 == sickbeard.FOOTER_TIME_LAYOUT:
next_event = [{k + '_time': sbdatetime.sbdatetime.sbftime(now + v, markup=True)} for (k, v) in events]
else:
next_event = [{k + '_timeleft': str(v).split('.')[0]} for (k, v) in events]
next_event = []
for k, v in events:
try:
t = v()
except AttributeError:
t = None
if 0 == sickbeard.FOOTER_TIME_LAYOUT:
next_event += [{k + '_time': t and sbdatetime.sbdatetime.sbftime(now + t, markup=True) or 'soon'}]
else:
next_event += [{k + '_timeleft': t and str(t).split('.')[0] or 'soon'}]
if ajax_layout:
if json_dump not in (False, 0, '0', '', None):
next_event = json.dumps(next_event)
return next_event