From 93077a0532f8f474652e0d3f518c0dec50288386 Mon Sep 17 00:00:00 2001 From: evilhero Date: Sat, 11 Jun 2016 22:51:52 -0400 Subject: [PATCH] FIX: When manual post-processing if filename didn't have a volume label, or a valid year - would error out, IMP: Added additional date recognition fornat of (YYYYMM) --- mylar/PostProcessor.py | 11 +++++++---- mylar/filechecker.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mylar/PostProcessor.py b/mylar/PostProcessor.py index 7b7d87d9..2a605a65 100755 --- a/mylar/PostProcessor.py +++ b/mylar/PostProcessor.py @@ -391,6 +391,13 @@ class PostProcessor(object): continue else: datematch = "True" + if issuechk['ReleaseDate'] is not None and issuechk['ReleaseDate'] != '0000-00-00': + monthval = issuechk['ReleaseDate'] + watch_issueyear = issuechk['ReleaseDate'][:4] + else: + monthval = issuechk['IssueDate'] + watch_issueyear = issuechk['IssueDate'][:4] + if len(watchmatch) >= 1 and watchmatch['issue_year'] is not None: #if the # of matches is more than 1, we need to make sure we get the right series #compare the ReleaseDate for the issue, to the found issue date in the filename. @@ -404,14 +411,10 @@ class PostProcessor(object): #logger.info(module + ' ReleaseDate: ' + str(issuechk['ReleaseDate'])) #logger.info(module + ' IssueDate: ' + str(issuechk['IssueDate'])) if issuechk['ReleaseDate'] is not None and issuechk['ReleaseDate'] != '0000-00-00': - monthval = issuechk['ReleaseDate'] - watch_issueyear = issuechk['ReleaseDate'][:4] if int(issuechk['ReleaseDate'][:4]) < int(watchmatch['issue_year']): logger.fdebug(module + '[ISSUE-VERIFY] ' + str(issuechk['ReleaseDate']) + ' is before the issue year of ' + str(watchmatch['issue_year']) + ' that was discovered in the filename') datematch = "False" else: - monthval = issuechk['IssueDate'] - watch_issueyear = issuechk['IssueDate'][:4] if int(issuechk['IssueDate'][:4]) < int(watchmatch['issue_year']): logger.fdebug(module + '[ISSUE-VERIFY] ' + str(issuechk['IssueDate']) + ' is before the issue year ' + str(watchmatch['issue_year']) + ' that was discovered in the filename') datematch = "False" diff --git a/mylar/filechecker.py b/mylar/filechecker.py index e6d9b44e..b0ba88f5 100755 --- a/mylar/filechecker.py +++ b/mylar/filechecker.py @@ -1077,7 +1077,7 @@ class FileChecker(object): # Jan 1990 # January1990''' - fmts = ('%Y','%b %d, %Y','%b %d, %Y','%B %d, %Y','%B %d %Y','%m/%d/%Y','%m/%d/%y','%b %Y','%B%Y','%b %d,%Y','%m-%Y','%B %Y','%Y-%m-%d','%Y-%m') + fmts = ('%Y','%b %d, %Y','%B %d, %Y','%B %d %Y','%m/%d/%Y','%m/%d/%y','%b %Y','%B%Y','%b %d,%Y','%m-%Y','%B %Y','%Y-%m-%d','%Y-%m','%Y%m') parsed=[] for e in txt.splitlines():