1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Implemented the queuing functionality also for Failed downloads.

ajaxEpSearch.js now also processes the clicks for Retries. SO merged those together and removed ajaxEpRetry.js.
This commit is contained in:
KontiSR 2014-09-15 15:01:18 +02:00
parent e3db9b8c93
commit bdac98db4b
6 changed files with 14 additions and 73 deletions

View File

@ -26,7 +26,6 @@
<script type="text/javascript" src="$sbRoot/js/sceneExceptionsTooltip.js?$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/ajaxEpSearch.js?$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/ajaxEpSubtitles.js?$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/ajaxEpRetry.js?$sbPID"></script>
<script type="text/javascript" charset="utf-8">
<!--
\$(document).ready(function(){

View File

@ -1,51 +0,0 @@
(function () {
$.ajaxEpRetry = {
defaults: {
size: 16,
colorRow: false,
loadingImage: 'loading16_dddddd.gif',
noImage: 'no16.png',
yesImage: 'yes16.png'
}
};
$.fn.ajaxEpRetry = function (options) {
options = $.extend({}, $.ajaxEpRetry.defaults, options);
$('.epRetry').click(function () {
if ( !confirm("Mark download as bad and retry?") )
return false;
var parent = $(this).parent();
// put the ajax spinner (for non white bg) placeholder while we wait
parent.empty();
parent.append($("<img/>").attr({"src": sbRoot + "/images/" + options.loadingImage, "height": options.size, "alt": "", "title": "loading"}));
$.getJSON($(this).attr('href'), function (data) {
// if they failed then just put the red X
if (data.result == 'failure') {
img_name = options.noImage;
img_result = 'failed';
// if the snatch was successful then apply the corresponding class and fill in the row appropriately
} else {
img_name = options.yesImage;
img_result = 'success';
// color the row
if (options.colorRow) {
parent.parent().removeClass('skipped wanted qual good unaired snatched').addClass('snatched');
}
}
// put the corresponding image as the result for the the row
parent.empty();
parent.append($("<img/>").attr({"src": sbRoot + "/images/" + img_name, "height": options.size, "alt": img_result, "title": img_result}));
});
// don't follow the link
return false;
});
};
})();

View File

@ -123,7 +123,7 @@ function disableLink(el) {
$.fn.ajaxEpSearch = function(options){
options = $.extend({}, $.ajaxEpSearch.defaults, options);
$('.epSearch').click(function(event){
$('.epSearch, .epRetry').click(function(event){
event.preventDefault();
// Check if we have disabled the click

View File

@ -1,7 +1,6 @@
$(document).ready(function () {
$('#sbRoot').ajaxEpSearch({'colorRow': true});
//$('#sbRoot').ajaxEpRetry({'colorRow': true});
$('#sbRoot').ajaxEpSubtitlesSearch();

View File

@ -241,12 +241,14 @@ class FailedQueueItem(generic_queue.QueueItem):
self.show = show
self.segment = segment
self.success = None
self.started = None
def run(self):
generic_queue.QueueItem.run(self)
try:
logger.log(u"Marking episode as bad: [" + self.segment.prettyName() + "]")
self.started = True
failed_history.markFailed(self.segment)
(release, provider) = failed_history.findRelease(self.segment)
@ -272,6 +274,9 @@ class FailedQueueItem(generic_queue.QueueItem):
except Exception:
logger.log(traceback.format_exc(), logger.DEBUG)
### Keep a list with the 100 last executed searches
fifo(MANUAL_SEARCH_HISTORY, self, MANUAL_SEARCH_HISTORY_SIZE)
if self.success is None:
self.success = False

View File

@ -4510,24 +4510,13 @@ class Home(MainHandler):
ep_queue_item = search_queue.FailedQueueItem(ep_obj.show, ep_obj)
sickbeard.searchQueueScheduler.action.add_item(ep_queue_item) # @UndefinedVariable
# wait until the queue item tells us whether it worked or not
while ep_queue_item.success is None: # @UndefinedVariable
time.sleep(cpu_presets[sickbeard.CPU_PRESET])
# return the correct json value
if ep_queue_item.success:
# Find the quality class for the episode
quality_class = Quality.qualityStrings[Quality.UNKNOWN]
ep_status, ep_quality = Quality.splitCompositeStatus(ep_obj.status)
for x in (SD, HD720p, HD1080p):
if ep_quality in Quality.splitQuality(x)[0]:
quality_class = qualityPresetStrings[x]
break
return json.dumps({'result': statusStrings[ep_obj.status],
'quality': quality_class
})
return returnManualSearchResult(ep_queue_item)
if not ep_queue_item.started and ep_queue_item.success is None:
return json.dumps({'result': 'success'}) #I Actually want to call it queued, because the search hasnt been started yet!
if ep_queue_item.started and ep_queue_item.success is None:
return json.dumps({'result': 'success'})
else:
return json.dumps({'result': 'failure'})