From 7c7aef0d38d8fe58fd3d67398f888a15382c3b73 Mon Sep 17 00:00:00 2001 From: evilhero Date: Wed, 9 Nov 2016 11:49:06 -0500 Subject: [PATCH] FIX: Fix for filechecking series that had more 200 issues in them and was incorrectly setting the status to Archived for issues, FIX: When copying issues to story-arc directory will now check to see if multiple destination directory is in effect and grab file from the correct location --- mylar/updater.py | 13 ++++--------- mylar/webserve.py | 48 ++++++++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/mylar/updater.py b/mylar/updater.py index 46da0019..ab834e7c 100755 --- a/mylar/updater.py +++ b/mylar/updater.py @@ -1089,7 +1089,6 @@ def forceRescan(ComicID, archive=None, module=None): old_status = reann['Status'] fcdigit = helpers.issuedigits(re.sub('annual', '', temploc.lower()).strip()) - logger.fdebug(module + ' fcdigit:' + str(fcdigit)) if int(fcdigit) == int_iss: logger.fdebug(module + ' [' + str(ANNComicID) + '] Annual match - issue : ' + str(int_iss)) @@ -1267,18 +1266,18 @@ def forceRescan(ComicID, archive=None, module=None): pass else: for chk in chkthis: - logger.info('OLDSTATUS: ' + chk['Issue_Number'] + ' -- ' + chk['Status']) - a = [True for x in update_iss if str(x['IssueID']) == str(chk['IssueID'])] - if a is True: + if chk['IssueID'] in issID_to_ignore: continue + old_status = chk['Status'] + if old_status == "Skipped": if mylar.AUTOWANT_ALL: issStatus = "Wanted" else: issStatus = "Skipped" elif old_status == "Archived": - issStatus = "Archived" #"Downloaded" + issStatus = "Archived" elif old_status == "Downloaded": issStatus = "Archived" elif old_status == "Wanted": @@ -1290,8 +1289,6 @@ def forceRescan(ComicID, archive=None, module=None): else: issStatus = "Skipped" - logger.info('NEWSTATUS: ' + chk['Issue_Number'] + ' -- ' + issStatus) - update_iss.append({"IssueID": chk['IssueID'], "Status": issStatus}) @@ -1386,8 +1383,6 @@ def forceRescan(ComicID, archive=None, module=None): totalarc = arcfiles + archivedissues havefiles = havefiles + archivedissues #arcfiles already tallied in havefiles in above segment - logger.fdebug(module + ' arcfiles : ' + str(arcfiles)) - logger.fdebug(module + ' havefiles: ' + str(havefiles)) #combined total for dispay total purposes only. combined_total = iscnt + anncnt #(rescan['Total'] + anncnt) diff --git a/mylar/webserve.py b/mylar/webserve.py index f97ba9d7..ec353d9d 100755 --- a/mylar/webserve.py +++ b/mylar/webserve.py @@ -2837,35 +2837,41 @@ class WebInterface(object): logger.fdebug("Already have " + issue['ComicName'] + " :# " + issue['Issue_Number']) if issue['Status'] == 'Downloaded': issloc = os.path.join(m_arc['match_filedirectory'], issue['Location']) - logger.fdebug('source location set to : ' + issloc) + #check multiple destination directory usage here. + if not os.path.isfile(issloc): + if all([mylar.MULTIPLE_DEST_DIRS is not None, mylar.MULTIPLE_DEST_DIRS != 'None', os.path.join(mylar.MULTIPLE_DEST_DIRS, os.path.basename(m_arc['match_filedirectory'])) != issloc, os.path.exists(os.path.join(mylar.MULTIPLE_DEST_DIRS, os.path.basename(m_arc['match_filedirectory'])))]): + issloc = os.path.join(mylar.MULTIPLE_DEST_DIRS, os.path.basename(m_arc['match_filedirectory']), issue['Location']) + if not os.path.isfile(issloc): + logger.warn('Source file cannot be located. Please do a Recheck for the specific series to ensure everything is correct.') + continue + logger.fdebug('source location set to : ' + issloc) logger.fdebug('Destination location set to : ' + m_arc['destination_location']) if mylar.COPY2ARCDIR: logger.fdebug('Attempting to copy into StoryArc directory') #copy into StoryArc directory... - if os.path.isfile(issloc): - if mylar.READ2FILENAME: - readorder = helpers.renamefile_readingorder(m_arc['match_readingorder']) - dfilename = str(readorder) + "-" + issue['Location'] - else: - dfilename = issue['Location'] - - dstloc = os.path.join(m_arc['destination_location'], dfilename) - - if not os.path.isfile(dstloc): - logger.fdebug('Copying ' + issloc + ' to ' + dstloc) - try: - fileoperation = helpers.file_ops(issloc, dstloc, arc=True) - if not fileoperation: - raise OSError - except (OSError, IOError): - logger.fdebug(module + ' Failed to ' + mylar.FILE_OPTS + ' ' + issloc + ' - check directories and manually re-run.') - else: - logger.fdebug('Destination file exists: ' + dstloc) + if mylar.READ2FILENAME: + readorder = helpers.renamefile_readingorder(m_arc['match_readingorder']) + dfilename = str(readorder) + "-" + issue['Location'] else: - logger.fdebug('Source file does not exist: ' + issloc) + dfilename = issue['Location'] + dstloc = os.path.join(m_arc['destination_location'], dfilename) + + if not os.path.isfile(dstloc): + logger.fdebug('Copying ' + issloc + ' to ' + dstloc) + try: + fileoperation = helpers.file_ops(issloc, dstloc, arc=True) + if not fileoperation: + raise OSError + except (OSError, IOError): + logger.fdebug(module + ' Failed to ' + mylar.FILE_OPTS + ' ' + issloc + ' - check directories and manually re-run.') + else: + logger.fdebug('Destination file exists: ' + dstloc) + else: + logger.fdebug('Source file does not exist: ' + issloc) + else: logger.fdebug("We don't have " + issue['ComicName'] + " :# " + issue['Issue_Number']) ctrlVal = {"IssueArcID": m_arc['match_issuearcid']}