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

This commit is contained in:
evilhero 2016-11-09 11:49:06 -05:00
parent 0e5327d4d6
commit 7c7aef0d38
2 changed files with 31 additions and 30 deletions

View File

@ -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)

View File

@ -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']}