1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-24 08:48:50 -05:00

Merge pull request #1350 from abeloin/patch-displayShow_status

Fix color in displayShow when manually searching.
This commit is contained in:
Alexandre Beloin 2015-02-19 00:06:42 -05:00
commit c62fa2b056
2 changed files with 29 additions and 25 deletions

View File

@ -45,9 +45,9 @@ function updateImages(data) {
if (el) { if (el) {
if (ep.searchstatus == 'searching') { if (ep.searchstatus == 'searching') {
//el=$('td#' + ep.season + 'x' + ep.episode + '.search img'); //el=$('td#' + ep.season + 'x' + ep.episode + '.search img');
img.attr('title','Searching'); img.prop('title','Searching');
img.attr('alt','earching'); img.prop('alt','Searching');
img.attr('src',sbRoot+'/images/' + loadingImage); img.prop('src',sbRoot+'/images/' + loadingImage);
disableLink(el); disableLink(el);
// Update Status and Quality // Update Status and Quality
var rSearchTerm = /(\w+)\s\((.+?)\)/; var rSearchTerm = /(\w+)\s\((.+?)\)/;
@ -56,23 +56,24 @@ function updateImages(data) {
} }
else if (ep.searchstatus == 'queued') { else if (ep.searchstatus == 'queued') {
//el=$('td#' + ep.season + 'x' + ep.episode + '.search img'); //el=$('td#' + ep.season + 'x' + ep.episode + '.search img');
img.attr('title','Queued'); img.prop('title','Queued');
img.attr('alt','queued'); img.prop('alt','queued');
img.attr('src',sbRoot+'/images/' + queuedImage ); img.prop('src',sbRoot+'/images/' + queuedImage );
disableLink(el); disableLink(el);
HtmlContent = ep.searchstatus; HtmlContent = ep.searchstatus;
} }
else if (ep.searchstatus == 'finished') { else if (ep.searchstatus == 'finished') {
//el=$('td#' + ep.season + 'x' + ep.episode + '.search img'); //el=$('td#' + ep.season + 'x' + ep.episode + '.search img');
img.attr('title','Searching'); img.prop('title','Searching');
img.attr('alt','searching'); img.prop('alt','searching');
img.parent().attr('class','epRetry'); img.parent().prop('class','epRetry');
img.attr('src',sbRoot+'/images/' + searchImage); img.prop('src',sbRoot+'/images/' + searchImage);
enableLink(el); enableLink(el);
// Update Status and Quality // Update Status and Quality
var rSearchTerm = /(\w+)\s\((.+?)\)/; var rSearchTerm = /(\w+)\s\((.+?)\)/;
HtmlContent = ep.status.replace(rSearchTerm,"$1"+' <span class="quality '+ep.quality+'">'+"$2"+'</span>'); HtmlContent = ep.status.replace(rSearchTerm,"$1"+' <span class="quality '+ep.quality+'">'+"$2"+'</span>');
parent.closest('tr').prop("class", ep.overview + " season-" + ep.season + " seasonstyle")
} }
// update the status column if it exists // update the status column if it exists
@ -91,13 +92,13 @@ $(document).ready(function () {
function enableLink(el) { function enableLink(el) {
el.on('click.disabled', false); el.on('click.disabled', false);
el.attr('enableClick', '1'); el.prop('enableClick', '1');
el.fadeTo("fast", 1) el.fadeTo("fast", 1)
} }
function disableLink(el) { function disableLink(el) {
el.off('click.disabled'); el.off('click.disabled');
el.attr('enableClick', '0'); el.prop('enableClick', '0');
el.fadeTo("fast", .5) el.fadeTo("fast", .5)
} }
@ -121,11 +122,11 @@ function disableLink(el) {
event.preventDefault(); event.preventDefault();
// Check if we have disabled the click // Check if we have disabled the click
if ( $(this).attr('enableClick') == '0' ) { if ( $(this).prop('enableClick') == '0' ) {
return false; return false;
} }
if ( $(this).attr('class') == "epRetry" ) { if ( $(this).prop('class') == "epRetry" ) {
if ( !confirm("Mark download as bad and retry?") ) if ( !confirm("Mark download as bad and retry?") )
return false; return false;
}; };
@ -137,12 +138,12 @@ function disableLink(el) {
// Create var for img under anchor and set options for the loading gif // Create var for img under anchor and set options for the loading gif
img=$(this).children('img'); img=$(this).children('img');
img.attr('title','loading'); img.prop('title','loading');
img.attr('alt',''); img.prop('alt','');
img.attr('src',sbRoot+'/images/' + options.loadingImage); img.prop('src',sbRoot+'/images/' + options.loadingImage);
$.getJSON($(this).attr('href'), function(data){ $.getJSON($(this).prop('href'), function(data){
// if they failed then just put the red X // if they failed then just put the red X
if (data.result == 'failure') { if (data.result == 'failure') {
@ -161,15 +162,15 @@ function disableLink(el) {
HtmlContent = data.result.replace(rSearchTerm,"$1"+' <span class="quality '+data.quality+'">'+"$2"+'</span>'); HtmlContent = data.result.replace(rSearchTerm,"$1"+' <span class="quality '+data.quality+'">'+"$2"+'</span>');
// update the status column if it exists // update the status column if it exists
parent.siblings('.col-status').html(HtmlContent) parent.siblings('.col-status').html(HtmlContent)
// Only if the queing was succesfull, disable the onClick event of the loading image // Only if the queuing was successful, disable the onClick event of the loading image
disableLink(link); disableLink(link);
} }
// put the corresponding image as the result of queuing of the manual search // put the corresponding image as the result of queuing of the manual search
img.attr('title',img_result); img.prop('title',img_result);
img.attr('alt',img_result); img.prop('alt',img_result);
img.attr('height', options.size); img.prop('height', options.size);
img.attr('src',sbRoot+"/images/"+img_name); img.prop('src',sbRoot+"/images/"+img_name);
}); });
// //

View File

@ -1809,6 +1809,7 @@ class Home(WebRoot):
def getManualSearchStatus(self, show=None, season=None): def getManualSearchStatus(self, show=None, season=None):
def getEpisodes(searchThread, searchstatus): def getEpisodes(searchThread, searchstatus):
results = [] results = []
showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, int(show))
if isinstance(searchThread, sickbeard.search_queue.ManualSearchQueueItem): if isinstance(searchThread, sickbeard.search_queue.ManualSearchQueueItem):
results.append({'episode': searchThread.segment.episode, results.append({'episode': searchThread.segment.episode,
@ -1816,7 +1817,8 @@ class Home(WebRoot):
'season': searchThread.segment.season, 'season': searchThread.segment.season,
'searchstatus': searchstatus, 'searchstatus': searchstatus,
'status': statusStrings[searchThread.segment.status], 'status': statusStrings[searchThread.segment.status],
'quality': self.getQualityClass(searchThread.segment)}) 'quality': self.getQualityClass(searchThread.segment),
'overview': Overview.overviewStrings[showObj.getOverview(int(searchThread.segment.status or -1))]})
else: else:
for epObj in searchThread.segment: for epObj in searchThread.segment:
results.append({'episode': epObj.episode, results.append({'episode': epObj.episode,
@ -1824,7 +1826,8 @@ class Home(WebRoot):
'season': epObj.season, 'season': epObj.season,
'searchstatus': searchstatus, 'searchstatus': searchstatus,
'status': statusStrings[epObj.status], 'status': statusStrings[epObj.status],
'quality': self.getQualityClass(epObj)}) 'quality': self.getQualityClass(epObj),
'overview': Overview.overviewStrings[showObj.getOverview(int(epObj.status or -1))]})
return results return results