mirror of https://github.com/evilhero/mylar
Fix: Endless search/downloading loop resulting in lots of comics, Fix: incorrect comics being matched/downloaded occasionally, Fix: Wanted issues should be marked in Details page now, or in Upcoming tab, Imp: Refresh comics on startup only for those comics detected as having a new release and mark as wanted if available/not, Fix: Removed some erroneous logging from parser...
This commit is contained in:
parent
d70f482599
commit
0381d9c918
|
@ -40,7 +40,7 @@ def is_exists(comicid):
|
|||
return False
|
||||
|
||||
|
||||
def addComictoDB(comicid,mismatch=None):
|
||||
def addComictoDB(comicid,mismatch=None,pullupd=None):
|
||||
# Putting this here to get around the circular import. Will try to use this to update images at later date.
|
||||
from mylar import cache
|
||||
|
||||
|
@ -363,29 +363,30 @@ def addComictoDB(comicid,mismatch=None):
|
|||
|
||||
logger.info(u"Updating complete for: " + comic['ComicName'])
|
||||
|
||||
if pullupd == "no":
|
||||
# lets' check the pullist for anyting at this time as well since we're here.
|
||||
if mylar.AUTOWANT_UPCOMING:
|
||||
logger.info(u"Checking this week's pullist for new issues of " + str(comic['ComicName']))
|
||||
updater.newpullcheck()
|
||||
if mylar.AUTOWANT_UPCOMING:
|
||||
logger.info(u"Checking this week's pullist for new issues of " + str(comic['ComicName']))
|
||||
updater.newpullcheck()
|
||||
|
||||
#here we grab issues that have been marked as wanted above...
|
||||
|
||||
results = myDB.select("SELECT * FROM issues where ComicID=? AND Status='Wanted'", [comicid])
|
||||
if results:
|
||||
logger.info(u"Attempting to grab wanted issues for : " + comic['ComicName'])
|
||||
results = myDB.select("SELECT * FROM issues where ComicID=? AND Status='Wanted'", [comicid])
|
||||
if results:
|
||||
logger.info(u"Attempting to grab wanted issues for : " + comic['ComicName'])
|
||||
|
||||
for result in results:
|
||||
foundNZB = "none"
|
||||
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL) and (mylar.SAB_HOST):
|
||||
foundNZB = search.searchforissue(result['IssueID'])
|
||||
if foundNZB == "yes":
|
||||
updater.foundsearch(result['ComicID'], result['IssueID'])
|
||||
else: logger.info(u"No issues marked as wanted for " + comic['ComicName'])
|
||||
for result in results:
|
||||
foundNZB = "none"
|
||||
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL) and (mylar.SAB_HOST):
|
||||
foundNZB = search.searchforissue(result['IssueID'])
|
||||
if foundNZB == "yes":
|
||||
updater.foundsearch(result['ComicID'], result['IssueID'])
|
||||
else: logger.info(u"No issues marked as wanted for " + comic['ComicName'])
|
||||
|
||||
logger.info(u"Finished grabbing what I could.")
|
||||
logger.info(u"Finished grabbing what I could.")
|
||||
|
||||
|
||||
def GCDimport(gcomicid):
|
||||
def GCDimport(gcomicid, pullupd=None):
|
||||
# this is for importing via GCD only and not using CV.
|
||||
# used when volume spanning is discovered for a Comic (and can't be added using CV).
|
||||
# Issue Counts are wrong (and can't be added).
|
||||
|
@ -633,24 +634,25 @@ def GCDimport(gcomicid):
|
|||
|
||||
logger.info(u"Updating complete for: " + ComicName)
|
||||
|
||||
# lets' check the pullist for anyting at this time as well since we're here.
|
||||
if mylar.AUTOWANT_UPCOMING:
|
||||
logger.info(u"Checking this week's pullist for new issues of " + str(ComicName))
|
||||
updater.newpullcheck()
|
||||
if pullupd == "no":
|
||||
# lets' check the pullist for anyting at this time as well since we're here.
|
||||
if mylar.AUTOWANT_UPCOMING:
|
||||
logger.info(u"Checking this week's pullist for new issues of " + str(ComicName))
|
||||
updater.newpullcheck()
|
||||
|
||||
#here we grab issues that have been marked as wanted above...
|
||||
#here we grab issues that have been marked as wanted above...
|
||||
|
||||
results = myDB.select("SELECT * FROM issues where ComicID=? AND Status='Wanted'", [gcomicid])
|
||||
if results:
|
||||
logger.info(u"Attempting to grab wanted issues for : " + ComicName)
|
||||
results = myDB.select("SELECT * FROM issues where ComicID=? AND Status='Wanted'", [gcomicid])
|
||||
if results:
|
||||
logger.info(u"Attempting to grab wanted issues for : " + ComicName)
|
||||
|
||||
for result in results:
|
||||
foundNZB = "none"
|
||||
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL) and (mylar.SAB_HOST):
|
||||
foundNZB = search.searchforissue(result['IssueID'])
|
||||
if foundNZB == "yes":
|
||||
updater.foundsearch(result['ComicID'], result['IssueID'])
|
||||
else: logger.info(u"No issues marked as wanted for " + ComicName)
|
||||
for result in results:
|
||||
foundNZB = "none"
|
||||
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL) and (mylar.SAB_HOST):
|
||||
foundNZB = search.searchforissue(result['IssueID'])
|
||||
if foundNZB == "yes":
|
||||
updater.foundsearch(result['ComicID'], result['IssueID'])
|
||||
else: logger.info(u"No issues marked as wanted for " + ComicName)
|
||||
|
||||
logger.info(u"Finished grabbing what I could.")
|
||||
logger.info(u"Finished grabbing what I could.")
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ def GCDAdd(gcdcomicid):
|
|||
soup = BeautifulSoup ( resp )
|
||||
logger.fdebug("SeriesName section...")
|
||||
parsen = soup.find("span", {"id" : "series_name"})
|
||||
logger.fdebug("series name (UNPARSED): " + str(parsen))
|
||||
#logger.fdebug("series name (UNPARSED): " + str(parsen))
|
||||
subpar = parsen('a')[0]
|
||||
logger.fdebug("series name parsed value: " + str(subpar))
|
||||
resultName = subpar.findNext(text=True)
|
||||
|
@ -370,14 +370,14 @@ def GCDAdd(gcdcomicid):
|
|||
logger.fdebug("unable to find any covers - setting to None")
|
||||
else:
|
||||
subcoverst = coverst('img',src=True)[0]
|
||||
logger.fdebug("cover (UNPARSED) : " + str(subcoverst))
|
||||
#logger.fdebug("cover (UNPARSED) : " + str(subcoverst))
|
||||
gcdcover = subcoverst['src']
|
||||
logger.fdebug("Cover: " + str(gcdcover))
|
||||
#covers end
|
||||
#publisher start
|
||||
logger.fdebug("Publisher section...")
|
||||
pubst = soup.find("div", {"class" : "item_data"})
|
||||
logger.fdebug("publisher (UNPARSED): " + str(pubst))
|
||||
#logger.fdebug("publisher (UNPARSED): " + str(pubst))
|
||||
try:
|
||||
subpubst = pubst('a')[0]
|
||||
logger.fdebug("publisher parsed value : " + str(subpubst))
|
||||
|
@ -387,7 +387,7 @@ def GCDAdd(gcdcomicid):
|
|||
logger.fdebug("Publisher: " + str(publisher))
|
||||
#publisher end
|
||||
parsed = soup.find("div", {"id" : "series_data"})
|
||||
logger.fdebug("series_data: " + str(parsed))
|
||||
#logger.fdebug("series_data: " + str(parsed))
|
||||
#print ("parse:" + str(parsed))
|
||||
subtxt3 = parsed.find("dd", {"id" : "publication_dates"})
|
||||
logger.fdebug("publication_dates: " + str(subtxt3))
|
||||
|
|
164
mylar/search.py
164
mylar/search.py
|
@ -13,6 +13,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mylar. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import mylar
|
||||
from mylar import logger, db, updater, helpers, parseit, findcomicfeed
|
||||
|
@ -80,7 +81,6 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
#fix for issue dates between Nov-Dec/Jan
|
||||
IssDt = str(IssueDate)[5:7]
|
||||
if IssDt == "12" or IssDt == "11":
|
||||
ComicYearFix = str(int(ComicYear) + 1)
|
||||
IssDateFix = "yes"
|
||||
else:
|
||||
IssDateFix = "no"
|
||||
|
@ -102,16 +102,16 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, newznab_host)
|
||||
if findit == 'yes':
|
||||
break
|
||||
if IssDateFix == "yes":
|
||||
logger.info(u"Hang on - this issue was published between Nov/Dec of " + str(ComicYear) + "...adjusting to " + str(ComicYearFix) + " and retrying...")
|
||||
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, newznab_host)
|
||||
if findit == 'yes':
|
||||
break
|
||||
elif AlternateSearch is not None:
|
||||
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + " " + str(ComicYearFix))
|
||||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, newznab_host)
|
||||
if findit == 'yes':
|
||||
break
|
||||
# if IssDateFix == "yes":
|
||||
# logger.info(u"Hang on - this issue was published between Nov/Dec of " + str(ComicYear) + "...adjusting to " + str(ComicYearFix) + " and retrying...")
|
||||
# findit = NZB_SEARCH(ComicName, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, newznab_host)
|
||||
# if findit == 'yes':
|
||||
# break
|
||||
# elif AlternateSearch is not None:
|
||||
# logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + " " + str(ComicYearFix))
|
||||
# findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID, newznab_host)
|
||||
# if findit == 'yes':
|
||||
# break
|
||||
|
||||
nzbpr-=1
|
||||
|
||||
|
@ -128,16 +128,16 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
if IssDateFix == "yes":
|
||||
logger.info(u"Hang on - this issue was published between Nov/Dec of " + str(ComicYear) + "...adjusting to " + str(ComicYearFix) + " and retrying...")
|
||||
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
elif AlternateSearch is not None:
|
||||
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + str(ComicYearFix))
|
||||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
# if IssDateFix == "yes":
|
||||
# logger.info(u"Hang on - this issue was published between Nov/Dec of " + str(ComicYear) + "...adjusting to " + str(ComicYearFix) + " and retrying...")
|
||||
# findit = NZB_SEARCH(ComicName, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
# if findit == 'yes':
|
||||
# break
|
||||
# elif AlternateSearch is not None:
|
||||
# logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + str(ComicYearFix))
|
||||
# findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
# if findit == 'yes':
|
||||
# break
|
||||
|
||||
nzbpr-=1
|
||||
|
||||
|
@ -158,16 +158,16 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
if IssDateFix == "yes":
|
||||
logger.info(u"Hang on - this issue was published between Nov/Dec of " + str(ComicYear) + "...adjusting to " + str(ComicYearFix) + " and retrying...")
|
||||
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
elif AlternateSearch is not None:
|
||||
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + str(ComicYearFix))
|
||||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
#if IssDateFix == "yes":
|
||||
# logger.info(u"Hang on - this issue was published between Nov/Dec of " + str(ComicYear) + "...adjusting to " + str(ComicYearFix) + " and retrying...")
|
||||
# findit = NZB_SEARCH(ComicName, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
# if findit == 'yes':
|
||||
# break
|
||||
# elif AlternateSearch is not None:
|
||||
# logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + str(ComicYearFix))
|
||||
# findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
# if findit == 'yes':
|
||||
# break
|
||||
|
||||
nzbpr-=1
|
||||
|
||||
|
@ -189,16 +189,16 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
if IssDateFix == "yes":
|
||||
logger.info(u"Hang on - this issue was published between Nov/Dec of " + str(ComicYear) + "...adjusting to " + str(ComicYearFix) + " and retrying...")
|
||||
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
elif AlternateSearch is not None:
|
||||
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + str(ComicYearFix))
|
||||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
#if IssDateFix == "yes":
|
||||
# logger.info(u"Hang on - this issue was published between Nov/Dec of " + str(ComicYear) + "...adjusting to " + str(ComicYearFix) + " and retrying...")
|
||||
# findit = NZB_SEARCH(ComicName, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
# if findit == 'yes':
|
||||
# break
|
||||
# elif AlternateSearch is not None:
|
||||
# logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + str(ComicYearFix))
|
||||
# findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYearFix, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
# if findit == 'yes':
|
||||
# break
|
||||
|
||||
nzbpr-=1
|
||||
|
||||
|
@ -284,12 +284,20 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
cm1 = re.sub(" ", "%20", str(findcomic[findcount]))
|
||||
cm = re.sub("\&", "%26", str(cm1))
|
||||
#print (cmi)
|
||||
if len(str(findcomiciss[findcount])) == 1:
|
||||
cmloopit = 3
|
||||
elif len(str(findcomiciss[findcount])) == 2:
|
||||
cmloopit = 2
|
||||
if '.' in findcomiciss[findcount]:
|
||||
if len(str(isschk_b4dec)) == 3:
|
||||
cmloopit = 1
|
||||
elif len(str(isschk_b4dec)) == 2:
|
||||
cmloopit = 2
|
||||
elif len(str(isschk_b4dec)) == 1:
|
||||
cmloopit = 3
|
||||
else:
|
||||
cmloopit = 1
|
||||
if len(str(findcomiciss[findcount])) == 1:
|
||||
cmloopit = 3
|
||||
elif len(str(findcomiciss[findcount])) == 2:
|
||||
cmloopit = 2
|
||||
else:
|
||||
cmloopit = 1
|
||||
isssearch.append(str(findcomiciss[findcount]))
|
||||
comsearch.append(cm)
|
||||
findcount+=1
|
||||
|
@ -299,7 +307,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
#print ("------RESULTS OF SEARCH-------------------")
|
||||
findloop = 0
|
||||
foundcomic = []
|
||||
|
||||
done = False
|
||||
#---issue problem
|
||||
# if issue is '011' instead of '11' in nzb search results, will not have same
|
||||
# results. '011' will return different than '11', as will '009' and '09'.
|
||||
|
@ -307,6 +315,10 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
while (findloop < (findcount) ):
|
||||
comsrc = comsearch[findloop]
|
||||
while (cmloopit >= 1 ):
|
||||
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)
|
||||
|
@ -314,6 +326,9 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
comsearch[findloop] = comsrc + "%200" + isssearch[findloop] + "%20" + str(filetype)
|
||||
elif cmloopit == 1:
|
||||
comsearch[findloop] = comsrc + "%20" + isssearch[findloop] + "%20" + str(filetype)
|
||||
logger.fdebug("comsearch: " + str(comsearch))
|
||||
logger.fdebug("cmloopit: " + str(cmloopit))
|
||||
logger.fdebug("done: " + str(done))
|
||||
if nzbprov != 'experimental':
|
||||
if nzbprov == 'dognzb':
|
||||
findurl = "http://dognzb.cr/api?t=search&apikey=" + str(apikey) + "&q=" + str(comsearch[findloop]) + "&o=xml&cat=7030"
|
||||
|
@ -380,6 +395,14 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
else:
|
||||
logger.fdebug(str(comyear) + " - not right - years do not match")
|
||||
yearmatch = "false"
|
||||
#let's do this hear and save a few extra loops ;)
|
||||
#fix for issue dates between Nov-Dec/Jan
|
||||
if IssDateFix == "yes":
|
||||
ComicYearFix = int(ComicYear) + 1
|
||||
if str(ComicYearFix) in result_comyear:
|
||||
logger.fdebug("further analysis reveals this was published inbetween Nov-Jan, incrementing year to " + str(ComicYearFix) + " has resulted in a match!")
|
||||
yearmatch = "true"
|
||||
|
||||
if 'digital' in m[cnt] and len(m[cnt]) == 7:
|
||||
logger.fdebug("digital edition detected")
|
||||
pass
|
||||
|
@ -413,11 +436,21 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
#compares - if the last digit and second last digit are #'s seperated by spaces assume decimal
|
||||
comic_iss = splitit[(len(splitit)-1)]
|
||||
splitst = len(splitit) - 1
|
||||
if splitit[(len(splitit)-2)].isdigit():
|
||||
changeup = "." + splitit[(len(splitit)-1)]
|
||||
logger.fdebug("changeup to decimal: " + str(changeup))
|
||||
comic_iss = splitit[(len(splitit)-2)] + "." + comic_iss
|
||||
splitst = len(splitit) - 2
|
||||
if splitit[(len(splitit)-2)].isdigit():
|
||||
# for series that have a digit at the end, it screws up the logistics.
|
||||
i = 1
|
||||
chg_comic = splitit[0]
|
||||
while (i < (len(splitit)-1)):
|
||||
chg_comic = chg_comic + " " + splitit[i]
|
||||
i+=1
|
||||
logger.fdebug("chg_comic:" + str(chg_comic))
|
||||
if chg_comic.upper() == findcomic[findloop].upper():
|
||||
logger.fdebug("series contains numerics...adjusting..")
|
||||
else:
|
||||
changeup = "." + splitit[(len(splitit)-1)]
|
||||
logger.fdebug("changeup to decimal: " + str(changeup))
|
||||
comic_iss = splitit[(len(splitit)-2)] + "." + comic_iss
|
||||
splitst = len(splitit) - 2
|
||||
|
||||
logger.fdebug("adjusting from: " + str(comic_iss_b4) + " to: " + str(comic_iss))
|
||||
#bmm = re.findall('v\d', comic_iss)
|
||||
|
@ -426,7 +459,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
|
||||
# make sure that things like - in watchcomic are accounted for when comparing to nzb.
|
||||
watchcomic_split = re.sub('[\-\:\,]', ' ', findcomic[findloop]).split(None)
|
||||
|
||||
|
||||
logger.fdebug(str(splitit) + " nzb series word count: " + str(splitst))
|
||||
logger.fdebug(str(watchcomic_split) + " watchlist word count: " + str(len(watchcomic_split)))
|
||||
if (splitst) != len(watchcomic_split):
|
||||
|
@ -474,13 +507,18 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
n+=1
|
||||
#set the match threshold to 80% (for now)
|
||||
# if it's less than 80% consider it a non-match and discard.
|
||||
spercent = ( scount/int(len(splitit)) ) * 100
|
||||
logger.fdebug(str(spercent) + "% match")
|
||||
#if spercent >= 80:
|
||||
# logger.fdebug("it's a go captain... - we matched " + str(spercent) + "%!")
|
||||
#if spercent < 80:
|
||||
# logger.fdebug("failure - we only got " + str(spercent) + "% right!")
|
||||
# continue
|
||||
#splitit has to splitit-1 because last position is issue.
|
||||
wordcnt = int(scount)
|
||||
logger.fdebug("scount:" + str(wordcnt))
|
||||
totalcnt = int(len(splitit)-1)
|
||||
logger.fdebug("splitit-len:" + str(totalcnt))
|
||||
spercent = (wordcnt/totalcnt) * 100
|
||||
logger.fdebug("we got " + str(spercent) + " percent.")
|
||||
if int(spercent) >= 80:
|
||||
logger.fdebug("it's a go captain... - we matched " + str(spercent) + "%!")
|
||||
if int(spercent) < 80:
|
||||
logger.fdebug("failure - we only got " + str(spercent) + "% right!")
|
||||
continue
|
||||
logger.fdebug("this should be a match!")
|
||||
logger.fdebug("issue we are looking for is : " + str(findcomiciss[findloop]))
|
||||
logger.fdebug("integer value of issue we are looking for : " + str(intIss))
|
||||
|
@ -672,7 +710,9 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
else:
|
||||
log2file = log2file + "issues don't match.." + "\n"
|
||||
foundc = "no"
|
||||
if done == True: break
|
||||
if done == True:
|
||||
cmloopit == 1 #let's make sure it STOPS searching after a sucessful match.
|
||||
break
|
||||
cmloopit-=1
|
||||
findloop+=1
|
||||
if foundc == "yes":
|
||||
|
@ -680,7 +720,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
logger.fdebug("Found matching comic...preparing to send to Updater with IssueID: " + str(IssueID) + " and nzbname: " + str(nzbname))
|
||||
updater.nzblog(IssueID, nzbname)
|
||||
nzbpr == 0
|
||||
continue
|
||||
break
|
||||
elif foundc == "no" and nzbpr == 0:
|
||||
foundcomic.append("no")
|
||||
logger.fdebug("couldn't find a matching comic")
|
||||
|
|
|
@ -56,10 +56,21 @@ def upcoming_update(ComicID, ComicName, IssueNumber, IssueDate):
|
|||
"IssueNumber": str(IssueNumber),
|
||||
"IssueDate": str(IssueDate)}
|
||||
|
||||
#let's refresh the artist here just to make sure if an issue is available/not.
|
||||
mismatch = "no"
|
||||
CV_EXcomicid = myDB.action("SELECT * from exceptions WHERE ComicID=?", [ComicID]).fetchone()
|
||||
if CV_EXcomicid is None: pass
|
||||
else:
|
||||
if CV_EXcomicid['variloop'] == '99':
|
||||
mismatch = "yes"
|
||||
logger.fdebug("Refreshing comic " + str(ComicName) + " to make sure it's up-to-date")
|
||||
if ComicID[:1] == "G": mylar.importer.GCDimport(ComicID,pullupd="yes")
|
||||
else: mylar.importer.addComictoDB(ComicID,mismatch,pullupd="yes")
|
||||
|
||||
|
||||
issuechk = myDB.action("SELECT * FROM issues WHERE ComicID=? AND Issue_Number=?", [ComicID, IssueNumber]).fetchone()
|
||||
if issuechk is None:
|
||||
logger.fdebug(str(issuechk['ComicName']) + " Issue: " + str(issuechk['IssueNumber']) + " not available for download yet...adding to Upcoming Wanted Releases.")
|
||||
logger.fdebug(str(ComicName) + " Issue: " + str(IssueNumber) + " not available for download yet...adding to Upcoming Wanted Releases.")
|
||||
pass
|
||||
else:
|
||||
logger.fdebug("Available for download - checking..." + str(issuechk['ComicName']) + " Issue: " + str(issuechk['Issue_Number']))
|
||||
|
@ -273,7 +284,7 @@ def forceRescan(ComicID):
|
|||
if int(fcdigit) == int_iss:
|
||||
#if issyear in fcnew[som+1]:
|
||||
# print "matched on year:" + str(issyear)
|
||||
logger.fdebug("matched...issue: " + str(fcdigit) + " --- " + str(int_iss))
|
||||
logger.fdebug("matched...issue: " + str(rescan['ComicName']) + " --- " + str(int_iss))
|
||||
havefiles+=1
|
||||
haveissue = "yes"
|
||||
isslocation = str(tmpfc['ComicFilename'])
|
||||
|
|
|
@ -377,28 +377,44 @@ def pullitcheck():
|
|||
while (cnt > -1):
|
||||
lines[cnt] = str(lines[cnt]).upper()
|
||||
llen[cnt] = str(llen[cnt])
|
||||
#print ("looking for : " + str(lines[cnt]))
|
||||
weekly = myDB.select('SELECT PUBLISHER, ISSUE, COMIC, EXTRA, SHIPDATE FROM weekly WHERE COMIC LIKE (?)', [lines[cnt]])
|
||||
logger.fdebug("looking for : " + str(lines[cnt]))
|
||||
sqlsearch = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]', ' ', str(lines[cnt]))
|
||||
sqlsearch = re.sub(r'\s', '%', sqlsearch)
|
||||
logger.fdebug("searchsql: " + str(sqlsearch))
|
||||
weekly = myDB.select('SELECT PUBLISHER, ISSUE, COMIC, EXTRA, SHIPDATE FROM weekly WHERE COMIC LIKE (?)', [sqlsearch])
|
||||
#cur.execute('SELECT PUBLISHER, ISSUE, COMIC, EXTRA, SHIPDATE FROM weekly WHERE COMIC LIKE (?)', [lines[cnt]])
|
||||
for week in weekly:
|
||||
if week == None:
|
||||
break
|
||||
for nono in not_t:
|
||||
if nono in week['PUBLISHER']:
|
||||
#print ("nono present")
|
||||
logger.fdebug("nono present")
|
||||
break
|
||||
if nono in week['ISSUE']:
|
||||
logger.fdebug("graphic novel/tradeback detected..ignoring.")
|
||||
break
|
||||
for nothere in not_c:
|
||||
if nothere in week['EXTRA']:
|
||||
#print ("nothere present")
|
||||
logger.fdebug("nothere present")
|
||||
break
|
||||
else:
|
||||
comicnm = week['COMIC']
|
||||
#here's the tricky part, ie. BATMAN will match on
|
||||
#every batman comic, not exact
|
||||
#print ("comparing" + str(comicnm) + "..to.." + str(unlines[cnt]).upper())
|
||||
if str(comicnm) == str(unlines[cnt]).upper():
|
||||
#print ("matched on:")
|
||||
pass
|
||||
# logger.fdebug("comparing" + str(comicnm) + "..to.." + str(unlines[cnt]).upper())
|
||||
logger.fdebug("comparing" + str(sqlsearch) + "..to.." + str(unlines[cnt]).upper())
|
||||
|
||||
#-NEW-
|
||||
# strip out all special characters and compare
|
||||
watchcomic = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]', '', str(sqlsearch))
|
||||
comicnm = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]', '', str(comicnm))
|
||||
watchcomic = re.sub(r'\s', '', watchcomic)
|
||||
comicnm = re.sub(r'\s', '', comicnm)
|
||||
logger.fdebug("Revised_Watch: " + str(watchcomic))
|
||||
logger.fdebug("ComicNM: " + str(comicnm))
|
||||
if str(comicnm) == str(watchcomic).upper():
|
||||
logger.fdebug("matched on:" + str(comicnm) + "..." + str(watchcomic).upper())
|
||||
#pass
|
||||
elif ("ANNUAL" in week['EXTRA']):
|
||||
pass
|
||||
#print ( row[3] + " matched on ANNUAL")
|
||||
|
@ -428,19 +444,19 @@ def pullitcheck():
|
|||
ComicIssue = str(watchfndiss[tot -1] + ".00")
|
||||
ComicDate = str(week['SHIPDATE'])
|
||||
ComicName = str(unlines[cnt])
|
||||
logger.fdebug("Watchlist hit for : " + str(watchfnd[tot -1]) + " ISSUE: " + str(watchfndiss[tot -1]))
|
||||
logger.fdebug("Watchlist hit for : " + str(ComicName) + " ISSUE: " + str(watchfndiss[tot -1]))
|
||||
# here we add to comics.latest
|
||||
updater.latest_update(ComicID=ComicID, LatestIssue=ComicIssue, LatestDate=ComicDate)
|
||||
# here we add to upcoming table...
|
||||
updater.upcoming_update(ComicID=ComicID, ComicName=ComicName, IssueNumber=ComicIssue, IssueDate=ComicDate)
|
||||
# here we update status of weekly table...
|
||||
updater.weekly_update(ComicName=comicnm)
|
||||
updater.weekly_update(ComicName=week['COMIC'])
|
||||
break
|
||||
break
|
||||
break
|
||||
cnt-=1
|
||||
#print ("-------------------------")
|
||||
print ("There are " + str(otot) + " comics this week to get!")
|
||||
logger.fdebug("There are " + str(otot) + " comics this week to get!")
|
||||
#print ("However I've already grabbed " + str(btotal) )
|
||||
#print ("I need to get " + str(tot) + " comic(s)!" )
|
||||
|
||||
|
|
Loading…
Reference in New Issue