From 14075887855ee4a7876cffba9d1ce6b41182e7eb Mon Sep 17 00:00:00 2001 From: evilhero Date: Sat, 30 Mar 2019 22:27:16 -0400 Subject: [PATCH] FIX: Fix for Abort DDL option in DDL GUI not working due to hyphenated ID, IMP: Added Remove option for DDL downloads that are in a Failed/Incomplete/Completed status where it will remove the item from the history list, FIX: Corrected ',' being added when TPB information was being parsed for the collected display in the comic details pages for TPB/GN's --- data/interfaces/default/queue_management.html | 40 ++++++++++++------- mylar/cv.py | 6 +-- mylar/webserve.py | 12 +++++- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/data/interfaces/default/queue_management.html b/data/interfaces/default/queue_management.html index be7a5500..31f8d881 100755 --- a/data/interfaces/default/queue_management.html +++ b/data/interfaces/default/queue_management.html @@ -106,9 +106,9 @@ document.getElementById("status").innerHTML = status; qmm = document.getElementById("queue_menu"); qmm.style.display = "inline-block"; - $("#qrestartddl").attr('onClick', "ajaxcallit('restart', "+aid+")"); - $("#qresumeddl").attr('onClick', "ajaxcallit('resume', "+aid+")"); - $("#qabortddl").attr('onClick', "ajaxcallit('abort', "+aid+")"); + $("#qrestartddl").attr('onClick', "ajaxcallit('restart', '"+aid+"')"); + $("#qresumeddl").attr('onClick', "ajaxcallit('resume', '"+aid+"')"); + $("#qabortddl").attr('onClick', "ajaxcallit('abort', '"+aid+"')"); } else if ( status.indexOf("File does not exist") > -1){ acm = document.getElementById("active_message"); acm.style.display = "inline-block"; @@ -117,9 +117,9 @@ document.getElementById("amessage").innerHTML = status; qmm = document.getElementById("queue_menu"); qmm.style.display = "inline-block"; - $("#arestartddl").attr('onClick', "ajaxcallit('restart', "+aid+")"); - $("#aresumeddl").attr('onClick', "ajaxcallit('resume', "+aid+")"); - $("#aabortddl").attr('onClick', "ajaxcallit('abort', "+aid+")"); + $("#arestartddl").attr('onClick', "ajaxcallit('restart', '"+aid+"')"); + $("#aresumeddl").attr('onClick', "ajaxcallit('resume', '"+aid+"')"); + $("#aabortddl").attr('onClick', "ajaxcallit('abort', '"+aid+"')"); } else { acm = document.getElementById("active_message"); acm.style.display = "inline-block"; @@ -136,18 +136,29 @@ } }); }; - function ajaxcallit(mode, queueid) { - alert(queueid); + function ajaxcallit(qmode, queueid) { $.get("ddl_requeue", - { mode: mode, id: queueid }, + { mode: qmode, id: queueid }, function(data){ if (data.error != undefined) { alert(data.error); return; } - $('#ajaxMsg').html("
Successfully restarted DDL Queue
"); - $('#queue_table').DataTable().ajax.reload(null, false); + var objd = JSON.parse(data); + if (qmode == 'restart') { + $('#ajaxMsg').html("
"+objd['message']+"
"); + } else if (qmode == 'resume') { + $('#ajaxMsg').html("
"+objd['message']+"
"); + } else if (qmode == 'abort') { + $('#ajaxMsg').html("
"+objd['message']+"
"); + } else if (qmode == 'remove') { + $('#ajaxMsg').html("
"+objd['message']+"
"); + } else if (qmode == 'restart-queue') { + $('#ajaxMsg').html("
"+objd['message']+"
"); + } }); + $('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut(); + $('#queue_table').DataTable().ajax.reload(null, false); }; function initThisPage() { initActions(); @@ -186,10 +197,11 @@ "visible": true, "render":function (data,type,full) { val = full[4] - var restartline = "('ddl_requeue?mode=restart&id="+full[6]+"',$(this));" - var resumeline = "('ddl_requeue?mode=resume&id="+full[6]+"',$(this));" + var restartline = "('ddl_requeue?mode=restart&id="+String(full[6])+"',$(this));" + var resumeline = "('ddl_requeue?mode=resume&id="+String(full[6])+"',$(this));" + var removeline = "('ddl_requeue?mode=remove&id="+String(full[6])+"',$(this));" if (val == 'Completed' || val == 'Failed' || val == 'Downloading'){ - return 'Restart'; + return 'RestartRemove'; } else if (val == 'Incomplete') { return 'RestartResume'; } else if (val == 'Queued') { diff --git a/mylar/cv.py b/mylar/cv.py index 8eb90afe..91d9d24a 100755 --- a/mylar/cv.py +++ b/mylar/cv.py @@ -413,16 +413,16 @@ def GetComicInfo(comicid, dom, safechk=None): issuerun = issuerun[:srchline+len(x)] break except Exception as e: - logger.warn('[ERROR] %s' % e) + #logger.warn('[ERROR] %s' % e) continue else: iss_start = fc_name.find('#') issuerun = fc_name[iss_start:].strip() fc_name = fc_name[:iss_start].strip() - if issuerun.endswith('.') or issuerun.endswith(','): + if issuerun.strip().endswith('.') or issuerun.strip().endswith(','): #logger.fdebug('Changed issuerun from %s to %s' % (issuerun, issuerun[:-1])) - issuerun = issuerun[:-1] + issuerun = issuerun.strip()[:-1] if issuerun.endswith(' and '): issuerun = issuerun[:-4].strip() elif issuerun.endswith(' and'): diff --git a/mylar/webserve.py b/mylar/webserve.py index cb8f703b..ccf9371e 100644 --- a/mylar/webserve.py +++ b/mylar/webserve.py @@ -2208,6 +2208,9 @@ class WebInterface(object): filesize = 0 resume = filesize elif mode == 'abort': + myDB.upsert("ddl_info", {'Status': 'Failed'}, {'id': id}) #DELETE FROM ddl_info where ID=?', [id]) + continue + elif mode == 'remove': myDB.action('DELETE FROM ddl_info where ID=?', [id]) continue else: @@ -2221,15 +2224,20 @@ class WebInterface(object): 'issueid': item['issueid'], 'id': item['id'], 'resume': resume}) + + linemessage = '%s successful for %s' % (mode, oneitem['series']) if mode == 'restart_queue': logger.info('[DDL-RESTART-QUEUE] DDL Queue successfully restarted. Put %s items back into the queue for downloading..' % len(itemlist)) + linemessage = 'Successfully restarted Queue' elif mode == 'restart': - logger.info('[DDL-REQUEUE] Successfully restarted %s [%s] for downloading..' % (oneitem['series'], oneitem['size'])) + logger.info('[DDL-RESTART] Successfully restarted %s [%s] for downloading..' % (oneitem['series'], oneitem['size'])) elif mode == 'requeue': logger.info('[DDL-REQUEUE] Successfully requeued %s [%s] for downloading..' % (oneitem['series'], oneitem['size'])) elif mode == 'abort': logger.info('[DDL-ABORT] Successfully aborted downloading of %s [%s]..' % (oneitem['series'], oneitem['size'])) - + elif mode == 'remove': + logger.info('[DDL-REMOVE] Successfully removed %s [%s]..' % (oneitem['series'], oneitem['size'])) + return json.dumps({'status': True, 'message': linemessage}) ddl_requeue.exposed = True def queueManage(self): # **args):