From 8aae1688440d70f5c2daae8ba174d3da3d533766 Mon Sep 17 00:00:00 2001 From: evilhero Date: Fri, 5 Jul 2013 22:42:58 -0400 Subject: [PATCH] IMP:(#437) Selections included now in history for selective choices, FIX:(#438) If filenames contained a '#' in filename would not detect properly, FIX: Removal of ' in directory naming, FIX: Added some error-catching for metadata & comictagger --- data/interfaces/default/history.html | 19 +++++++++++++++++++ mylar/PostProcessor.py | 18 +++++++++++++----- mylar/filechecker.py | 12 +++++++++--- mylar/importer.py | 2 +- mylar/webserve.py | 7 +++++-- 5 files changed, 47 insertions(+), 11 deletions(-) diff --git a/data/interfaces/default/history.html b/data/interfaces/default/history.html index 28254578..ae57248a 100755 --- a/data/interfaces/default/history.html +++ b/data/interfaces/default/history.html @@ -18,9 +18,24 @@

HistoryHistory

+ +
+
Mark selected issues as + + selected issues + +
+ +
+ + @@ -42,6 +57,7 @@ %> + @@ -51,6 +67,9 @@ %endfor
Date Added Comic Name Issue
${item['DateAdded']} ${item['ComicName']} ${item['Issue_Number']}
+
+ +
<%def name="headIncludes()"> diff --git a/mylar/PostProcessor.py b/mylar/PostProcessor.py index effcc7c5..02af7e65 100755 --- a/mylar/PostProcessor.py +++ b/mylar/PostProcessor.py @@ -574,11 +574,19 @@ class PostProcessor(object): if mylar.ENABLE_META: self._log("Metatagging enabled - proceeding...") logger.fdebug("Metatagging enabled - proceeding...") - import cmtagmylar - if ml is None: - pcheck = cmtagmylar.run(self.nzb_folder, issueid=issueid) - else: - pcheck = cmtagmylar.run(self.nzb_folder, issueid=issueid, manual="yes", filename=ml['ComicLocation']) + pcheck = "pass" + try: + import cmtagmylar + if ml is None: + pcheck = cmtagmylar.run(self.nzb_folder, issueid=issueid) + else: + pcheck = cmtagmylar.run(self.nzb_folder, issueid=issueid, manual="yes", filename=ml['ComicLocation']) + + except ImportError: + logger.fdebug("comictaggerlib not found on system. Ensure the ENTIRE lib directory is located within mylar/lib/comictaggerlib/") + logger.fdebug("continuing with PostProcessing, but I'm not using metadata.") + pcheck = "fail" + if pcheck == "fail": self._log("Unable to write metadata successfully - check mylar.log file. Attempting to continue without tagging...") logger.fdebug("Unable to write metadata successfully - check mylar.log file. Attempting to continue without tagging...") diff --git a/mylar/filechecker.py b/mylar/filechecker.py index 9a74759c..6b8b02f3 100755 --- a/mylar/filechecker.py +++ b/mylar/filechecker.py @@ -40,7 +40,7 @@ def listFiles(dir,watchcomic,AlternateSearch=None): watchmatch = {} comiclist = [] comiccnt = 0 - not_these = ['\#', + not_these = ['#', ',', '\/', ':', @@ -181,8 +181,14 @@ def listFiles(dir,watchcomic,AlternateSearch=None): logger.fdebug("negative issue detected.") #detneg = "yes" elif j > findtitlepos: - logger.fdebug("special character appears outside of title - ignoring @ position: " + str(charpos[i])) - nonocount-=1 + if subname[j:] == '#': + if subname[i+1].isdigit(): + logger.fdebug("# detected denoting issue#, ignoring.") + else: + nonocount-=1 + else: + logger.fdebug("special character appears outside of title - ignoring @ position: " + str(charpos[i])) + nonocount-=1 i+=1 #remove versioning here diff --git a/mylar/importer.py b/mylar/importer.py index 17daeb5e..bc1eab9d 100755 --- a/mylar/importer.py +++ b/mylar/importer.py @@ -255,7 +255,7 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None): # let's remove the non-standard characters here. u_comicnm = comic['ComicName'] u_comicname = u_comicnm.encode('ascii', 'ignore').strip() - dirbad = [':',',','/','?','!'] #in u_comicname or '/' in u_comicname or ',' in u_comicname or '?' in u_comicname: + dirbad = [':',',','/','?','!','\''] #in u_comicname or '/' in u_comicname or ',' in u_comicname or '?' in u_comicname: comicdir = u_comicname for dbd in dirbad: if dbd in u_comicname: diff --git a/mylar/webserve.py b/mylar/webserve.py index 1223aa36..39852f6c 100755 --- a/mylar/webserve.py +++ b/mylar/webserve.py @@ -442,7 +442,7 @@ class WebInterface(object): newaction = action for IssueID in args: #print ("issueID: " + str(IssueID) + "... " + str(newaction)) - if IssueID is None or 'issue_table' in IssueID: + if IssueID is None or 'issue_table' in IssueID or 'history_table' in IssueID: continue else: mi = myDB.action("SELECT * FROM issues WHERE IssueID=?",[IssueID]).fetchone() @@ -455,11 +455,14 @@ class WebInterface(object): logger.info(u"Marking %s %s as %s" % (mi['ComicName'], mi['Issue_Number'], newaction)) #updater.forceRescan(mi['ComicID']) issuestoArchive.append(IssueID) - elif action == 'Wanted': + elif action == 'Wanted' or action == 'Retry': + if action == 'Retry': newaction = 'Wanted' logger.info(u"Marking %s %s as %s" % (mi['ComicName'], mi['Issue_Number'], newaction)) issuesToAdd.append(IssueID) elif action == 'Skipped': logger.info(u"Marking " + str(IssueID) + " as Skipped") + elif action == 'Clear': + myDB.action("DELETE FROM snatched WHERE IssueID=?", [IssueID]) controlValueDict = {"IssueID": IssueID} newValueDict = {"Status": newaction} myDB.upsert("issues", newValueDict, controlValueDict)