FIX: (#584) If publication date was in February, wouldn't rollback year to previous when doing deeper searches, IMP: Versioning check will remove some erroneous numerics, IMP: RSS Feeds better matching for nzbs, FIX: If annuals not enabled and annuals within given series directory, would error on refresh/recheck files

This commit is contained in:
evilhero 2013-12-09 14:44:26 -05:00
parent 227547977e
commit 4b26013400
7 changed files with 75 additions and 38 deletions

View File

@ -154,8 +154,13 @@ def GetComicInfo(comicid,dom):
break
if volconv != '':
vfind = volconv
if '(' in vfind:
#bracket detected in versioning'
vfindit = re.findall('[^()]+', vfind)
vfind = vfindit[0]
vf = re.findall('[^<>]+', vfind)
comic['ComicVersion'] = re.sub("[^0-9]", "", vf[0])
logger.info("Volume information found! Adding to series record : volume " + comic['ComicVersion'])
else:
comic['ComicVersion'] = "noversion"

View File

@ -10,7 +10,7 @@ import mylar
import unicodedata
def Startit(searchName, searchIssue, searchYear, ComicVersion):
def Startit(searchName, searchIssue, searchYear, ComicVersion, IssDateFix):
#searchName = "Uncanny Avengers"
#searchIssue = "01"
#searchYear = "2012"
@ -109,11 +109,17 @@ def Startit(searchName, searchIssue, searchYear, ComicVersion):
# 'title': subs,
# 'link': str(link)
# })
if searchYear not in subs:
if IssDateFix != "no":
if IssDateFix == "01" or IssDateFix == "02": ComicYearFix = str(int(searchYear) - 1)
else: ComicYearFix = str(int(searchYear) + 1)
else:
ComicYearFix = searchYear
if searchYear not in subs and ComicYearFix not in subs:
noYear = 'True'
noYearline = subs
if searchYear in subs and noYear == 'True':
if (searchYear in subs or ComicYearFix in subs) and noYear == 'True':
#this would occur on the next check in the line, if year exists and
#the noYear check in the first check came back valid append it
subs = noYearline + ' (' + searchYear + ')'

View File

@ -392,9 +392,11 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None,c
except IOError as e:
logger.error('Unable to save cover into series directory at this time.')
if oldcomversion is None:
if oldcomversion is None or oldcomversion == "None":
logger.info('previous version detected as None - seeing if update required')
if comic['ComicVersion'].isdigit():
comicVol = "v" + comic['ComicVersion']
logger.info('updated version to :' + str(comicVol))
else:
comicVol = None
else:

View File

@ -446,12 +446,12 @@ def torrentdbsearch(seriesname,issue,comicid=None,nzbprov=None):
seriesname_mod = re.sub('[\&]', ' ', seriesname_mod)
foundname_mod = re.sub('[\&]', ' ', foundname_mod)
formatrem_seriesname = re.sub('[\'\!\@\#\$\%\:\;\=\?\.]', '',seriesname_mod)
formatrem_seriesname = re.sub('[\'\!\@\#\$\%\:\;\=\?\.\-]', '',seriesname_mod)
formatrem_seriesname = re.sub('[\/]', '-', formatrem_seriesname)
formatrem_seriesname = re.sub('\s+', ' ', formatrem_seriesname)
if formatrem_seriesname[:1] == ' ': formatrem_seriesname = formatrem_seriesname[1:]
formatrem_torsplit = re.sub('[\'\!\@\#\$\%\:\;\\=\?\.]', '',foundname_mod)
formatrem_torsplit = re.sub('[\'\!\@\#\$\%\:\;\\=\?\.\-]', '',foundname_mod)
formatrem_torsplit = re.sub('[\/]', '-', formatrem_torsplit)
formatrem_torsplit = re.sub('\s+', ' ', formatrem_torsplit)
logger.fdebug(str(len(formatrem_torsplit)) + ' - formatrem_torsplit : ' + formatrem_torsplit.lower())

View File

@ -125,7 +125,7 @@ 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" or IssDt == "01":
if IssDt == "12" or IssDt == "11" or IssDt == "01" or IssDt == "02":
IssDateFix = IssDt
else:
IssDateFix = "no"
@ -625,7 +625,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
elif nzbprov == 'experimental':
#bb = parseit.MysterBinScrape(comsearch[findloop], comyear)
bb = findcomicfeed.Startit(u_ComicName, isssearch, comyear, ComicVersion)
bb = findcomicfeed.Startit(u_ComicName, isssearch, comyear, ComicVersion, IssDateFix)
# since the regexs in findcomicfeed do the 3 loops, lets force the exit after
cmloopit == 1
@ -700,7 +700,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
if ComicVersion:
ComVersChk = re.sub("[^0-9]", "", ComicVersion)
if ComVersChk == '':
if ComVersChk == '' or ComVersChk == '1':
ComVersChk = 0
else:
ComVersChk = 0
@ -801,7 +801,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
#let's do this here and save a few extra loops ;)
#fix for issue dates between Nov-Dec/Jan
if IssDateFix != "no" and UseFuzzy is not "2":
if IssDateFix == "01": ComicYearFix = int(ComicYear) - 1
if IssDateFix == "01" or IssDateFix == "02": ComicYearFix = int(ComicYear) - 1
else: 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!")

View File

@ -8,6 +8,7 @@ import re
import os
import sqlite3
import datetime
import unicodedata
from decimal import Decimal
from HTMLParser import HTMLParseError
from time import strptime
@ -28,9 +29,18 @@ def solicit(month, year):
mnloop = 0
upcoming = []
while (mnloop < 5):
publishers = {'DC Comics':'DC Comics', 'Marvel':'Marvel Comics', 'Image':'Image Comics', 'IDW':'IDW Publishing', 'Dark Horse':'Dark Horse Comics'}
pagelinks = "http://www.comicbookresources.com/tag/solicits" + str(month) + str(year)
while (mnloop < 5):
if year == 2014:
if len(str(month)) == 1:
month_string = '0' + str(month)
else:
month_string = str(month)
datestring = str(year) + str(month_string)
else:
datestring = str(month) + str(year)
pagelinks = "http://www.comicbookresources.com/tag/solicits" + str(datestring)
pageresponse = urllib2.urlopen ( pagelinks )
soup = BeautifulSoup (pageresponse)
cntlinks = soup.findAll('h3')
@ -48,9 +58,12 @@ def solicit(month, year):
if "/?page=article&amp;id=" in str(headt):
#print ("titlet: " + str(headt))
headName = headt.findNext(text=True)
if ('Marvel' and 'DC' and 'Image' not in headName) and ('Solicitations' in headName):
if ('Marvel' and 'DC' and 'Image' not in headName) and ('Solicitations' in headName or 'Solicits' in headName):
pubstart = headName.find('Solicitations')
publish.append( headName[:pubstart].strip() )
for pub in publishers:
if pub in headName[:pubstart]:
publish.append(publishers[pub])
#publish.append( headName[:pubstart].strip() )
abc = headt.findAll('a', href=True)[0]
ID_som = abc['href'] #first instance will have the right link...
resultURL.append( ID_som )
@ -148,9 +161,10 @@ def populate(link,publisher,shipdate):
#print ("titlet: " + str(titlet))
if "/news/preview2.php" in str(titlet):
tempName = titlet.findNext(text=True)
if ' TPB' not in tempName and ' HC' not in tempName and 'GN-TPB' not in tempName and 'subscription variant' not in tempName.lower():
if ' TPB' not in tempName and ' HC' not in tempName and 'GN-TPB' not in tempName and 'for $1' not in tempName.lower() and 'subscription variant' not in tempName.lower():
#print publisher + ' found upcoming'
if '#' in tempName:
#tempName = tempName.replace(u'.',u"'")
tempName = tempName.encode('ascii', 'replace') #.decode('utf-8')
if '???' in tempName:
tempName = tempName.replace('???', ' ')

View File

@ -701,31 +701,41 @@ def forceRescan(ComicID,archive=None):
else:
#we have the # of comics, now let's update the db.
#even if we couldn't find the physical issue, check the status.
if 'annual' in temploc.lower():
iss_id = reann['IssueID']
else:
iss_id = reiss['IssueID']
logger.fdebug('issueID to write to db:' + str(iss_id))
controlValueDict = {"IssueID": iss_id}
#if Archived, increase the 'Have' count.
#if archive:
# issStatus = "Archived"
if haveissue == "yes":
issStatus = "Downloaded"
newValueDict = {"Location": isslocation,
"ComicSize": issSize,
"Status": issStatus
}
issID_to_ignore.append(str(iss_id))
#-- if annuals aren't enabled, this will bugger out.
writeit = True
if mylar.ANNUALS_ON:
if 'annual' in temploc.lower():
myDB.upsert("annuals", newValueDict, controlValueDict)
iss_id = reann['IssueID']
else:
myDB.upsert("issues", newValueDict, controlValueDict)
iss_id = reiss['IssueID']
else:
if 'annual' in temploc.lower():
logger.fdebug('Annual support not enabled, but annual issue present within directory. Ignoring annual.')
writeit = False
else:
iss_id = reiss['IssueID']
if writeit == True:
logger.fdebug('issueID to write to db:' + str(iss_id))
controlValueDict = {"IssueID": iss_id}
#if Archived, increase the 'Have' count.
#if archive:
# issStatus = "Archived"
if haveissue == "yes":
issStatus = "Downloaded"
newValueDict = {"Location": isslocation,
"ComicSize": issSize,
"Status": issStatus
}
issID_to_ignore.append(str(iss_id))
if 'annual' in temploc.lower():
myDB.upsert("annuals", newValueDict, controlValueDict)
else:
myDB.upsert("issues", newValueDict, controlValueDict)
fn+=1
logger.fdebug('IssueID to ignore: ' + str(issID_to_ignore))