mirror of https://github.com/evilhero/mylar
Fix:AlternateSearch names wouldn't search, Fix:New filescanner, cleaned up code.Fix:If comic contained a . in the title, it wouldn't match.
This commit is contained in:
parent
3ff5866763
commit
2ae3a55cb7
|
@ -638,7 +638,7 @@ def GCDimport(gcomicid, pullupd=None):
|
|||
# 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()
|
||||
updater.newpullcheck(comic['ComicName'], gcomicid)
|
||||
|
||||
#here we grab issues that have been marked as wanted above...
|
||||
|
||||
|
@ -648,7 +648,7 @@ def GCDimport(gcomicid, pullupd=None):
|
|||
|
||||
for result in results:
|
||||
foundNZB = "none"
|
||||
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL) and (mylar.SAB_HOST):
|
||||
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL or mylar.NEWZNAB) and (mylar.SAB_HOST):
|
||||
foundNZB = search.searchforissue(result['IssueID'])
|
||||
if foundNZB == "yes":
|
||||
updater.foundsearch(result['ComicID'], result['IssueID'])
|
||||
|
|
|
@ -114,7 +114,7 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
break
|
||||
else:
|
||||
if AlternateSearch is not None:
|
||||
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + str(ComicYear))
|
||||
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + " " + str(ComicYear))
|
||||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
|
@ -130,7 +130,7 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
|
|||
break
|
||||
else:
|
||||
if AlternateSearch is not None:
|
||||
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + str(ComicYear))
|
||||
logger.info(u"Alternate Search pattern detected...re-adjusting to : " + str(AlternateSearch) + " " + str(ComicYear))
|
||||
findit = NZB_SEARCH(AlternateSearch, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
|
||||
if findit == 'yes':
|
||||
break
|
||||
|
@ -405,14 +405,17 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
logger.fdebug("changeup to decimal: " + str(changeup))
|
||||
comic_iss = splitit[(len(splitit)-2)] + "." + comic_iss
|
||||
splitst = len(splitit) - 2
|
||||
|
||||
else:
|
||||
# if the nzb name doesn't follow the series-issue-year format even closely..ignore nzb
|
||||
logger.fdebug("invalid naming format of nzb detected - cannot properly determine issue")
|
||||
continue
|
||||
logger.fdebug("adjusting from: " + str(comic_iss_b4) + " to: " + str(comic_iss))
|
||||
#bmm = re.findall('v\d', comic_iss)
|
||||
#if len(bmm) > 0: splitst = len(splitit) - 2
|
||||
#else: splitst = len(splitit) - 1
|
||||
|
||||
# make sure that things like - in watchcomic are accounted for when comparing to nzb.
|
||||
watchcomic_split = re.sub('[\-\:\,]', ' ', findcomic[findloop]).split(None)
|
||||
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)))
|
||||
|
@ -438,7 +441,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
|
|||
# splitrep = splitit[n].replace('-', '')
|
||||
# print ("non-character keyword...skipped on " + splitit[n])
|
||||
elif str(splitit[n].lower()).startswith('v'):
|
||||
logger.fdebug("possible verisoning..checking")
|
||||
logger.fdebug("possible versioning..checking")
|
||||
#we hit a versioning # - account for it
|
||||
if splitit[n][1:].isdigit():
|
||||
comicversion = str(splitit[n])
|
||||
|
@ -699,6 +702,7 @@ def searchforissue(issueid=None, new=False):
|
|||
comic = myDB.action('SELECT * from comics WHERE ComicID=?', [result['ComicID']]).fetchone()
|
||||
foundNZB = "none"
|
||||
SeriesYear = comic['ComicYear']
|
||||
AlternateSearch = comic['AlternateSearch']
|
||||
IssueDate = result['IssueDate']
|
||||
if result['IssueDate'] == None:
|
||||
ComicYear = comic['ComicYear']
|
||||
|
@ -706,7 +710,7 @@ def searchforissue(issueid=None, new=False):
|
|||
ComicYear = str(result['IssueDate'])[:4]
|
||||
|
||||
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL or mylar.NEWZNAB) and (mylar.SAB_HOST):
|
||||
foundNZB = search_init(result['ComicName'], result['Issue_Number'], str(ComicYear), comic['ComicYear'], IssueDate, result['IssueID'])
|
||||
foundNZB = search_init(result['ComicName'], result['Issue_Number'], str(ComicYear), comic['ComicYear'], IssueDate, result['IssueID'], AlternateSearch)
|
||||
if foundNZB == "yes":
|
||||
#print ("found!")
|
||||
updater.foundsearch(result['ComicID'], result['IssueID'])
|
||||
|
@ -718,6 +722,7 @@ def searchforissue(issueid=None, new=False):
|
|||
ComicID = result['ComicID']
|
||||
comic = myDB.action('SELECT * FROM comics where ComicID=?', [ComicID]).fetchone()
|
||||
SeriesYear = comic['ComicYear']
|
||||
AlternateSearch = comic['AlternateSearch']
|
||||
IssueDate = result['IssueDate']
|
||||
if result['IssueDate'] == None:
|
||||
IssueYear = comic['ComicYear']
|
||||
|
@ -726,7 +731,7 @@ def searchforissue(issueid=None, new=False):
|
|||
|
||||
foundNZB = "none"
|
||||
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL or mylar.NEWZNAB) and (mylar.SAB_HOST):
|
||||
foundNZB = search_init(result['ComicName'], result['Issue_Number'], str(IssueYear), comic['ComicYear'], IssueDate, result['IssueID'])
|
||||
foundNZB = search_init(result['ComicName'], result['Issue_Number'], str(IssueYear), comic['ComicYear'], IssueDate, result['IssueID'], AlternateSearch)
|
||||
if foundNZB == "yes":
|
||||
#print ("found!")
|
||||
updater.foundsearch(ComicID=result['ComicID'], IssueID=result['IssueID'])
|
||||
|
@ -742,12 +747,13 @@ def searchIssueIDList(issuelist):
|
|||
print ("Checking for issue: " + str(issue['Issue_Number']))
|
||||
foundNZB = "none"
|
||||
SeriesYear = comic['ComicYear']
|
||||
AlternateSearch = comic['AlternateSearch']
|
||||
if issue['IssueDate'] == None:
|
||||
ComicYear = comic['ComicYear']
|
||||
else:
|
||||
ComicYear = str(issue['IssueDate'])[:4]
|
||||
if (mylar.NZBSU or mylar.DOGNZB or mylar.EXPERIMENTAL or mylar.NEWZNAB) and (mylar.SAB_HOST):
|
||||
foundNZB = search_init(comic['ComicName'], issue['Issue_Number'], str(ComicYear), comic['ComicYear'], issue['IssueDate'], issue['IssueID'])
|
||||
foundNZB = search_init(comic['ComicName'], issue['Issue_Number'], str(ComicYear), comic['ComicYear'], issue['IssueDate'], issue['IssueID'], AlternateSearch)
|
||||
if foundNZB == "yes":
|
||||
#print ("found!")
|
||||
updater.foundsearch(ComicID=issue['ComicID'], IssueID=issue['IssueID'])
|
||||
|
|
|
@ -137,34 +137,34 @@ def nzblog(IssueID, NZBName):
|
|||
myDB.upsert("nzblog", newValue, controlValue)
|
||||
|
||||
def foundsearch(ComicID, IssueID):
|
||||
# When doing a Force Search (Wanted tab), the resulting search calls this to update.
|
||||
|
||||
# this is all redudant code that forceRescan already does.
|
||||
# should be redone at some point so that instead of rescanning entire
|
||||
# series directory, it just scans for the issue it just downloaded and
|
||||
# and change the status to Snatched accordingly. It is not to increment the have count
|
||||
# at this stage as it's not downloaded - just the .nzb has been snatched and sent to SAB.
|
||||
|
||||
myDB = db.DBConnection()
|
||||
#print ("Updater-ComicID: " + str(ComicID))
|
||||
#print ("Updater-IssueID: " + str(IssueID))
|
||||
comic = myDB.action('SELECT * FROM comics WHERE ComicID=?', [ComicID]).fetchone()
|
||||
issue = myDB.action('SELECT * FROM issues WHERE IssueID=?', [IssueID]).fetchone()
|
||||
#print ("comic location: " + comic['ComicLocation'])
|
||||
#this is too soon - file hasn't downloaded even yet.
|
||||
#fixed and addressed in search.py and follow-thru here!
|
||||
#check sab history for completion here :)
|
||||
CYear = issue['IssueDate'][:4]
|
||||
#print ("year:" + str(CYear))
|
||||
#slog = myDB.action('SELECT * FROM sablog WHERE ComicName=? AND ComicYEAR=?', [issue['ComicName'], str(CYear)]).fetchone()
|
||||
#this checks the active queue for downloading/non-existant jobs
|
||||
#--end queue check
|
||||
#this checks history for completed jobs...
|
||||
#---
|
||||
#-- end history check
|
||||
|
||||
fc = filechecker.listFiles(comic['ComicLocation'], comic['ComicName'])
|
||||
HaveDict = {"ComicID": ComicID}
|
||||
newHave = { "Have": fc['comiccount'] }
|
||||
myDB.upsert("comics", newHave, HaveDict)
|
||||
#---
|
||||
# fc = filechecker.listFiles(comic['ComicLocation'], comic['ComicName'])
|
||||
# HaveDict = {"ComicID": ComicID}
|
||||
# newHave = { "Have": fc['comiccount'] }
|
||||
# myDB.upsert("comics", newHave, HaveDict)
|
||||
# #---
|
||||
issue = myDB.action('SELECT * FROM issues WHERE IssueID=? AND ComicID=?', [IssueID, ComicID]).fetchone()
|
||||
#print ("updating status to snatched")
|
||||
# update the status to Snatched (so it won't keep on re-downloading!)
|
||||
logger.fdebug("updating status to snatched")
|
||||
controlValue = {"IssueID": IssueID}
|
||||
newValue = {"Status": "Snatched"}
|
||||
myDB.upsert("issues", newValue, controlValue)
|
||||
# update the snatched DB
|
||||
controlValueDict = {"IssueID": IssueID}
|
||||
newValueDict = {"Status": "Snatched"}
|
||||
#print ("updating snatched db.")
|
||||
logger.fdebug("updating snatched db.")
|
||||
myDB.upsert("issues", newValueDict, controlValueDict)
|
||||
snatchedupdate = {"IssueID": IssueID}
|
||||
newsnatchValues = {"ComicName": comic['ComicName'],
|
||||
|
@ -174,9 +174,6 @@ def foundsearch(ComicID, IssueID):
|
|||
"Status": "Snatched"
|
||||
}
|
||||
myDB.upsert("snatched", newsnatchValues, snatchedupdate)
|
||||
#we need to update sablog now to mark the nzo_id row as being completed and not used again.
|
||||
#this becomes an issue with files downloaded x2 or same name...
|
||||
|
||||
|
||||
#print ("finished updating snatched db.")
|
||||
logger.info(u"Updating now complete for " + str(comic['ComicName']) + " issue: " + str(issue['Issue_Number']))
|
||||
|
@ -211,6 +208,7 @@ def forceRescan(ComicID):
|
|||
break
|
||||
temploc = tmpfc['ComicFilename'].replace('_', ' ')
|
||||
temploc = re.sub('[\#\']', '', temploc)
|
||||
logger.fdebug("temploc: " + str(temploc))
|
||||
if 'annual' not in temploc:
|
||||
fcnew = shlex.split(str(temploc))
|
||||
fcn = len(fcnew)
|
||||
|
@ -228,14 +226,25 @@ def forceRescan(ComicID):
|
|||
logger.fdebug("integer_issue:" + str(int_iss) + " ... status: " + str(old_status))
|
||||
while (som < fcn):
|
||||
#counts get buggered up when the issue is the last field in the filename - ie. '50.cbr'
|
||||
#print ("checking word - " + str(fcnew[som]))
|
||||
logger.fdebug("checking word - " + str(fcnew[som]))
|
||||
if ".cbr" in fcnew[som]:
|
||||
fcnew[som] = fcnew[som].replace(".cbr", "")
|
||||
elif ".cbz" in fcnew[som]:
|
||||
fcnew[som] = fcnew[som].replace(".cbz", "")
|
||||
if '.' in fcnew[som]:
|
||||
logger.fdebug("decimal detected...adjusting.")
|
||||
try:
|
||||
i = float(fcnew[som])
|
||||
except ValueError, TypeError:
|
||||
#not numeric
|
||||
fcnew[som] = fcnew[som].replace(".", "")
|
||||
logger.fdebug("new word: " + str(fcnew[som]))
|
||||
else:
|
||||
#numeric
|
||||
pass
|
||||
if fcnew[som].isdigit():
|
||||
#this won't match on decimal issues - need to fix.
|
||||
#print ("digit detected")
|
||||
logger.fdebug("digit detected")
|
||||
if int(fcnew[som]) > 0:
|
||||
# fcdigit = fcnew[som].lstrip('0')
|
||||
#fcdigit = str(int(fcnew[som]))
|
||||
|
@ -246,24 +255,24 @@ def forceRescan(ComicID):
|
|||
elif "." in fcnew[som]:
|
||||
#this will match on decimal issues
|
||||
IssueChk = fcnew[som]
|
||||
#print ("decimal detected...analyzing if issue")
|
||||
logger.fdebug("decimal detected...analyzing if issue")
|
||||
isschk_find = IssueChk.find('.')
|
||||
isschk_b4dec = IssueChk[:isschk_find]
|
||||
isschk_decval = IssueChk[isschk_find+1:]
|
||||
if isschk_b4dec.isdigit():
|
||||
#logger.fdebug("digit detected prior to decimal.")
|
||||
logger.fdebug("digit detected prior to decimal.")
|
||||
if isschk_decval.isdigit():
|
||||
pass
|
||||
#logger.fdebug("digit detected after decimal.")
|
||||
#pass
|
||||
logger.fdebug("digit detected after decimal.")
|
||||
else:
|
||||
#logger.fdebug("not an issue - no digit detected after decimal")
|
||||
continue
|
||||
logger.fdebug("not an issue - no digit detected after decimal")
|
||||
break
|
||||
else:
|
||||
#logger.fdebug("not an issue - no digit detected prior to decimal")
|
||||
continue
|
||||
#logger.fdebug("IssueNumber: " + str(IssueChk))
|
||||
#logger.fdebug("..before decimal: " + str(isschk_b4dec))
|
||||
#logger.fdebug("...after decimal: " + str(isschk_decval))
|
||||
logger.fdebug("not an issue - no digit detected prior to decimal")
|
||||
break
|
||||
logger.fdebug("IssueNumber: " + str(IssueChk))
|
||||
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
|
||||
|
@ -276,18 +285,18 @@ def forceRescan(ComicID):
|
|||
iss = isschk_b4dec + "." + isschk_decval.rstrip('0')
|
||||
intdec = int(isschk_decval.rstrip('0')) * 10
|
||||
fcdigit = (int(isschk_b4dec) * 1000) + intdec
|
||||
#logger.fdebug("b4dec: " + str(isschk_b4dec))
|
||||
#logger.fdebug("decval: " + str(isschk_decval))
|
||||
#logger.fdebug("intdec: " + str(intdec))
|
||||
#logger.fdebug("let's compare with this issue value: " + str(fcdigit))
|
||||
logger.fdebug("b4dec: " + str(isschk_b4dec))
|
||||
logger.fdebug("decval: " + str(isschk_decval))
|
||||
logger.fdebug("intdec: " + str(intdec))
|
||||
logger.fdebug("let's compare with this issue value: " + str(fcdigit))
|
||||
else:
|
||||
# it's a word, skip it.
|
||||
fcdigit = 1000000
|
||||
#logger.fdebug("fcdigit: " + str(fcdigit))
|
||||
#logger.fdebug("int_iss: " + str(int_iss))
|
||||
logger.fdebug("fcdigit: " + str(fcdigit))
|
||||
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))
|
||||
logger.fdebug("this is the int issue:" + str(int_iss))
|
||||
|
||||
if int(fcdigit) == int_iss:
|
||||
#if issyear in fcnew[som+1]:
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
import os
|
||||
import cherrypy
|
||||
import datetime
|
||||
import re
|
||||
|
||||
from mako.template import Template
|
||||
from mako.lookup import TemplateLookup
|
||||
|
@ -33,7 +34,6 @@ import lib.simplejson as simplejson
|
|||
|
||||
from operator import itemgetter
|
||||
|
||||
|
||||
def serve_template(templatename, **kwargs):
|
||||
|
||||
interface_dir = os.path.join(str(mylar.PROG_DIR), 'data/interfaces/')
|
||||
|
@ -63,6 +63,9 @@ class WebInterface(object):
|
|||
myDB = db.DBConnection()
|
||||
comic = myDB.action('SELECT * FROM comics WHERE ComicID=?', [ComicID]).fetchone()
|
||||
issues = myDB.select('SELECT * from issues WHERE ComicID=? order by Int_IssueNumber DESC', [ComicID])
|
||||
#print (pickle.loads(comic['AlternateSearch']))
|
||||
#AlternateSearch = []
|
||||
#AlternateSearch.append(pickle.loads (comic['AlternateSearch']))
|
||||
if comic is None:
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
comicConfig = {
|
||||
|
@ -531,14 +534,42 @@ class WebInterface(object):
|
|||
|
||||
def comic_config(self, com_location, alt_search, ComicID):
|
||||
myDB = db.DBConnection()
|
||||
#--- this is for multipe search terms............
|
||||
#--- works, just need to redo search.py to accomodate multiple search terms
|
||||
# ffs_alt = []
|
||||
# if '+' in alt_search:
|
||||
#find first +
|
||||
# ffs = alt_search.find('+')
|
||||
# ffs_alt.append(alt_search[:ffs])
|
||||
# ffs_alt_st = str(ffs_alt[0])
|
||||
# print("ffs_alt: " + str(ffs_alt[0]))
|
||||
|
||||
# split the entire string by the delimter +
|
||||
# ffs_test = alt_search.split('+')
|
||||
# if len(ffs_test) > 0:
|
||||
# print("ffs_test names: " + str(len(ffs_test)))
|
||||
# ffs_count = len(ffs_test)
|
||||
# n=1
|
||||
# while (n < ffs_count):
|
||||
# ffs_alt.append(ffs_test[n])
|
||||
# print("adding : " + str(ffs_test[n]))
|
||||
#print("ffs_alt : " + str(ffs_alt))
|
||||
# ffs_alt_st = str(ffs_alt_st) + "..." + str(ffs_test[n])
|
||||
# n+=1
|
||||
# asearch = ffs_alt
|
||||
# else:
|
||||
# asearch = alt_search
|
||||
asearch = str(alt_search)
|
||||
|
||||
controlValueDict = {'ComicID': ComicID}
|
||||
newValues = {"ComicLocation": com_location,
|
||||
"AlternateSearch": alt_search }
|
||||
"AlternateSearch": str(asearch) }
|
||||
#"QUALalt_vers": qual_altvers,
|
||||
#"QUALScanner": qual_scanner,
|
||||
#"QUALtype": qual_type,
|
||||
#"QUALquality": qual_quality
|
||||
#}
|
||||
|
||||
#force the check/creation of directory com_location here
|
||||
if os.path.isdir(str(com_location)):
|
||||
logger.info(u"Validating Directory (" + str(com_location) + "). Already exists! Continuing...")
|
||||
|
|
Loading…
Reference in New Issue