FIX:(#1011) Possible fix for duplicate apikeys being posted for addurl link in SAB for nzbgeek, FIX: [Story Arcs] When Search Missing option was used, would error out in GUI and immediately fail search, FIX: [Story Arcs] When post-processing and meta-tagging enabled, would pass an invalid IssueID into the tagger resulting in no tags being written, FIX: If nzbname had decimals in place of spaces, would fail to match during post-processing and return an error indicating could not locate nzbfile in database

This commit is contained in:
evilhero 2015-05-11 04:14:47 -04:00
parent b04af7af42
commit 173b9304fe
5 changed files with 67 additions and 34 deletions

View File

@ -381,7 +381,7 @@ class PostProcessor(object):
logger.fdebug('[NZBNAME] nzbname (remove chars): ' + nzbname)
nzbname = re.sub('.cbr', '', nzbname).strip()
nzbname = re.sub('.cbz', '', nzbname).strip()
nzbname = re.sub('\_', ' ', nzbname)
nzbname = re.sub('[\.\_]', ' ', nzbname).strip()
nzbname = re.sub('\s+',' ', nzbname) #make sure we remove the extra spaces.
logger.fdebug('[NZBNAME] nzbname (remove extensions, double spaces, convert underscores to spaces): ' + nzbname)
nzbname = re.sub('\s', '.', nzbname)

View File

@ -119,13 +119,13 @@ def listFiles(dir,watchcomic,Publisher,AlternateSearch=None,manual=None,sarc=Non
digitchk = 0
if sarc and mylar.READ2FILENAME:
logger.info('subname: ' + subname)
logger.fdebug('[SARC] subname: ' + subname)
removest = subname.find('-') # the - gets removed above so we test for the first blank space...
logger.info('removest: ' + str(removest))
logger.info('removestdig: ' + subname[:removest-1])
logger.fdebug('[SARC] Checking filename for Reading Order sequence - removest: ' + str(removest))
logger.fdebug('removestdig: ' + subname[:removest-1])
if subname[:removest].isdigit() and removest == 3:
subname = subname[4:]
logger.info('subname set to : ' + subname)
logger.fdebug('[SARC] Removed Reading Order sequence from subname. Now set to : ' + subname)
for subit in subsplit:

View File

@ -48,9 +48,9 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueD
#logger.info('AlternateSearch is : ' + AlternateSearch)
if ComicYear == None: ComicYear = '2014'
else: ComicYear = str(ComicYear)[:4]
if Publisher == 'IDW Publishing': Publisher = 'IDW'
logger.fdebug('Publisher is : ' + Publisher)
if Publisher:
if Publisher == 'IDW Publishing': Publisher = 'IDW'
logger.fdebug('Publisher is : ' + Publisher)
issuetitle = helpers.get_issue_title(IssueID)
if issuetitle:
logger.info('Issue Title given as : ' + issuetitle)
@ -1594,6 +1594,7 @@ def nzbname_create(provider, title=None, info=None):
logger.fdebug('[SEARCHER] nzbname (remove chars): ' + nzbname)
nzbname = re.sub('.cbr', '', nzbname).strip()
nzbname = re.sub('.cbz', '', nzbname).strip()
nzbname = re.sub('[\.\_]', ' ', nzbname).strip()
nzbname = re.sub('\s+',' ', nzbname) #make sure we remove the extra spaces.
logger.fdebug('[SEARCHER] nzbname (\s): ' + nzbname)
nzbname = re.sub(' ', '.', nzbname)
@ -1771,7 +1772,7 @@ def searcher(nzbprov, nzbname, comicinfo, link, IssueID, ComicID, tmpprov, direc
else:
uid = newznab[3].strip()
if all( ['&r=' not in linkapi, '&i=' not in linkapi] ):
if any( ['&r=' not in linkapi, '&i=' not in linkapi, '&apikey=' not in linkapi] ):
fileURL = urllib.quote_plus(linkapi + '&i=' + uid + '&r=' + apikey)
else:
fileURL = urllib.quote_plus(linkapi)

View File

@ -553,6 +553,10 @@ def nzblog(IssueID, NZBName, ComicName, SARC=None, IssueArcID=None, id=None, pro
newValue = {'NZBName': NZBName}
if SARC:
IssueID = 'S' + str(IssueArcID)
newValue['SARC'] = SARC
if IssueID is None or IssueID == 'None':
#if IssueID is None, it's a one-off download from the pull-list.
#give it a generic ID above the last one so it doesn't throw an error later.
@ -562,10 +566,6 @@ def nzblog(IssueID, NZBName, ComicName, SARC=None, IssueArcID=None, id=None, pro
else:
IssueID = int(mylar.HIGHCOUNT) + 1
if SARC:
IssueID = 'S' + str(IssueArcID)
newValue['SARC'] = SARC
controlValue = {"IssueID": IssueID,
"Provider": prov}

View File

@ -2445,6 +2445,7 @@ class WebInterface(object):
issue = myDB.selectone("SELECT * FROM issues where ComicID=? and Issue_Number=?", [m_arc['match_id'],m_arc['match_issue']]).fetchone()
if issue is None: pass
else:
logger.fdebug("issue: " + str(issue['Issue_Number']) + "..." + str(m_arc['match_issue']))
# if helpers.decimal_issue(issuechk['Issue_Number']) == helpers.decimal_issue(m_arc['match_issue']):
if issue['Issue_Number'] == m_arc['match_issue']:
@ -2525,14 +2526,26 @@ class WebInterface(object):
s_issueid = want['IssueID'] #None
stdate = want['StoreDate']
issdate = want['IssueDate']
logger.info("-- NOT a watched series queue.")
logger.info(want['ComicName'] + " -- #" + str(want['IssueNumber']))
logger.info(u"Story Arc : " + str(SARC) + " queueing the selected issue...")
logger.info(u"IssueArcID : " + str(IssueArcID))
logger.info(u"ComicID: " + str(s_comicid) + " --- IssueID: " + str(s_issueid)) # no comicid in issues table.
logger.info(u"StoreDate: " + str(stdate) + " --- IssueDate: " + str(issdate))
logger.fdebug("-- NOT a watched series queue.")
logger.fdebug(want['ComicName'] + " -- #" + str(want['IssueNumber']))
logger.fdebug(u"Story Arc : " + str(SARC) + " queueing the selected issue...")
logger.fdebug(u"IssueArcID : " + str(IssueArcID))
logger.fdebug(u"ComicID: " + str(s_comicid) + " --- IssueID: " + str(s_issueid)) # no comicid in issues table.
logger.fdebug(u"StoreDate: " + str(stdate) + " --- IssueDate: " + str(issdate))
#logger.info(u'Publisher: ' + want['Publisher']) <-- no publisher in issues table.
foundcom, prov = search.search_init(ComicName=want['ComicName'], IssueNumber=want['IssueNumber'], ComicYear=want['IssueYear'], SeriesYear=want['SeriesYear'], Publisher=None, IssueDate=issdate, StoreDate=stdate, IssueID=s_issueid, SARC=SARC, IssueArcID=IssueArcID)
issueyear = want['IssueYEAR']
logger.fdebug('IssueYear: ' + str(issueyear))
if issueyear is None or issueyear == 'None':
try:
logger.fdebug('issdate:' + str(issdate))
issueyear = issdate[:4]
if not issueyear.startswith('19') and not issueyear.startswith('20'):
issueyear = stdate[:4]
except:
issueyear = stdate[:4]
logger.fdebug('ComicYear: ' + str(want['SeriesYear']))
foundcom, prov = search.search_init(ComicName=want['ComicName'], IssueNumber=want['IssueNumber'], ComicYear=issueyear, SeriesYear=want['SeriesYear'], Publisher=None, IssueDate=issdate, StoreDate=stdate, IssueID=s_issueid, SARC=SARC, IssueArcID=IssueArcID)
else:
# it's a watched series
s_comicid = issuechk['ComicID']
@ -2549,7 +2562,7 @@ class WebInterface(object):
logger.fdebug('not sucessfully found.')
stupdate.append({"Status": "Wanted",
"IssueArcID": IssueArcID,
"IssueID": "None"})
"IssueID": s_issueid})
watchlistchk = myDB.select("SELECT * FROM readinglist WHERE StoryArcID=? AND Status='Wanted'", [StoryArcID])
if watchlistchk is not None:
@ -2560,25 +2573,39 @@ class WebInterface(object):
IssueArcID = watchchk['IssueArcID']
if issuechk is None:
# none means it's not a 'watched' series
s_comicid = None
s_issueid = None
try:
s_comicid = watchchk['ComicID']
except:
s_comicid = None
try:
s_issueid = watchchk['IssueID']
except:
s_issueid = None
logger.fdebug("-- NOT a watched series queue.")
logger.fdebug(watchchk['ComicName'] + " -- #" + str(watchchk['IssueNumber']))
logger.info(u"Story Arc : " + str(SARC) + " queueing up the selected issue...")
logger.info(u"IssueArcID : " + str(IssueArcID))
logger.fdebug(u"Story Arc : " + str(SARC) + " queueing up the selected issue...")
logger.fdebug(u"IssueArcID : " + str(IssueArcID))
try:
issueyear = watchchk['IssueYEAR']
logger.fdebug('issueYEAR : ' + issueyear)
except:
issueyear = watchchk['StoreDate'][:4]
logger.info('issueyear : ' + str(issueyear))
logger.info('comicname : ' + watchchk['ComicName'])
logger.info('issuenumber : ' + watchchk['IssueNumber'])
logger.info('comicyear : ' + watchchk['SeriesYear'])
try:
issueyear = watchchk['IssueDate'][:4]
except:
issueyear = watchchk['StoreDate'][:4]
stdate = watchchk['StoreDate']
issdate = watchchk['IssueDate']
logger.fdebug('issueyear : ' + str(issueyear))
logger.fdebug('comicname : ' + watchchk['ComicName'])
logger.fdebug('issuenumber : ' + watchchk['IssueNumber'])
logger.fdebug('comicyear : ' + watchchk['SeriesYear'])
#logger.info('publisher : ' + watchchk['IssuePublisher']) <-- no publisher in table
logger.info('SARC : ' + SARC)
logger.info('IssueArcID : ' + IssueArcID)
foundcom, prov = search.search_init(ComicName=watchchk['ComicName'], IssueNumber=watchchk['IssueNumber'], ComicYear=issueyear, SeriesYear=watchchk['SeriesYear'], Publisher='None', SARC=SARC, IssueArcID=IssueArcID)
logger.fdebug('SARC : ' + SARC)
logger.fdebug('IssueArcID : ' + IssueArcID)
foundcom, prov = search.search_init(ComicName=watchchk['ComicName'], IssueNumber=watchchk['IssueNumber'], ComicYear=issueyear, SeriesYear=watchchk['SeriesYear'], Publisher=None, IssueDate=issdate, StoreDate=stdate, IssueID=s_issueid, SARC=SARC, IssueArcID=IssueArcID)
else:
# it's a watched series
s_comicid = issuechk['ComicID']
@ -2602,7 +2629,8 @@ class WebInterface(object):
ctrlVal = {'IssueArcID': st['IssueArcID']}
newVal = {'Status': st['Status']}
if st['IssueID']:
logger.fdebug('issueid:' + str(st['IssueID']))
if st['IssueID']:
logger.fdebug('issueid:' + str(st['IssueID']))
newVal['IssueID'] = st['IssueID']
myDB.upsert("readinglist", newVal, ctrlVal)
ReadGetWanted.exposed = True
@ -3973,3 +4001,7 @@ class WebInterface(object):
read = readinglist.Readinglist()
threading.Thread(target=read.syncreading).start()
syncfiles.exposed = True
def search_32p(self, search=None):
mylar.rsscheck.torrents(pickfeed='4', seriesname=search)
search_32p.exposed = True