mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-13 03:22:22 -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:
parent
e3db9b8c93
commit
bdac98db4b
@ -26,7 +26,6 @@
|
|||||||
<script type="text/javascript" src="$sbRoot/js/sceneExceptionsTooltip.js?$sbPID"></script>
|
<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/ajaxEpSearch.js?$sbPID"></script>
|
||||||
<script type="text/javascript" src="$sbRoot/js/ajaxEpSubtitles.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">
|
<script type="text/javascript" charset="utf-8">
|
||||||
<!--
|
<!--
|
||||||
\$(document).ready(function(){
|
\$(document).ready(function(){
|
||||||
|
@ -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;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
})();
|
|
@ -123,7 +123,7 @@ function disableLink(el) {
|
|||||||
$.fn.ajaxEpSearch = function(options){
|
$.fn.ajaxEpSearch = function(options){
|
||||||
options = $.extend({}, $.ajaxEpSearch.defaults, options);
|
options = $.extend({}, $.ajaxEpSearch.defaults, options);
|
||||||
|
|
||||||
$('.epSearch').click(function(event){
|
$('.epSearch, .epRetry').click(function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// Check if we have disabled the click
|
// Check if we have disabled the click
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
$('#sbRoot').ajaxEpSearch({'colorRow': true});
|
$('#sbRoot').ajaxEpSearch({'colorRow': true});
|
||||||
//$('#sbRoot').ajaxEpRetry({'colorRow': true});
|
|
||||||
|
|
||||||
$('#sbRoot').ajaxEpSubtitlesSearch();
|
$('#sbRoot').ajaxEpSubtitlesSearch();
|
||||||
|
|
||||||
|
@ -241,12 +241,14 @@ class FailedQueueItem(generic_queue.QueueItem):
|
|||||||
self.show = show
|
self.show = show
|
||||||
self.segment = segment
|
self.segment = segment
|
||||||
self.success = None
|
self.success = None
|
||||||
|
self.started = None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
generic_queue.QueueItem.run(self)
|
generic_queue.QueueItem.run(self)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logger.log(u"Marking episode as bad: [" + self.segment.prettyName() + "]")
|
logger.log(u"Marking episode as bad: [" + self.segment.prettyName() + "]")
|
||||||
|
self.started = True
|
||||||
failed_history.markFailed(self.segment)
|
failed_history.markFailed(self.segment)
|
||||||
|
|
||||||
(release, provider) = failed_history.findRelease(self.segment)
|
(release, provider) = failed_history.findRelease(self.segment)
|
||||||
@ -271,6 +273,9 @@ class FailedQueueItem(generic_queue.QueueItem):
|
|||||||
logger.log(u"No valid episode found to retry for: [" + self.segment.prettyName() + "]")
|
logger.log(u"No valid episode found to retry for: [" + self.segment.prettyName() + "]")
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
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:
|
if self.success is None:
|
||||||
self.success = False
|
self.success = False
|
||||||
|
@ -4510,26 +4510,15 @@ class Home(MainHandler):
|
|||||||
ep_queue_item = search_queue.FailedQueueItem(ep_obj.show, ep_obj)
|
ep_queue_item = search_queue.FailedQueueItem(ep_obj.show, ep_obj)
|
||||||
sickbeard.searchQueueScheduler.action.add_item(ep_queue_item) # @UndefinedVariable
|
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:
|
if ep_queue_item.success:
|
||||||
# Find the quality class for the episode
|
return returnManualSearchResult(ep_queue_item)
|
||||||
quality_class = Quality.qualityStrings[Quality.UNKNOWN]
|
if not ep_queue_item.started and ep_queue_item.success is None:
|
||||||
ep_status, ep_quality = Quality.splitCompositeStatus(ep_obj.status)
|
return json.dumps({'result': 'success'}) #I Actually want to call it queued, because the search hasnt been started yet!
|
||||||
for x in (SD, HD720p, HD1080p):
|
if ep_queue_item.started and ep_queue_item.success is None:
|
||||||
if ep_quality in Quality.splitQuality(x)[0]:
|
return json.dumps({'result': 'success'})
|
||||||
quality_class = qualityPresetStrings[x]
|
else:
|
||||||
break
|
return json.dumps({'result': 'failure'})
|
||||||
|
|
||||||
return json.dumps({'result': statusStrings[ep_obj.status],
|
|
||||||
'quality': quality_class
|
|
||||||
})
|
|
||||||
|
|
||||||
return json.dumps({'result': 'failure'})
|
|
||||||
|
|
||||||
|
|
||||||
class UI(MainHandler):
|
class UI(MainHandler):
|
||||||
def add_message(self):
|
def add_message(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user