Fix: decimal issue should be fixed for both searching and file checking, Fix: blackhole nzbs in-line for post-processing, Imp: Alternate Naming allowed for searching now(Comic Detail/Edit tab)

This commit is contained in:
evilhero 2012-12-31 11:52:16 -05:00
parent 6610cf3e93
commit d70f482599
8 changed files with 282 additions and 55 deletions

View File

@ -130,6 +130,11 @@
<div>
<label><big>Quality :</big><norm>${comic['QUALquality']}</norm></label>
</div>
<div>
<label><big>Alternate Search Names :</big><norm>${comic['AlternateSearch']}</norm></label>
</div>
</fieldset>
</td>
</tr>
@ -166,6 +171,14 @@
<input type="text" name="com_location" value="${comic['ComicLocation']}" size="60"><br/>
<div class="row"><small>the directory where all the comics are located for this particular comic</small></div>
</div>
<div>
<label>Alternate Search Names</label>
<input type="text" name="alt_search" value="${comic['AlternateSearch']}" size="60"><br/>
<div class="row"><small>Alternate comic names to be searched in case naming is different</small>
<small>(ie. Hack/Slash = hack-slash)</small></div>
</div>
<div>
<input type="submit" value="Update"/>
</div>

View File

@ -567,8 +567,8 @@ def dbcheck():
conn=sqlite3.connect(DB_FILE)
c=conn.cursor()
c.execute('CREATE TABLE IF NOT EXISTS comics (ComicID TEXT UNIQUE, ComicName TEXT, ComicSortName TEXT, ComicYear TEXT, DateAdded TEXT, Status TEXT, IncludeExtras INTEGER, Have INTEGER, Total INTEGER, ComicImage TEXT, ComicPublisher TEXT, ComicLocation TEXT, ComicPublished TEXT, LatestIssue TEXT, LatestDate TEXT, Description TEXT, QUALalt_vers TEXT, QUALtype TEXT, QUALscanner TEXT, QUALquality TEXT, LastUpdated TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS issues (IssueID TEXT, ComicName TEXT, IssueName TEXT, Issue_Number TEXT, DateAdded TEXT, Status TEXT, Type TEXT, ComicID, ArtworkURL Text, ReleaseDate TEXT, Location TEXT, IssueDate TEXT, Int_IssueNumber INT)')
c.execute('CREATE TABLE IF NOT EXISTS comics (ComicID TEXT UNIQUE, ComicName TEXT, ComicSortName TEXT, ComicYear TEXT, DateAdded TEXT, Status TEXT, IncludeExtras INTEGER, Have INTEGER, Total INTEGER, ComicImage TEXT, ComicPublisher TEXT, ComicLocation TEXT, ComicPublished TEXT, LatestIssue TEXT, LatestDate TEXT, Description TEXT, QUALalt_vers TEXT, QUALtype TEXT, QUALscanner TEXT, QUALquality TEXT, LastUpdated TEXT, AlternateSearch TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS issues (IssueID TEXT, ComicName TEXT, IssueName TEXT, Issue_Number TEXT, DateAdded TEXT, Status TEXT, Type TEXT, ComicID, ArtworkURL Text, ReleaseDate TEXT, Location TEXT, IssueDate TEXT, Int_IssueNumber INT, ComicSize TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS snatched (IssueID TEXT, ComicName TEXT, Issue_Number TEXT, Size INTEGER, DateAdded TEXT, Status TEXT, FolderName TEXT, ComicID TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS upcoming (ComicName TEXT, IssueNumber TEXT, ComicID TEXT, IssueID TEXT, IssueDate TEXT, Status TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS nzblog (IssueID TEXT, NZBName TEXT)')
@ -642,6 +642,16 @@ def dbcheck():
except sqlite3.OperationalError:
c.execute('ALTER TABLE comics ADD COLUMN QUALquality TEXT')
try:
c.execute('SELECT AlternateSearch from comics')
except sqlite3.OperationalError:
c.execute('ALTER TABLE comics ADD COLUMN AlternateSearch TEXT')
try:
c.execute('SELECT ComicSize from issues')
except sqlite3.OperationalError:
c.execute('ALTER TABLE issues ADD COLUMN ComicSize TEXT')
conn.commit()
c.close()

View File

@ -18,6 +18,7 @@ import os
import os.path
import pprint
import subprocess
import re
def file2comicmatch(watchmatch):
#print ("match: " + str(watchmatch))
@ -26,8 +27,6 @@ def file2comicmatch(watchmatch):
def listFiles(dir,watchcomic):
#print("dir:" + dir)
#print("comic: " + watchcomic)
if ':' in watchcomic:
watchcomic = watchcomic.replace(':','')
basedir = dir
#print "Files in ", dir, ": "
watchmatch = {}
@ -35,10 +34,13 @@ def listFiles(dir,watchcomic):
comiccnt = 0
for item in os.listdir(basedir):
#print item
subname = os.path.join(basedir, item)
#subname = os.path.join(basedir, item)
subname = item
#print subname
if '_' in subname:
subname = subname.replace('_', ' ')
subname = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]',' ', str(subname))
watchcomic = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]', ' ', str(watchcomic))
#if '_' in subname:
# subname = subname.replace('_', ' ')
if watchcomic.lower() in subname.lower():
if 'annual' in subname.lower():
#print ("it's an annual - unsure how to proceed")

View File

@ -166,3 +166,20 @@ def is_number(s):
return True
except ValueError:
return False
def decimal_issue(iss):
iss_find = iss.find('.')
iss_b4dec = iss[:iss_find]
iss_decval = iss[iss_find+1:]
if int(iss_decval) == 0:
iss = iss_b4dec
issdec = int(iss_decval)
else:
if len(iss_decval) == 1:
iss = iss_b4dec + "." + iss_decval
issdec = int(iss_decval) * 10
else:
iss = iss_b4dec + "." + iss_decval.rstrip('0')
issdec = int(iss_decval.rstrip('0')) * 10
deciss = (int(iss_b4dec) * 1000) + issdec
return deciss

View File

@ -36,7 +36,7 @@ from xml.dom.minidom import parseString
import urllib2
from datetime import datetime
def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueID):
def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueID, AlternateSearch=None):
if ComicYear == None: ComicYear = '2013'
else: ComicYear = str(ComicYear)[:4]
##nzb provider selection##
@ -97,11 +97,22 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
logger.fdebug("findit = found!")
continue
else:
if AlternateSearch is not None:
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, 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
elif nzbprovider[nzbpr] == 'experimental':
@ -109,13 +120,25 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
nzbprov = 'experimental'
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
if findit == 'yes':
break
logger.fdebug("findit = found!")
continue
else:
if AlternateSearch is not None:
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
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
elif nzbprovider[nzbpr] == 'nzb.su':
@ -127,13 +150,24 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
nzbprov = 'nzb.su'
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
if findit == 'yes':
break
logger.fdebug("findit = found!")
continue
else:
if AlternateSearch is not None:
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
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
@ -145,14 +179,26 @@ def search_init(ComicName, IssueNumber, ComicYear, SeriesYear, IssueDate, IssueI
#RSS_SEARCH(ComicName, IssueNumber)
nzbprov = 'dognzb'
findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, IssDateFix, IssueID)
if findit == 'yes':
break
logger.fdebug("findit = found!")
continue
else:
if AlternateSearch is not None:
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
if IssDateFix == "yes":
logger.info(u"Hang on - this issue was published between Dec/Jan of " + str(ComicYear) + "...adjusting to " + str(ComicYearFix) + " and retrying...")
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
@ -201,10 +247,38 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
#print ("-------SEARCH FOR MISSING------------------")
findcomic.append(str(ComicName))
IssueNumber = str(re.sub("\.00", "", str(IssueNumber)))
#print ("issueNumber" + str(IssueNumber))
findcomiciss.append(str(re.sub("\D", "", str(IssueNumber))))
# this should be called elsewhere..redudant code.
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))
#--let's make sure we don't wipe out decimal issues ;)
if int(isschk_decval) == 0:
iss = isschk_b4dec
intdec = int(isschk_decval)
else:
if len(isschk_decval) == 1:
iss = isschk_b4dec + "." + isschk_decval
intdec = int(isschk_decval) * 10
else:
iss = isschk_b4dec + "." + isschk_decval.rstrip('0')
intdec = int(isschk_decval.rstrip('0')) * 10
logger.fdebug("let's search with this issue value: " + str(iss))
#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))
IssueNumber = iss
#issue_decimal = re.compile(r'[^\d.]+')
#issue = issue_decimal.sub('', str(IssueNumber))
findcomiciss.append(iss)
#print ("we need : " + str(findcomic[findcount]) + " issue: #" + str(findcomiciss[findcount]))
# replace whitespace in comic name with %20 for api search
cm1 = re.sub(" ", "%20", str(findcomic[findcount]))
@ -328,17 +402,28 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
logger.fdebug("original nzb comic and issue: " + str(comic_andiss))
#changed this from '' to ' '
comic_iss_b4 = re.sub('[\-\:\,]', ' ', str(comic_andiss))
comic_iss = comic_iss_b4.replace('.',' ')
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
#screwed up most search results with dognzb. Let's try to adjust.
#watchcomic_split = findcomic[findloop].split(None)
if splitit[(len(splitit)-1)].isdigit():
#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
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
#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)
@ -372,10 +457,10 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
comicversion = str(splitit[n])
logger.fdebug("version found: " + str(comicversion))
else:
logger.fdebug("issue section")
logger.fdebug("Comic / Issue section")
if splitit[n].isdigit():
logger.fdebug("issue detected")
comiss = splitit[n]
#comiss = splitit[n]
comicNAMER = n - 1
comNAME = splitit[0]
cmnam = 1
@ -397,8 +482,36 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
# 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))
#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))
#--let's make sure we don't wipe out decimal issues ;)
if int(comisschk_decval) == 0:
ciss = comisschk_b4dec
cintdec = int(comisschk_decval)
else:
if len(comisschk_decval) == 1:
ciss = comisschk_b4dec + "." + comisschk_decval
cintdec = int(comisschk_decval) * 10
else:
ciss = comisschk_b4dec + "." + comisschk_decval.rstrip('0')
cintdec = int(comisschk_decval.rstrip('0')) * 10
comintIss = (int(comisschk_b4dec) * 1000) + cintdec
else:
comintIss = int(comic_iss) * 1000
logger.fdebug("issue we found for is : " + str(comic_iss))
logger.fdebug("integer value of issue we are found : " + str(comintIss))
#issue comparison now as well
if int(findcomiciss[findloop]) == int(comiss):
if int(intIss) == int(comintIss):
logger.fdebug('issues match!')
logger.info(u"Found " + str(ComicName) + " (" + str(comyear) + ") issue: " + str(IssueNumber) + " using " + str(nzbprov) )
## -- inherit issue. Comic year is non-standard. nzb year is the year
@ -428,6 +541,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
urllib.urlretrieve(linkapi, str(mylar.BLACKHOLE_DIR) + str(filenamenzb))
logger.fdebug("filename saved to your blackhole as : " + str(filenamenzb))
logger.info(u"Successfully sent .nzb to your Blackhole directory : " + str(mylar.BLACKHOLE_DIR) + str(filenamenzb) )
nzbname = str(filenamenzb)
#end blackhole
else:

View File

@ -58,14 +58,13 @@ def upcoming_update(ComicID, ComicName, IssueNumber, IssueDate):
issuechk = myDB.action("SELECT * FROM issues WHERE ComicID=? AND Issue_Number=?", [ComicID, IssueNumber]).fetchone()
if issuechk is None: pass
if issuechk is None:
logger.fdebug(str(issuechk['ComicName']) + " Issue: " + str(issuechk['IssueNumber']) + " not available for download yet...adding to Upcoming Wanted Releases.")
pass
else:
#print ("checking..." + str(issuechk['ComicName']) + " Issue: " + str(issuechk['Issue_Number']))
#print ("existing status: " + str(issuechk['Status']))
logger.fdebug("Available for download - checking..." + str(issuechk['ComicName']) + " Issue: " + str(issuechk['Issue_Number']))
logger.fdebug("...Existing status: " + str(issuechk['Status']))
control = {"IssueID": issuechk['IssueID']}
if mylar.AUTOWANT_UPCOMING:
newValue['Status'] = "Wanted"
values = { "Status": "Wanted"}
if issuechk['Status'] == "Snatched":
values = { "Status": "Snatched"}
newValue['Status'] = "Snatched"
@ -75,6 +74,16 @@ def upcoming_update(ComicID, ComicName, IssueNumber, IssueDate):
else:
values = { "Status": "Skipped"}
newValue['Status'] = "Skipped"
#was in wrong place :(
if mylar.AUTOWANT_UPCOMING:
if issuechk['Status'] == "Skipped":
newValue['Status'] = "Wanted"
values = { "Status": "Wanted"}
logger.fdebug("...New status of Wanted")
elif issuechk['Status'] == "Wanted":
logger.fdebug("...Status already Wanted .. not changing.")
else:
logger.fdebug("...Already have issue - keeping existing status of : " + issuechk['Status'])
myDB.upsert("upcoming", newValue, controlValue)
myDB.upsert("issues", values, control)
@ -194,11 +203,11 @@ def forceRescan(ComicID):
reiss = reissues[n]
except IndexError:
break
int_iss = reiss['Int_IssueNumber']
int_iss = helpers.decimal_issue(reiss['Issue_Number'])
issyear = reiss['IssueDate'][:4]
old_status = reiss['Status']
#print "integer_issue:" + str(int_iss) + " ... status: " + str(old_status)
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]))
@ -206,24 +215,76 @@ def forceRescan(ComicID):
fcnew[som] = fcnew[som].replace(".cbr", "")
elif ".cbz" in fcnew[som]:
fcnew[som] = fcnew[som].replace(".cbz", "")
if fcnew[som].isdigit():
elif fcnew[som].isdigit():
#this won't match on decimal issues - need to fix.
#print ("digit detected")
if int(fcnew[som]) > 0:
# fcdigit = fcnew[som].lstrip('0')
fcdigit = str(int(fcnew[som]))
#fcdigit = str(int(fcnew[som]))
fcdigit = int(fcnew[som]) * 1000
else:
fcdigit = "0"
if int(fcdigit) == int_iss:
#if issyear in fcnew[som+1]:
# print "matched on year:" + str(issyear)
#print ("matched...issue: " + str(fcdigit) + " --- " + str(int_iss))
havefiles+=1
haveissue = "yes"
isslocation = str(tmpfc['ComicFilename'])
break
#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).
#fcdigit = "0"
fcdigit = 0
elif "." in fcnew[som]:
#this will match on decimal issues
IssueChk = fcnew[som]
#print ("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.")
if isschk_decval.isdigit():
logger.fdebug("digit detected after decimal.")
else:
logger.fdebug("not an issue - no digit detected after decimal")
continue
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))
#--let's make sure we don't wipe out decimal issues ;)
if int(isschk_decval) == 0:
iss = isschk_b4dec
intdec = int(isschk_decval)
else:
if len(isschk_decval) == 1:
iss = isschk_b4dec + "." + isschk_decval
intdec = int(isschk_decval) * 10
else:
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))
else:
# it's a word, skip it.
fcdigit = 1000000
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))
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))
havefiles+=1
haveissue = "yes"
isslocation = str(tmpfc['ComicFilename'])
issSize = str(tmpfc['ComicSize'])
logger.fdebug(".......filename: " + str(isslocation))
logger.fdebug(".......filesize: " + str(tmpfc['ComicSize']))
break
#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
@ -251,6 +312,7 @@ def forceRescan(ComicID):
issStatus = "Downloaded"
controlValueDict = {"IssueID": reiss['IssueID']}
newValueDict = {"Location": isslocation,
"ComicSize": issSize,
"Status": issStatus
}
myDB.upsert("issues", newValueDict, controlValueDict)
@ -273,6 +335,11 @@ def forceRescan(ComicID):
else:
for down in downissues:
#print "downlocation:" + str(down['Location'])
#remove special characters from
#temploc = rescan['ComicLocation'].replace('_', ' ')
#temploc = re.sub('[\#\'\/\.]', '', temploc)
#print ("comiclocation: " + str(rescan['ComicLocation']))
#print ("downlocation: " + str(down['Location']))
comicpath = os.path.join(rescan['ComicLocation'], down['Location'])
if os.path.exists(comicpath):
pass

View File

@ -15,6 +15,7 @@
import os
import cherrypy
import datetime
from mako.template import Template
from mako.lookup import TemplateLookup
@ -253,6 +254,7 @@ class WebInterface(object):
addArtists.exposed = True
def queueissue(self, mode, ComicName=None, ComicID=None, ComicYear=None, ComicIssue=None, IssueID=None, new=False, redirect=None):
now = datetime.datetime.now()
myDB = db.DBConnection()
#mode dictates type of queue - either 'want' for individual comics, or 'series' for series watchlist.
if ComicID is None and mode == 'series':
@ -268,7 +270,7 @@ class WebInterface(object):
#better to set both to some generic #, and then filter out later...
cyear = myDB.action("SELECT SHIPDATE FROM weekly").fetchone()
ComicYear = str(cyear['SHIPDATE'])[:4]
if ComicYear == '': ComicYear = "2012"
if ComicYear == '': ComicYear = now.year
logger.info(u"Marking " + ComicName + " " + ComicIssue + " as wanted...")
foundcom = search.search_init(ComicName=ComicName, IssueNumber=ComicIssue, ComicYear=ComicYear, SeriesYear=None, IssueDate=cyear['SHIPDATE'], IssueID=IssueID)
if foundcom == "yes":
@ -288,9 +290,10 @@ class WebInterface(object):
issues = myDB.action("SELECT IssueDate FROM issues WHERE IssueID=?", [IssueID]).fetchone()
if ComicYear == None:
ComicYear = str(issues['IssueDate'])[:4]
miyr = myDB.action("SELECT ComicYear FROM comics WHERE ComicID=?", [ComicID]).fetchone()
SeriesYear = miyr['ComicYear']
foundcom = search.search_init(ComicName, ComicIssue, ComicYear, SeriesYear, issues['IssueDate'], IssueID)
miy = myDB.action("SELECT * FROM comics WHERE ComicID=?", [ComicID]).fetchone()
SeriesYear = miy['ComicYear']
AlternateSearch = miy['AlternateSearch']
foundcom = search.search_init(ComicName, ComicIssue, ComicYear, SeriesYear, issues['IssueDate'], IssueID, AlternateSearch)
if foundcom == "yes":
# file check to see if issue exists and update 'have' count
if IssueID is not None:
@ -526,10 +529,11 @@ class WebInterface(object):
return serve_template(templatename="config.html", title="Settings", config=config)
config.exposed = True
def comic_config(self, com_location, ComicID):
def comic_config(self, com_location, alt_search, ComicID):
myDB = db.DBConnection()
controlValueDict = {'ComicID': ComicID}
newValues = {"ComicLocation": com_location }
newValues = {"ComicLocation": com_location,
"AlternateSearch": alt_search }
#"QUALalt_vers": qual_altvers,
#"QUALScanner": qual_scanner,
#"QUALtype": qual_type,

View File

@ -371,7 +371,7 @@ def pullitcheck():
kc = []
otot = 0
#print ("You are watching for: " + str(w) + " comics")
logger.fdebug("You are watching for: " + str(w) + " comics")
#print ("----------THIS WEEK'S PUBLISHED COMICS------------")
if w > 0:
while (cnt > -1):
@ -428,7 +428,7 @@ def pullitcheck():
ComicIssue = str(watchfndiss[tot -1] + ".00")
ComicDate = str(week['SHIPDATE'])
ComicName = str(unlines[cnt])
#print ("added: " + str(watchfnd[tot -1]) + " ISSUE: " + str(watchfndiss[tot -1]))
logger.fdebug("Watchlist hit for : " + str(watchfnd[tot -1]) + " 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...
@ -440,7 +440,7 @@ def pullitcheck():
break
cnt-=1
#print ("-------------------------")
#print ("There are " + str(otot) + " comics this week to get!")
print ("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)!" )