mirror of https://github.com/evilhero/mylar
FIX:(#518) When searching, if found title had 'v0#' instead of 'v#' wouldn't match, FIX:(#476) Fixed some issues with Tagging in Windows where it couldn't find the file after it was converted to .cbz or if it came across a .cbz before conversion, IMP: Manual Run improvement - will now attempt to determine correct series based on year and total issue numerical comparison [ie.Batman (1938) vs Batman (2011)]
This commit is contained in:
parent
40685b7dc1
commit
67ca74fc65
|
@ -188,8 +188,11 @@ class PostProcessor(object):
|
||||||
else:
|
else:
|
||||||
ccnt=0
|
ccnt=0
|
||||||
nm=0
|
nm=0
|
||||||
|
watchvals = {}
|
||||||
for cs in comicseries:
|
for cs in comicseries:
|
||||||
watchmatch = filechecker.listFiles(self.nzb_folder,cs['ComicName'],cs['AlternateSearch'], manual="yes")
|
watchvals = {"SeriesYear": cs['ComicYear'],
|
||||||
|
"Total": cs['Total']}
|
||||||
|
watchmatch = filechecker.listFiles(self.nzb_folder,cs['ComicName'],cs['AlternateSearch'], manual=watchvals)
|
||||||
if watchmatch is None:
|
if watchmatch is None:
|
||||||
nm+=1
|
nm+=1
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
import glob
|
import glob
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -16,7 +17,7 @@ import mylar
|
||||||
from mylar import logger
|
from mylar import logger
|
||||||
|
|
||||||
def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
logger.fdebug("dirName:" + dirName)
|
logger.fdebug('dirName:' + dirName)
|
||||||
|
|
||||||
## Set the directory in which comictagger and other external commands are located - IMPORTANT - ##
|
## Set the directory in which comictagger and other external commands are located - IMPORTANT - ##
|
||||||
# ( User may have to modify, depending on their setup, but these are some guesses for now )
|
# ( User may have to modify, depending on their setup, but these are some guesses for now )
|
||||||
|
@ -33,8 +34,8 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
if not os.path.isfile(unrar_cmd):
|
if not os.path.isfile(unrar_cmd):
|
||||||
unrar_cmd = "C:\Program Files (x86)\WinRAR\UnRAR.exe"
|
unrar_cmd = "C:\Program Files (x86)\WinRAR\UnRAR.exe"
|
||||||
if not os.path.isfile(unrar_cmd):
|
if not os.path.isfile(unrar_cmd):
|
||||||
logger.fdebug("Unable to locate UnRAR.exe - make sure it's installed.")
|
logger.fdebug('Unable to locate UnRAR.exe - make sure it is installed.')
|
||||||
logger.fdebug("Aborting meta-tagging.")
|
logger.fdebug('Aborting meta-tagging.')
|
||||||
return "fail"
|
return "fail"
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,8 +49,8 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
try:
|
try:
|
||||||
import configparser
|
import configparser
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.fdebug("configparser not found on system. Please install manually in order to write metadata")
|
logger.fdebug('configparser not found on system. Please install manually in order to write metadata')
|
||||||
logger.fdebug("continuing with PostProcessing, but I'm not using metadata.")
|
logger.fdebug('continuing with PostProcessing, but I am not using metadata.')
|
||||||
return "fail"
|
return "fail"
|
||||||
|
|
||||||
#set this to the lib path (ie. '<root of mylar>/lib')
|
#set this to the lib path (ie. '<root of mylar>/lib')
|
||||||
|
@ -64,9 +65,9 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
file_conversion = True
|
file_conversion = True
|
||||||
file_extension_fixing = True
|
file_extension_fixing = True
|
||||||
if not os.path.exists( unrar_cmd ):
|
if not os.path.exists( unrar_cmd ):
|
||||||
logger.fdebug("WARNING: can't find the unrar command.")
|
logger.fdebug('WARNING: cannot find the unrar command.')
|
||||||
logger.fdebug("File conversion and extension fixing not available")
|
logger.fdebug('File conversion and extension fixing not available')
|
||||||
logger.fdebug("You probably need to edit this script, or install the missing tool, or both!")
|
logger.fdebug('You probably need to edit this script, or install the missing tool, or both!')
|
||||||
file_conversion = False
|
file_conversion = False
|
||||||
file_extension_fixing = False
|
file_extension_fixing = False
|
||||||
|
|
||||||
|
@ -81,13 +82,13 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
comicpath = os.path.join( downloadpath, issueid )
|
comicpath = os.path.join( downloadpath, issueid )
|
||||||
unrar_folder = os.path.join( comicpath , "unrard" )
|
unrar_folder = os.path.join( comicpath , "unrard" )
|
||||||
|
|
||||||
logger.fdebug("---directory settings.")
|
logger.fdebug('---directory settings.')
|
||||||
logger.fdebug("scriptname : " + scriptname)
|
logger.fdebug('scriptname : ' + scriptname)
|
||||||
logger.fdebug("downloadpath : " + downloadpath)
|
logger.fdebug('downloadpath : ' + downloadpath)
|
||||||
logger.fdebug("sabnzbdscriptpath : " + sabnzbdscriptpath)
|
logger.fdebug('sabnzbdscriptpath : ' + sabnzbdscriptpath)
|
||||||
logger.fdebug("comicpath : " + comicpath)
|
logger.fdebug('comicpath : ' + comicpath)
|
||||||
logger.fdebug("unrar_folder : " + unrar_folder)
|
logger.fdebug('unrar_folder : ' + unrar_folder)
|
||||||
logger.fdebug("Running the Post-SabNZBd/Mylar script")
|
logger.fdebug('Running the Post-SabNZBd/Mylar script')
|
||||||
|
|
||||||
if os.path.exists( comicpath ):
|
if os.path.exists( comicpath ):
|
||||||
shutil.rmtree( comicpath )
|
shutil.rmtree( comicpath )
|
||||||
|
@ -108,7 +109,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
if zipfile.is_zipfile( f ):
|
if zipfile.is_zipfile( f ):
|
||||||
base = os.path.splitext( f )[0]
|
base = os.path.splitext( f )[0]
|
||||||
shutil.move( f, base + ".cbz" )
|
shutil.move( f, base + ".cbz" )
|
||||||
logger.fdebug("{0}: renaming {1} to be a cbz".format( scriptname, os.path.basename( f ) ))
|
logger.fdebug('{0}: renaming {1} to be a cbz'.format( scriptname, os.path.basename( f ) ))
|
||||||
|
|
||||||
if file_extension_fixing:
|
if file_extension_fixing:
|
||||||
cbz_list = glob.glob( os.path.join( comicpath, "*.cbz" ) )
|
cbz_list = glob.glob( os.path.join( comicpath, "*.cbz" ) )
|
||||||
|
@ -121,7 +122,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
if not "is not RAR archive" in rar_test_cmd_output:
|
if not "is not RAR archive" in rar_test_cmd_output:
|
||||||
base = os.path.splitext( f )[0]
|
base = os.path.splitext( f )[0]
|
||||||
shutil.move( f, base + ".cbr" )
|
shutil.move( f, base + ".cbr" )
|
||||||
logger.fdebug("{0}: renaming {1} to be a cbr".format( scriptname, os.path.basename( f ) ))
|
logger.fdebug('{0}: renaming {1} to be a cbr'.format( scriptname, os.path.basename( f ) ))
|
||||||
|
|
||||||
# Now rename all CBR files to RAR
|
# Now rename all CBR files to RAR
|
||||||
cbr_list = glob.glob( os.path.join( comicpath, "*.cbr" ) )
|
cbr_list = glob.glob( os.path.join( comicpath, "*.cbr" ) )
|
||||||
|
@ -133,7 +134,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
if file_conversion:
|
if file_conversion:
|
||||||
rar_list = glob.glob( os.path.join( comicpath, "*.rar" ) )
|
rar_list = glob.glob( os.path.join( comicpath, "*.rar" ) )
|
||||||
for f in rar_list:
|
for f in rar_list:
|
||||||
logger.fdebug("{0}: converting {1} to be zip format".format( scriptname, os.path.basename( f ) ))
|
logger.fdebug('{0}: converting {1} to be zip format'.format( scriptname, os.path.basename( f ) ))
|
||||||
basename = os.path.splitext( f )[0]
|
basename = os.path.splitext( f )[0]
|
||||||
zipname = basename + ".cbz"
|
zipname = basename + ".cbz"
|
||||||
|
|
||||||
|
@ -147,10 +148,10 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
#subprocess.Popen( [ unrar_cmd, "x", f ] ).communicate()
|
#subprocess.Popen( [ unrar_cmd, "x", f ] ).communicate()
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
if e.returncode == 3:
|
if e.returncode == 3:
|
||||||
logger.fdebug("[Unrar Error 3] - Broken Archive.")
|
logger.fdebug('[Unrar Error 3] - Broken Archive.')
|
||||||
elif e.returncode == 1:
|
elif e.returncode == 1:
|
||||||
logger.fdebug("[Unrar Error 1] - No files to extract.")
|
logger.fdebug('[Unrar Error 1] - No files to extract.')
|
||||||
logger.fdebug("Marking this as an incomplete download.")
|
logger.fdebug('Marking this as an incomplete download.')
|
||||||
return "unrar error"
|
return "unrar error"
|
||||||
|
|
||||||
shutil.make_archive( basename, "zip", unrar_folder )
|
shutil.make_archive( basename, "zip", unrar_folder )
|
||||||
|
@ -191,7 +192,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
print base
|
print base
|
||||||
print f
|
print f
|
||||||
shutil.move( f, base + ".cbz" )
|
shutil.move( f, base + ".cbz" )
|
||||||
logger.fdebug("{0}: renaming {1} to be a cbz".format( scriptname, os.path.basename( f ) ))
|
logger.fdebug('{0}: renaming {1} to be a cbz'.format( scriptname, os.path.basename( f ) ))
|
||||||
|
|
||||||
if file_extension_fixing:
|
if file_extension_fixing:
|
||||||
if filename.endswith('.cbz'):
|
if filename.endswith('.cbz'):
|
||||||
|
@ -206,7 +207,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
if not "is not RAR archive" in rar_test_cmd_output:
|
if not "is not RAR archive" in rar_test_cmd_output:
|
||||||
base = os.path.splitext( f )[0]
|
base = os.path.splitext( f )[0]
|
||||||
shutil.move( f, base + ".cbr" )
|
shutil.move( f, base + ".cbr" )
|
||||||
logger.fdebug("{0}: renaming {1} to be a cbr".format( scriptname, os.path.basename( f ) ))
|
logger.fdebug('{0}: renaming {1} to be a cbr'.format( scriptname, os.path.basename( f ) ))
|
||||||
|
|
||||||
# Now rename all CBR files to RAR
|
# Now rename all CBR files to RAR
|
||||||
if filename.endswith('.cbr'):
|
if filename.endswith('.cbr'):
|
||||||
|
@ -217,7 +218,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
## Changes any cbr files to cbz files for insertion of metadata ##
|
## Changes any cbr files to cbz files for insertion of metadata ##
|
||||||
if file_conversion:
|
if file_conversion:
|
||||||
f = os.path.join( comicpath, filename )
|
f = os.path.join( comicpath, filename )
|
||||||
logger.fdebug("{0}: converting {1} to be zip format".format( scriptname, os.path.basename( f ) ))
|
logger.fdebug('{0}: converting {1} to be zip format'.format( scriptname, os.path.basename( f ) ))
|
||||||
basename = os.path.splitext( f )[0]
|
basename = os.path.splitext( f )[0]
|
||||||
zipname = basename + ".cbz"
|
zipname = basename + ".cbz"
|
||||||
|
|
||||||
|
@ -226,17 +227,17 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
os.chdir( unrar_folder )
|
os.chdir( unrar_folder )
|
||||||
|
|
||||||
# Extract and zip up
|
# Extract and zip up
|
||||||
logger.fdebug("{0}: Comicpath is " + os.path.join(comicpath,basename))
|
logger.fdebug('{0}: Comicpath is ' + os.path.join(comicpath,basename))
|
||||||
logger.fdebug("{0}: Unrar is " + unrar_folder )
|
logger.fdebug('{0}: Unrar is ' + unrar_folder )
|
||||||
try:
|
try:
|
||||||
# subprocess.Popen( [ unrar_cmd, "x", os.path.join(comicpath,basename) ] ).communicate()
|
#subprocess.Popen( [ unrar_cmd, "x", os.path.join(comicpath,basename) ] ).communicate()
|
||||||
output = check_output( [ unrar_cmd, "x", os.path.join(comicpath,basename) ] )
|
output = check_output( [ unrar_cmd, "x", os.path.join(comicpath,basename) ] )
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
if e.returncode == 3:
|
if e.returncode == 3:
|
||||||
logger.fdebug("[Unrar Error 3] - Broken Archive.")
|
logger.fdebug('[Unrar Error 3] - Broken Archive.')
|
||||||
elif e.returncode == 1:
|
elif e.returncode == 1:
|
||||||
logger.fdebug("[Unrar Error 1] - No files to extract.")
|
logger.fdebug('[Unrar Error 1] - No files to extract.')
|
||||||
logger.fdebug("Marking this as an incomplete download.")
|
logger.fdebug('Marking this as an incomplete download.')
|
||||||
return "unrar error"
|
return "unrar error"
|
||||||
|
|
||||||
shutil.make_archive( basename, "zip", unrar_folder )
|
shutil.make_archive( basename, "zip", unrar_folder )
|
||||||
|
@ -252,25 +253,27 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
try:
|
try:
|
||||||
with open(f): pass
|
with open(f): pass
|
||||||
except:
|
except:
|
||||||
logger.fdebug("No zip file present")
|
logger.fdebug('No zip file present')
|
||||||
return "fail"
|
return "fail"
|
||||||
base = os.path.splitext( f )[0]
|
base = os.path.splitext( f )[0]
|
||||||
shutil.move( f, base + ".cbz" )
|
shutil.move( f, base + ".cbz" )
|
||||||
nfilename = base + ".cbz"
|
nfilename = base + ".cbz"
|
||||||
else:
|
else:
|
||||||
|
logger.fdebug('filename:' + filename)
|
||||||
nfilename = filename
|
nfilename = filename
|
||||||
|
|
||||||
if os.path.isfile( nfilename):
|
if os.path.isfile( nfilename ):
|
||||||
|
logger.fdebug('file exists in given location already.')
|
||||||
file_dir, file_n = os.path.split(nfilename)
|
file_dir, file_n = os.path.split(nfilename)
|
||||||
else:
|
else:
|
||||||
#remove the IssueID from the path
|
#remove the IssueID from the path
|
||||||
file_dir = re.sub(issueid, '', comicpath)
|
file_dir = re.sub(issueid, '', comicpath)
|
||||||
file_n = os.path.split(nfilename)[1]
|
file_n = os.path.split(nfilename)[1]
|
||||||
logger.fdebug("converted directory: " + str(file_dir))
|
logger.fdebug('converted directory: ' + str(file_dir))
|
||||||
logger.fdebug("converted filename: " + str(file_n))
|
logger.fdebug('converted filename: ' + str(file_n))
|
||||||
logger.fdebug("destination path: " + os.path.join(dirName,file_n))
|
logger.fdebug('destination path: ' + os.path.join(dirName,file_n))
|
||||||
logger.fdebug("dirName: " + dirName)
|
logger.fdebug('dirName: ' + dirName)
|
||||||
logger.fdebug("absDirName: " + os.path.abspath(dirName))
|
logger.fdebug('absDirName: ' + os.path.abspath(dirName))
|
||||||
## Tag each CBZ, and move it back to original directory ##
|
## Tag each CBZ, and move it back to original directory ##
|
||||||
if issueid is None:
|
if issueid is None:
|
||||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cr", "-f", "-o", "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cr", "-f", "-o", "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||||
|
@ -280,10 +283,11 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cbl", "-o", "--id", issueid, "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
subprocess.Popen( [ comictagger_cmd, "-s", "-t", "cbl", "-o", "--id", issueid, "--verbose", "--nooverwrite", nfilename ] ).communicate()
|
||||||
|
|
||||||
if os.path.exists(os.path.join(os.path.abspath(dirName),file_n)):
|
if os.path.exists(os.path.join(os.path.abspath(dirName),file_n)):
|
||||||
logger.fdebug("Unable to move - file already exists.")
|
logger.fdebug('Unable to move - file already exists.')
|
||||||
else:
|
else:
|
||||||
shutil.move( nfilename, os.path.join(os.path.abspath(dirName),file_n))
|
shutil.move( os.path.join(comicpath, nfilename), os.path.join(os.path.abspath(dirName),file_n))
|
||||||
logger.fdebug("Sucessfully moved file from temporary path.")
|
#shutil.move( nfilename, os.path.join(os.path.abspath(dirName),file_n))
|
||||||
|
logger.fdebug('Sucessfully moved file from temporary path.')
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
while i < 10:
|
while i < 10:
|
||||||
|
@ -295,7 +299,7 @@ def run (dirName, nzbName=None, issueid=None, manual=None, filename=None):
|
||||||
return os.path.join(os.path.abspath(dirName), file_n)
|
return os.path.join(os.path.abspath(dirName), file_n)
|
||||||
i+=1
|
i+=1
|
||||||
|
|
||||||
logger.fdebug("Failed to remove temporary path : " + str(comicpath))
|
logger.fdebug('Failed to remove temporary path : ' + str(comicpath))
|
||||||
|
|
||||||
return os.path.join(os.path.abspath(dirName),file_n)
|
return os.path.join(os.path.abspath(dirName),file_n)
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,11 @@ def listFiles(dir,watchcomic,AlternateSearch=None,manual=None):
|
||||||
|
|
||||||
#remove the brackets..
|
#remove the brackets..
|
||||||
subnm = re.findall('[^()]+', subname)
|
subnm = re.findall('[^()]+', subname)
|
||||||
|
if len(subnm):
|
||||||
|
logger.fdebug("detected invalid filename - attempting to detect year to continue")
|
||||||
|
subname = re.sub('(.*)\s+(19\d{2}|20\d{2})(.*)', '\\1 (\\2) \\3', subname)
|
||||||
|
subnm = re.findall('[^()]+', subname)
|
||||||
|
|
||||||
subname = subnm[0]
|
subname = subnm[0]
|
||||||
logger.fdebug('subname no brackets: ' + str(subname))
|
logger.fdebug('subname no brackets: ' + str(subname))
|
||||||
subname = re.sub('\_', ' ', subname)
|
subname = re.sub('\_', ' ', subname)
|
||||||
|
@ -269,12 +274,18 @@ def listFiles(dir,watchcomic,AlternateSearch=None,manual=None):
|
||||||
tmpthedigits = justthedigits
|
tmpthedigits = justthedigits
|
||||||
justthedigits = justthedigits.split(' ', 1)[0]
|
justthedigits = justthedigits.split(' ', 1)[0]
|
||||||
|
|
||||||
|
|
||||||
#if the issue has an alphanumeric (issue_exceptions, join it and push it through)
|
#if the issue has an alphanumeric (issue_exceptions, join it and push it through)
|
||||||
logger.fdebug('JUSTTHEDIGITS [' + justthedigits + ']' )
|
logger.fdebug('JUSTTHEDIGITS [' + justthedigits + ']' )
|
||||||
|
if justthedigits.isdigit():
|
||||||
|
digitsvalid = "true"
|
||||||
|
else:
|
||||||
|
digitsvalid = "false"
|
||||||
|
|
||||||
if justthedigits.lower() == 'annual':
|
if justthedigits.lower() == 'annual':
|
||||||
logger.fdebug('ANNUAL [' + tmpthedigits.split(' ', 1)[1] + ']')
|
logger.fdebug('ANNUAL [' + tmpthedigits.split(' ', 1)[1] + ']')
|
||||||
justthedigits += ' ' + tmpthedigits.split(' ', 1)[1]
|
justthedigits += ' ' + tmpthedigits.split(' ', 1)[1]
|
||||||
|
digitsvalid = "true"
|
||||||
else:
|
else:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -284,17 +295,59 @@ def listFiles(dir,watchcomic,AlternateSearch=None,manual=None):
|
||||||
if issexcept.lower() in poss_alpha.lower() and len(poss_alpha) <= len(issexcept):
|
if issexcept.lower() in poss_alpha.lower() and len(poss_alpha) <= len(issexcept):
|
||||||
justthedigits += poss_alpha
|
justthedigits += poss_alpha
|
||||||
logger.fdebug('ALPHANUMERIC EXCEPTION. COMBINING : [' + justthedigits + ']')
|
logger.fdebug('ALPHANUMERIC EXCEPTION. COMBINING : [' + justthedigits + ']')
|
||||||
|
digitsvalid = "true"
|
||||||
break
|
break
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
logger.fdebug('final justthedigits [' + justthedigits + ']')
|
logger.fdebug('final justthedigits [' + justthedigits + ']')
|
||||||
|
if digitsvalid == "false":
|
||||||
|
logger.fdebug('Issue number not properly detected...ignoring.')
|
||||||
|
continue
|
||||||
|
|
||||||
if manual == "yes":
|
|
||||||
|
if manual is not None:
|
||||||
#this is needed for Manual Run to determine matches
|
#this is needed for Manual Run to determine matches
|
||||||
#without this Batman will match on Batman Incorporated, and Batman and Robin, etc..
|
#without this Batman will match on Batman Incorporated, and Batman and Robin, etc..
|
||||||
logger.fdebug('modwatchcomic = ' + modwatchcomic.lower())
|
logger.fdebug('modwatchcomic = ' + modwatchcomic.lower())
|
||||||
logger.fdebug('subname = ' + subname.lower())
|
logger.fdebug('subname = ' + subname.lower())
|
||||||
|
comyear = manual['SeriesYear']
|
||||||
|
issuetotal = manual['Total']
|
||||||
|
logger.fdebug('SeriesYear: ' + str(comyear))
|
||||||
|
logger.fdebug('IssueTotal: ' + str(issuetotal))
|
||||||
|
|
||||||
|
#set the issue/year threshold here.
|
||||||
|
# 2013 - (24issues/12) = 2011.
|
||||||
|
minyear = int(comyear) - (int(issuetotal) / 12)
|
||||||
|
|
||||||
|
#subnm defined at being of module.
|
||||||
|
len_sm = len(subnm)
|
||||||
|
|
||||||
|
#print ("there are " + str(lenm) + " words.")
|
||||||
|
cnt = 0
|
||||||
|
yearmatch = "false"
|
||||||
|
|
||||||
|
while (cnt < len_sm):
|
||||||
|
if subnm[cnt] is None: break
|
||||||
|
if subnm[cnt] == ' ':
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
logger.fdebug(str(cnt) + ". Bracket Word: " + str(subnm[cnt]))
|
||||||
|
|
||||||
|
if subnm[cnt][:-2] == '19' or subnm[cnt][:-2] == '20':
|
||||||
|
logger.fdebug("year detected: " + str(subnm[cnt]))
|
||||||
|
result_comyear = subnm[cnt]
|
||||||
|
if int(result_comyear) >= int(minyear):
|
||||||
|
logger.fdebug(str(result_comyear) + ' is within the series range of ' + str(minyear) + '-' + str(comyear))
|
||||||
|
yearmatch = "true"
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
logger.fdebug(str(result_comyear) + ' - not right - year not within series range of ' + str(minyear) + '-' + str(comyear))
|
||||||
|
yearmatch = "false"
|
||||||
|
break
|
||||||
|
cnt+=1
|
||||||
|
|
||||||
|
if yearmatch == "false": continue
|
||||||
|
|
||||||
#tmpitem = item[:jtd_len]
|
#tmpitem = item[:jtd_len]
|
||||||
# if it's an alphanumeric with a space, rejoin, so we can remove it cleanly just below this.
|
# if it's an alphanumeric with a space, rejoin, so we can remove it cleanly just below this.
|
||||||
|
|
|
@ -643,7 +643,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
||||||
#this handles when there is NO YEAR present in the title, otherwise versioning is way below.
|
#this handles when there is NO YEAR present in the title, otherwise versioning is way below.
|
||||||
ctchk = cleantitle.split()
|
ctchk = cleantitle.split()
|
||||||
for ct in ctchk:
|
for ct in ctchk:
|
||||||
if 'v' in ct.lower() and ct[1:].isdigit():
|
if ct.lower().startswith('v') and ct[1:].isdigit():
|
||||||
logger.fdebug("possible versioning..checking")
|
logger.fdebug("possible versioning..checking")
|
||||||
#we hit a versioning # - account for it
|
#we hit a versioning # - account for it
|
||||||
if ct[1:].isdigit():
|
if ct[1:].isdigit():
|
||||||
|
@ -653,14 +653,13 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
||||||
#cleantitle = re.sub(ct, "(" + str(vers4year) + ")", cleantitle)
|
#cleantitle = re.sub(ct, "(" + str(vers4year) + ")", cleantitle)
|
||||||
#logger.fdebug("volumized cleantitle : " + cleantitle)
|
#logger.fdebug("volumized cleantitle : " + cleantitle)
|
||||||
break
|
break
|
||||||
elif len(ct[1:]) == 1: #v2
|
else:
|
||||||
|
if len(ct) < 4:
|
||||||
logger.fdebug("Version detected as " + str(ct))
|
logger.fdebug("Version detected as " + str(ct))
|
||||||
vers4vol = str(ct)
|
vers4vol = str(ct)
|
||||||
break
|
break
|
||||||
else:
|
logger.fdebug("false version detection..ignoring.")
|
||||||
logger.fdebug("error - unknown length for : " + str(ct))
|
|
||||||
cleantitle = "abcdefghijk 0 (1901).cbz"
|
|
||||||
break
|
|
||||||
if vers4year == "no" and vers4vol == "no":
|
if vers4year == "no" and vers4vol == "no":
|
||||||
# if there are no () in the string, try to add them if it looks like a year (19xx or 20xx)
|
# if there are no () in the string, try to add them if it looks like a year (19xx or 20xx)
|
||||||
if len(re.findall('[^()]+', cleantitle)):
|
if len(re.findall('[^()]+', cleantitle)):
|
||||||
|
@ -725,7 +724,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
||||||
yearmatch = "true"
|
yearmatch = "true"
|
||||||
else:
|
else:
|
||||||
logger.fdebug(str(comyear) + "Fuzzy logic'd the Year and year still didn't match.")
|
logger.fdebug(str(comyear) + "Fuzzy logic'd the Year and year still didn't match.")
|
||||||
#let's do this hear and save a few extra loops ;)
|
#let's do this here and save a few extra loops ;)
|
||||||
#fix for issue dates between Nov-Dec/Jan
|
#fix for issue dates between Nov-Dec/Jan
|
||||||
if IssDateFix != "no" and UseFuzzy is not "2":
|
if IssDateFix != "no" and UseFuzzy is not "2":
|
||||||
if IssDateFix == "01": ComicYearFix = int(ComicYear) - 1
|
if IssDateFix == "01": ComicYearFix = int(ComicYear) - 1
|
||||||
|
@ -842,7 +841,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
||||||
#splitst = splitst - 1
|
#splitst = splitst - 1
|
||||||
|
|
||||||
for tstsplit in splitit:
|
for tstsplit in splitit:
|
||||||
if 'v' in tstsplit.lower() and tstsplit[1:].isdigit():
|
if tstsplit.lower().startswith('v') and tstsplit[1:].isdigit():
|
||||||
logger.fdebug("this has a version #...let's adjust")
|
logger.fdebug("this has a version #...let's adjust")
|
||||||
if len(tstsplit[1:]) == 4: #v2013
|
if len(tstsplit[1:]) == 4: #v2013
|
||||||
logger.fdebug("Version detected as " + str(tstsplit))
|
logger.fdebug("Version detected as " + str(tstsplit))
|
||||||
|
@ -850,8 +849,12 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
||||||
elif len(tstsplit[1:]) == 1: #v2
|
elif len(tstsplit[1:]) == 1: #v2
|
||||||
logger.fdebug("Version detected as " + str(tstsplit))
|
logger.fdebug("Version detected as " + str(tstsplit))
|
||||||
vers4vol = str(tstsplit)
|
vers4vol = str(tstsplit)
|
||||||
|
elif tstsplit[1:].isdigit() and len(tstsplit) < 4:
|
||||||
|
logger.fdebug('Version detected as ' +str(tstsplit))
|
||||||
|
vers4vol = str(tstsplit)
|
||||||
else:
|
else:
|
||||||
logger.fdebug("error - unknown length for : " + str(tstsplit))
|
logger.fdebug("error - unknown length for : " + str(tstsplit))
|
||||||
|
logger.fdebug("volume detection commencing - adjusting length.")
|
||||||
cvers = "true"
|
cvers = "true"
|
||||||
splitst = splitst - 1
|
splitst = splitst - 1
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue