mirror of
https://github.com/evilhero/mylar
synced 2025-03-20 02:25:23 +00:00
FIX: Age of Ultron Issue Numbering for cross-over issues (have AU in issue number) would fail on new pullist, adding a series, checking files, searching, and post-processing (should be all working now)
This commit is contained in:
parent
624238e313
commit
df322cc1d6
7 changed files with 74 additions and 27 deletions
|
@ -43,7 +43,6 @@
|
|||
%>
|
||||
<tr class="grade${grade}">
|
||||
%if pullfilter is True:
|
||||
%if str(weekly['ISSUE']).isdigit() > 0:
|
||||
<td class="publisher">${weekly['PUBLISHER']}</td>
|
||||
<td class="comicname">${weekly['COMIC']}</td>
|
||||
<td class="comicnumber">${weekly['ISSUE']}</td>
|
||||
|
@ -52,7 +51,6 @@
|
|||
<a href="searchit?name=${weekly['COMIC'] | u}&issue=${weekly['ISSUE']}&mode=pullseries"><span class="ui-icon ui-icon-plus"></span>add series</a>
|
||||
%endif
|
||||
</td>
|
||||
%endif
|
||||
%endif
|
||||
</tr>
|
||||
%endfor
|
||||
|
|
|
@ -210,6 +210,10 @@ class PostProcessor(object):
|
|||
issuenum = issuenzb['Issue_Number']
|
||||
#issueno = str(issuenum).split('.')[0]
|
||||
#new CV API - removed all decimals...here we go AGAIN!
|
||||
issue_except = 'None'
|
||||
if 'au' in issuenum.lower():
|
||||
issuenum = re.sub("[^0-9]", "", issuenum)
|
||||
issue_except = ' AU'
|
||||
if '.' in issuenum:
|
||||
iss_find = issuenum.find('.')
|
||||
iss_b4dec = issuenum[:iss_find]
|
||||
|
@ -254,6 +258,8 @@ class PostProcessor(object):
|
|||
prettycomiss = str(zeroadd) + str(int(issueno))
|
||||
else:
|
||||
prettycomiss = str(zeroadd) + str(iss)
|
||||
if issue_except != 'None':
|
||||
prettycomiss = str(prettycomiss) + issue_except
|
||||
self._log("Zero level supplement set to " + str(mylar.ZERO_LEVEL_N) + ". Issue will be set as : " + str(prettycomiss), logger.DEBUG)
|
||||
elif int(issueno) >= 10 and int(issueno) < 100:
|
||||
self._log("issue detected greater than 10, but less than 100", logger.DEBUG)
|
||||
|
@ -269,6 +275,8 @@ class PostProcessor(object):
|
|||
prettycomiss = str(zeroadd) + str(int(issueno))
|
||||
else:
|
||||
prettycomiss = str(zeroadd) + str(iss)
|
||||
if issue_except != 'None':
|
||||
prettycomiss = str(prettycomiss) + issue_except
|
||||
self._log("Zero level supplement set to " + str(mylar.ZERO_LEVEL_N) + ".Issue will be set as : " + str(prettycomiss), logger.DEBUG)
|
||||
else:
|
||||
self._log("issue detected greater than 100", logger.DEBUG)
|
||||
|
@ -276,6 +284,8 @@ class PostProcessor(object):
|
|||
if int(iss_decval) > 0:
|
||||
issueno = str(iss)
|
||||
prettycomiss = str(issueno)
|
||||
if issue_except != 'None':
|
||||
prettycomiss = str(prettycomiss) + issue_except
|
||||
self._log("Zero level supplement set to " + str(mylar.ZERO_LEVEL_N) + ". Issue will be set as : " + str(prettycomiss), logger.DEBUG)
|
||||
else:
|
||||
prettycomiss = str(issueno)
|
||||
|
|
|
@ -195,9 +195,16 @@ def is_number(s):
|
|||
|
||||
def decimal_issue(iss):
|
||||
iss_find = iss.find('.')
|
||||
dec_except = None
|
||||
if iss_find == -1:
|
||||
#no matches for a decimal, assume we're converting from decimal to int.
|
||||
deciss = int(iss) * 1000
|
||||
#match for special issues with alphanumeric numbering...
|
||||
if 'au' in iss.lower():
|
||||
dec_except = 'AU'
|
||||
decex = iss.lower().find('au')
|
||||
deciss = int(iss[:decex]) * 1000
|
||||
else:
|
||||
deciss = int(iss) * 1000
|
||||
else:
|
||||
iss_b4dec = iss[:iss_find]
|
||||
iss_decval = iss[iss_find+1:]
|
||||
|
@ -212,7 +219,7 @@ def decimal_issue(iss):
|
|||
iss = iss_b4dec + "." + iss_decval.rstrip('0')
|
||||
issdec = int(iss_decval.rstrip('0')) * 10
|
||||
deciss = (int(iss_b4dec) * 1000) + issdec
|
||||
return deciss
|
||||
return deciss, dec_except
|
||||
|
||||
def rename_param(comicid, comicname, issue, ofilename, comicyear=None, issueid=None):
|
||||
from mylar import db, logger
|
||||
|
|
|
@ -215,7 +215,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
apikey = newznab_host[1].rstrip()
|
||||
logger.fdebug("using Newznab host of : " + str(host_newznab))
|
||||
|
||||
logger.info(u"Shhh be very quiet...I'm looking for " + ComicName + " issue: " + str(IssueNumber) + "(" + str(ComicYear) + ") using " + str(nzbprov))
|
||||
logger.info(u"Shhh be very quiet...I'm looking for " + ComicName + " issue: " + str(IssueNumber) + " (" + str(ComicYear) + ") using " + str(nzbprov))
|
||||
|
||||
|
||||
if mylar.PREFERRED_QUALITY == 0: filetype = ""
|
||||
|
@ -261,13 +261,14 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
u_ComicName = ComicName.encode('ascii', 'ignore').strip()
|
||||
findcomic.append(u_ComicName)
|
||||
# this should be called elsewhere..redudant code.
|
||||
issue_except = None
|
||||
if '.' in IssueNumber:
|
||||
isschk_find = IssueNumber.find('.')
|
||||
isschk_b4dec = IssueNumber[:isschk_find]
|
||||
isschk_decval = IssueNumber[isschk_find+1:]
|
||||
logger.fdebug("IssueNumber: " + str(IssueNumber))
|
||||
logger.fdebug("..before decimal: " + str(isschk_b4dec))
|
||||
logger.fdebug("...after decimal: " + str(isschk_decval))
|
||||
#logger.fdebug("IssueNumber: " + str(IssueNumber))
|
||||
#logger.fdebug("..before decimal: " + str(isschk_b4dec))
|
||||
#logger.fdebug("...after decimal: " + str(isschk_decval))
|
||||
#--let's make sure we don't wipe out decimal issues ;)
|
||||
if int(isschk_decval) == 0:
|
||||
iss = isschk_b4dec
|
||||
|
@ -284,14 +285,17 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
#Issue_Number = carry-over with decimals
|
||||
#iss = clean issue number (no decimals)
|
||||
intIss = (int(isschk_b4dec) * 1000) + intdec
|
||||
logger.fdebug("int.issue :" + str(intIss))
|
||||
logger.fdebug("int.issue_b4: " + str(isschk_b4dec))
|
||||
logger.fdebug("int.issue_dec: " + str(intdec))
|
||||
#logger.fdebug("int.issue :" + str(intIss))
|
||||
#logger.fdebug("int.issue_b4: " + str(isschk_b4dec))
|
||||
#logger.fdebug("int.issue_dec: " + str(intdec))
|
||||
IssueNumber = iss
|
||||
elif 'au' in IssueNumber.lower():
|
||||
iss = re.sub("[^0-9]", "", IssueNumber) # get just the digits
|
||||
intIss = int(iss) * 1000
|
||||
issue_except = 'AU' # if it contains AU, mark it as an exception (future dict possibly)
|
||||
else:
|
||||
iss = IssueNumber
|
||||
intIss = int(iss) * 1000
|
||||
print ("IssueNUmber:" + str(IssueNumber))
|
||||
#issue_decimal = re.compile(r'[^\d.]+')
|
||||
#issue = issue_decimal.sub('', str(IssueNumber))
|
||||
findcomiciss.append(iss)
|
||||
|
@ -335,17 +339,19 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
while (findloop < (findcount) ):
|
||||
comsrc = comsearch[findloop]
|
||||
while (cmloopit >= 1 ):
|
||||
if issue_except is None: issue_exc = ''
|
||||
else: issue_exc = issue_except
|
||||
if done is True:
|
||||
logger.fdebug("we should break out now - sucessful search previous")
|
||||
findloop == 99
|
||||
break
|
||||
# here we account for issue pattern variations
|
||||
if cmloopit == 3:
|
||||
comsearch[findloop] = comsrc + "%2000" + isssearch[findloop] + "%20" + str(filetype)
|
||||
comsearch[findloop] = comsrc + "%2000" + isssearch[findloop] + "%20" + str(issue_exc) + "%20" + str(filetype)
|
||||
elif cmloopit == 2:
|
||||
comsearch[findloop] = comsrc + "%200" + isssearch[findloop] + "%20" + str(filetype)
|
||||
comsearch[findloop] = comsrc + "%200" + isssearch[findloop] + "%20" + str(issue_exc) + "%20" + str(filetype)
|
||||
elif cmloopit == 1:
|
||||
comsearch[findloop] = comsrc + "%20" + isssearch[findloop] + "%20" + str(filetype)
|
||||
comsearch[findloop] = comsrc + "%20" + isssearch[findloop] + "%20" + str(issue_exc) + "%20" + str(filetype)
|
||||
#logger.fdebug("comsearch: " + str(comsearch))
|
||||
#logger.fdebug("cmloopit: " + str(cmloopit))
|
||||
#logger.fdebug("done: " + str(done))
|
||||
|
@ -522,6 +528,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
#changed this from '' to ' '
|
||||
comic_iss_b4 = re.sub('[\-\:\,]', ' ', str(comic_andiss))
|
||||
comic_iss = comic_iss_b4.replace('.',' ')
|
||||
if issue_except: comic_iss = re.sub(issue_except.lower(), '', comic_iss)
|
||||
logger.fdebug("adjusted nzb comic and issue: " + str(comic_iss))
|
||||
splitit = comic_iss.split(None)
|
||||
#something happened to dognzb searches or results...added a '.' in place of spaces
|
||||
|
@ -644,14 +651,15 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
logger.fdebug("issue we are looking for is : " + str(findcomiciss[findloop]))
|
||||
logger.fdebug("integer value of issue we are looking for : " + str(intIss))
|
||||
|
||||
fnd_iss_except = None
|
||||
#redudant code - should be called elsewhere...
|
||||
if '.' in comic_iss:
|
||||
comisschk_find = comic_iss.find('.')
|
||||
comisschk_b4dec = comic_iss[:comisschk_find]
|
||||
comisschk_decval = comic_iss[comisschk_find+1:]
|
||||
logger.fdebug("Found IssueNumber: " + str(comic_iss))
|
||||
logger.fdebug("..before decimal: " + str(comisschk_b4dec))
|
||||
logger.fdebug("...after decimal: " + str(comisschk_decval))
|
||||
#logger.fdebug("Found IssueNumber: " + str(comic_iss))
|
||||
#logger.fdebug("..before decimal: " + str(comisschk_b4dec))
|
||||
#logger.fdebug("...after decimal: " + str(comisschk_decval))
|
||||
#--let's make sure we don't wipe out decimal issues ;)
|
||||
if int(comisschk_decval) == 0:
|
||||
ciss = comisschk_b4dec
|
||||
|
@ -664,6 +672,11 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
ciss = comisschk_b4dec + "." + comisschk_decval.rstrip('0')
|
||||
cintdec = int(comisschk_decval.rstrip('0')) * 10
|
||||
comintIss = (int(comisschk_b4dec) * 1000) + cintdec
|
||||
# elif 'au' in comic_iss.lower():
|
||||
# ci_rem = comic_iss.lower().find('au')
|
||||
# comintIss = int(comic_iss[:ci_rem]) * 1000
|
||||
# fnd_iss_except = 'AU'
|
||||
# logger.fdebug("AU issue #:" + str(comintIss))
|
||||
else:
|
||||
comintIss = int(comic_iss) * 1000
|
||||
logger.fdebug("issue we found for is : " + str(comic_iss))
|
||||
|
|
|
@ -321,7 +321,7 @@ def forceRescan(ComicID,archive=None):
|
|||
reiss = reissues[n]
|
||||
except IndexError:
|
||||
break
|
||||
int_iss = helpers.decimal_issue(reiss['Issue_Number'])
|
||||
int_iss, iss_except = helpers.decimal_issue(reiss['Issue_Number'])
|
||||
issyear = reiss['IssueDate'][:4]
|
||||
old_status = reiss['Status']
|
||||
|
||||
|
@ -329,6 +329,8 @@ def forceRescan(ComicID,archive=None):
|
|||
|
||||
#if comic in format of "SomeSeries 5(c2c)(2013).cbr" whatever...it'll die.
|
||||
#can't distinguish the 5(c2c) to tell it's the issue #...
|
||||
fnd_iss_except = 'None'
|
||||
#print ("Issue, int_iss, iss_except: " + str(reiss['Issue_Number']) + "," + str(int_iss) + "," + str(iss_except))
|
||||
|
||||
while (som < fcn):
|
||||
#counts get buggered up when the issue is the last field in the filename - ie. '50.cbr'
|
||||
|
@ -360,6 +362,10 @@ def forceRescan(ComicID,archive=None):
|
|||
# fcdigit = fcnew[som].lstrip('0')
|
||||
#fcdigit = str(int(fcnew[som]))
|
||||
fcdigit = int(fcnew[som]) * 1000
|
||||
if 'au' in fcnew[som+1].lower():
|
||||
#print ("AU detected")
|
||||
#if the 'AU' is in 005AU vs 005 AU it will yield different results.
|
||||
fnd_iss_except = 'AU'
|
||||
else:
|
||||
#fcdigit = "0"
|
||||
fcdigit = 0
|
||||
|
@ -407,17 +413,27 @@ def forceRescan(ComicID,archive=None):
|
|||
#logger.fdebug("int_iss: " + str(int_iss))
|
||||
if "." in str(int_iss):
|
||||
int_iss = helpers.decimal_issue(int_iss)
|
||||
#logger.fdebug("this is the int issue:" + str(int_iss))
|
||||
|
||||
#print("this is the int issue:" + str(int_iss))
|
||||
#print("this is the fcdigit:" + str(fcdigit))
|
||||
if int(fcdigit) == int_iss:
|
||||
#print ("fnd_iss_except: " + str(fnd_iss_except))
|
||||
#print ("iss_except: " + str(iss_except))
|
||||
if fnd_iss_except != 'None' and iss_except == 'AU':
|
||||
if fnd_iss_except.lower() == iss_except.lower():
|
||||
logger.fdebug("matched for AU")
|
||||
else:
|
||||
#logger.fdebug("this is not an AU match..ignoring result.")
|
||||
break
|
||||
elif fnd_iss_except == 'None' and iss_except == 'AU':break
|
||||
elif fnd_iss_except == 'AU' and iss_except == 'None':break
|
||||
#if issyear in fcnew[som+1]:
|
||||
# print "matched on year:" + str(issyear)
|
||||
#issuedupechk here.
|
||||
if int(fcdigit) in issuedupechk:
|
||||
if int(fcdigit) in issuedupechk and fnd_iss_except.lower() == iss_except.lower():
|
||||
logger.fdebug("duplicate issue detected - not counting this: " + str(tmpfc['ComicFilename']))
|
||||
issuedupe = "yes"
|
||||
break
|
||||
logger.fdebug("matched...issue: " + rescan['ComicName'] + " --- " + str(int_iss))
|
||||
#logger.fdebug("matched...issue: " + rescan['ComicName'] + "#" + str(reiss['Issue_Number']) + " --- " + str(int_iss))
|
||||
havefiles+=1
|
||||
haveissue = "yes"
|
||||
isslocation = str(tmpfc['ComicFilename'])
|
||||
|
@ -431,6 +447,7 @@ def forceRescan(ComicID,archive=None):
|
|||
#else:
|
||||
# if the issue # matches, but there is no year present - still match.
|
||||
# determine a way to match on year if present, or no year (currently).
|
||||
|
||||
som+=1
|
||||
if haveissue == "yes": break
|
||||
n+=1
|
||||
|
|
|
@ -519,7 +519,7 @@ class WebInterface(object):
|
|||
if popit:
|
||||
w_results = myDB.select("SELECT PUBLISHER, ISSUE, COMIC, STATUS from weekly")
|
||||
for weekly in w_results:
|
||||
if weekly['ISSUE'].isdigit():
|
||||
if weekly['ISSUE'].isdigit() or 'au' in weekly['ISSUE'].lower():
|
||||
weeklyresults.append({
|
||||
"PUBLISHER" : weekly['PUBLISHER'],
|
||||
"ISSUE" : weekly['ISSUE'],
|
||||
|
|
|
@ -212,8 +212,10 @@ def pullit():
|
|||
#print ("pub: " + str(pub))
|
||||
#print ("issue: " + str(issue))
|
||||
#--let's make sure we don't wipe out decimal issues ;)
|
||||
issue_decimal = re.compile(r'[^\d.]+')
|
||||
issue = issue_decimal.sub('', str(issue))
|
||||
if '.' in issue:
|
||||
issue_decimal = re.compile(r'[^\d.]+')
|
||||
issue = issue_decimal.sub('', str(issue))
|
||||
else: issue = re.sub('#','', issue)
|
||||
#issue = re.sub("\D", "", str(issue))
|
||||
#store the previous comic/issue for comparison to filter out duplicate issues/alt covers
|
||||
#print ("Previous Comic & Issue: " + str(prevcomic) + "--" + str(previssue))
|
||||
|
|
Loading…
Add table
Reference in a new issue