FIX:(#349) Import would fail on not being able to detect year if year was the last item in the filename, FIX:(#353) Titles with same not not detecting as 'Ended' properly, IMP: CV_ONLY and CV_ONETIMER now set to default to 1, IMP: Added additional publisher images

This commit is contained in:
evilhero 2013-04-21 23:11:12 -04:00
parent f929943ec0
commit 199fd25d8f
31 changed files with 234 additions and 83 deletions

View File

@ -65,15 +65,43 @@
</td>
<td width="100%" padding="10">
%if comic['ComicPublisher'] == 'DC Comics':
<img src="interfaces/default/images/logo-dccomics.png" align="right" alt="DC" height="50" width="50" />
<img src="interfaces/default/images/publisherlogos/logo-dccomics.png" align="right" alt="DC" height="50" width="50" />
%elif comic['ComicPublisher'] == 'Marvel':
<img src="interfaces/default/images/logo-marvel.jpg" align="right" alt="Marvel" height="50" width="100"/>
<img src="interfaces/default/images/publisherlogos/logo-marvel.jpg" align="right" alt="Marvel" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Image':
<img src="interfaces/default/images/logo-imagecomics.gif" align="right" alt="Image" height="100" width="50" />
%elif comic['ComicPublisher'] == 'Dark Horse Comics':
<img src="interfaces/default/images/logo-darkhorse.jpg" align="right" alt="Darkhorse" height="75" width="50" />
<img src="interfaces/default/images/publisherlogos/logo-imagecomics.png" align="right" alt="Image" height="100" width="50" />
%elif comic['ComicPublisher'] == 'Dark Horse Comics' or comic['ComicPublisher'] == 'Dark Horse':
<img src="interfaces/default/images/publisherlogos/logo-darkhorse.png" align="right" alt="Darkhorse" height="100" width="75" />
%elif comic['ComicPublisher'] == 'IDW Publishing':
<img src="interfaces/default/images/logo-idwpublish.png" align="right" alt="IDW" height="50" width="100"/>
<img src="interfaces/default/images/publisherlogos/logo-idwpublish.png" align="right" alt="IDW" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Icon':
<img src="interfaces/default/images/publisherlogos/logo-iconcomics.png" align="right" alt="Icon" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Red5':
<img src="interfaces/default/images/publisherlogos/logo-red5comics.png" align="right" alt="Red5" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Vertigo':
<img src="interfaces/default/images/publisherlogos/logo-vertigo.jpg" align="right" alt="Vertigo" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'ShadowLine':
<img src="interfaces/default/images/publisherlogos/logo-shadowline.png" align="right" alt="Shadowline" height="75" width="100"/>
%elif comic['ComicPublisher'] == 'Archie Comics':
<img src="interfaces/default/images/publisherlogos/logo-archiecomics.jpg" align="right" alt="Archie" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Oni Press':
<img src="interfaces/default/images/publisherlogos/logo-onipress.png" align="right" alt="Oni Press" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Tokyopop':
<img src="interfaces/default/images/publisherlogos/logo-tokyopop.jpg" align="right" alt="Tokyopop" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Midtown Comics':
<img src="interfaces/default/images/publisherlogos/logo-midtowncomics.jpg" align="right" alt="Midtown" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Boom! Studios':
<img src="interfaces/default/images/publisherlogos/logo-boom.jpg" align="right" alt="Boom!" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Skybound':
<img src="interfaces/default/images/publisherlogos/logo-skybound.jpg" align="right" alt="Skybound" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Vertigo':
<img src="interfaces/default/images/publisherlogos/logo-dynamite.jpg" align="right" alt="Dynamite" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Top Cow':
<img src="interfaces/default/images/publisherlogos/logo-topcow.gif" align="right" alt="Top Cow" height="75" width="100"/>
%elif comic['ComicPublisher'] == 'Dynamite Entertainment':
<img src="interfaces/default/images/publisherlogos/logo-dynamite.png" align="right" alt="Dynamite" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Cartoon Books':
<img src="interfaces/default/images/publisherlogos/logo-cartoonbooks.jpg" align="right" alt="Cartoon Books" height="75" width="90"/>
%endif
<fieldset>
<div>
@ -120,15 +148,15 @@
</td>
<td width="100%" padding="10">
%if comic['ComicPublisher'] == 'DC Comics':
<img src="interfaces/default/images/logo-dccomics.png" align="right" alt="DC" height="50" width="50">
<img src="interfaces/default/images/publisherlogos/logo-dccomics.png" align="right" alt="DC" height="50" width="50">
%elif comic['ComicPublisher'] == 'Marvel':
<img src="interfaces/default/images/logo-marvel.jpg" align="right" alt="Marvel" height="50" width="100">
<img src="interfaces/default/images/publisherlogos/logo-marvel.jpg" align="right" alt="Marvel" height="50" width="100">
%elif comic['ComicPublisher'] == 'Image':
<img src="interfaces/default/images/logo-imagecomics.gif" align="right" alt="Image" height="100" width="50"/>
<img src="interfaces/default/images/publisherlogos/logo-imagecomics.png" align="right" alt="Image" height="100" width="50"/>
%elif comic['ComicPublisher'] == 'Dark Horse Comics':
<img src="interfaces/default/images/logo-darkhorse.jpg" align="right" alt="Darkhorse" height="75" width="50"/>
<img src="interfaces/default/images/publisherlogos/logo-darkhorse.png" align="right" alt="Darkhorse" height="75" width="50"/>
%elif comic['ComicPublisher'] == 'IDW Publishing':
<img src="interfaces/default/images/logo-idwpublish.png" align="right" alt="IDW" height="50" width="100"/>
<img src="interfaces/default/images/publisherlogos/logo-idwpublish.png" align="right" alt="IDW" height="50" width="100"/>
%endif
<fieldset>
<div>
@ -180,15 +208,15 @@
</td>
<td width="100%" padding="10">
%if comic['ComicPublisher'] == 'DC Comics':
<img src="interfaces/default/images/logo-dccomics.png" align="right" alt="DC" height="50" width="50"/>
<img src="interfaces/default/images/publisherlogos/logo-dccomics.png" align="right" alt="DC" height="50" width="50"/>
%elif comic['ComicPublisher'] == 'Marvel':
<img src="interfaces/default/images/logo-marvel.jpg" align="right" alt="Marvel" height="50" width="100"/>
<img src="interfaces/default/images/publisherlogos/logo-marvel.jpg" align="right" alt="Marvel" height="50" width="100"/>
%elif comic['ComicPublisher'] == 'Image':
<img src="interfaces/default/images/logo-imagecomics.gif" align="right" alt="Image" height="100" width="50"/>
<img src="interfaces/default/images/publisherlogos/logo-imagecomics.png" align="right" alt="Image" height="100" width="50"/>
%elif comic['ComicPublisher'] == 'Dark Horse Comics':
<img src="interfaces/default/images/logo-darkhorse.jpg" align="right" alt="Darkhorse" height="75" width="50"/>
<img src="interfaces/default/images/publisherlogos/logo-darkhorse.png" align="right" alt="Darkhorse" height="75" width="50"/>
%elif comic['ComicPublisher'] == 'IDW Publishing':
<img src="interfaces/default/images/logo-idwpublish.png" align="right" alt="IDW" height="50" width="100"/>
<img src="interfaces/default/images/publisherlogos/logo-idwpublish.png" align="right" alt="IDW" height="50" width="100"/>
%endif
<form action="comic_config" method="GET">

View File

@ -917,7 +917,7 @@ div#artistheader h2 a {
text-align: center;
}
#read_detail th#issueyear {
min-width: 75px;
min-width: 40px;
text-align: center;
}
#read_detail td#comicname {
@ -933,7 +933,7 @@ div#artistheader h2 a {
vertical-align: middle;
}
#read_detail td#issueyear{
min-width: 75px;
min-width: 40px;
text-align: left;
vertical-align: middle;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

@ -194,10 +194,11 @@ COUNT_HAVES = 0
COMICSORT = None
ANNUALS_ON = 0
CV_ONLY = 0
CV_ONETIMER = 0
CV_ONLY = 1
CV_ONETIMER = 1
GRABBAG_DIR = None
HIGHCOUNT = 0
READ2FILENAME = 0
def CheckSection(sec):
""" Check if INI section exists, if not create it """
@ -258,7 +259,7 @@ def initialize():
NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS,\
RAW, RAW_PROVIDER, RAW_USERNAME, RAW_PASSWORD, RAW_GROUPS, EXPERIMENTAL, \
PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, \
PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, LOWERCASE_FILENAMES, USE_MINSIZE, MINSIZE, USE_MAXSIZE, MAXSIZE, CORRECT_METADATA, FOLDER_FORMAT, FILE_FORMAT, REPLACE_CHAR, REPLACE_SPACES, ADD_TO_CSV, CVINFO, LOG_LEVEL, POST_PROCESSING, SEARCH_DELAY, GRABBAG_DIR, \
PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, LOWERCASE_FILENAMES, USE_MINSIZE, MINSIZE, USE_MAXSIZE, MAXSIZE, CORRECT_METADATA, FOLDER_FORMAT, FILE_FORMAT, REPLACE_CHAR, REPLACE_SPACES, ADD_TO_CSV, CVINFO, LOG_LEVEL, POST_PROCESSING, SEARCH_DELAY, GRABBAG_DIR, READ2FILENAME, \
COMIC_LOCATION, QUAL_ALTVERS, QUAL_SCANNER, QUAL_TYPE, QUAL_QUALITY, ENABLE_EXTRA_SCRIPTS, EXTRA_SCRIPTS, ENABLE_PRE_SCRIPTS, PRE_SCRIPTS, PULLNEW, COUNT_ISSUES, COUNT_HAVES, COUNT_COMICS, SYNO_FIX, ANNUALS_ON, CV_ONLY, CV_ONETIMER
if __INITIALIZED__:
@ -336,7 +337,7 @@ def initialize():
GRABBAG_DIR = DESTINATION_DIR
HIGHCOUNT = check_setting_str(CFG, 'General', 'highcount', '')
if not HIGHCOUNT: HIGHCOUNT = 0
READ2FILENAME = bool(check_setting_int(CFG, 'General', 'read2filename', 0))
PROWL_ENABLED = bool(check_setting_int(CFG, 'Prowl', 'prowl_enabled', 0))
PROWL_KEYS = check_setting_str(CFG, 'Prowl', 'prowl_keys', '')
PROWL_ONSNATCH = bool(check_setting_int(CFG, 'Prowl', 'prowl_onsnatch', 0))
@ -355,15 +356,15 @@ def initialize():
CVINFO = bool(check_setting_int(CFG, 'General', 'cvinfo', 0))
ANNUALS_ON = bool(check_setting_int(CFG, 'General', 'annuals_on', 0))
if not ANNUALS_ON:
#default to off
#default to on
ANNUALS_ON = 0
CV_ONLY = bool(check_setting_int(CFG, 'General', 'cv_only', 0))
CV_ONLY = bool(check_setting_int(CFG, 'General', 'cv_only', 1))
if not CV_ONLY:
#default to off
CV_ONLY = 0
CV_ONETIMER = bool(check_setting_int(CFG, 'General', 'cv_onetimer', 0))
#default to on
CV_ONLY = 1
CV_ONETIMER = bool(check_setting_int(CFG, 'General', 'cv_onetimer', 1))
if not CV_ONETIMER:
CV_ONETIMER = 0
CV_ONETIMER = 1
LOG_LEVEL = check_setting_str(CFG, 'General', 'log_level', '')
ENABLE_EXTRA_SCRIPTS = bool(check_setting_int(CFG, 'General', 'enable_extra_scripts', 0))
EXTRA_SCRIPTS = check_setting_str(CFG, 'General', 'extra_scripts', '')
@ -667,7 +668,7 @@ def config_write():
new_config['General']['search_delay'] = SEARCH_DELAY
new_config['General']['grabbag_dir'] = GRABBAG_DIR
new_config['General']['highcount'] = HIGHCOUNT
new_config['General']['read2filename'] = int(READ2FILENAME)
new_config['General']['use_minsize'] = int(USE_MINSIZE)
new_config['General']['minsize'] = MINSIZE
new_config['General']['use_maxsize'] = int(USE_MAXSIZE)

View File

@ -61,15 +61,17 @@ def listFiles(dir,watchcomic,AlternateSearch=None):
subname = re.sub(subit, '', subname)
volrem = subit
subname = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]',' ', str(subname))
modwatchcomic = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]', ' ', u_watchcomic)
subname = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\+\'\?\@]',' ', str(subname))
modwatchcomic = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\+\'\?\@]', ' ', u_watchcomic)
modwatchcomic = re.sub('\&', ' and ', modwatchcomic)
modwatchcomic = re.sub('\s+', ' ', str(modwatchcomic)).strip()
subname = re.sub('&', ' and ', subname)
subname = re.sub('\s+', ' ', str(subname)).strip()
if AlternateSearch is not None:
#same = encode.
u_altsearchcomic = AlternateSearch.encode('ascii', 'ignore').strip()
altsearchcomic = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\&\+\'\?\@]', ' ', u_altsearchcomic)
altsearchcomic = re.sub('[\_\#\,\/\:\;\.\-\!\$\%\+\'\?\@]', ' ', u_altsearchcomic)
altseachcomic = re.sub('&', ' and ', altsearchcomic)
altsearchcomic = re.sub('\s+', ' ', str(altsearchcomic)).strip()
else:
#create random characters so it will never match.

View File

@ -608,7 +608,7 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None):
if pullupd is None:
# lets' check the pullist for anything at this time as well since we're here.
# do this for only Present comics....
if mylar.AUTOWANT_UPCOMING: #and 'Present' in gcdinfo['resultPublished']:
if mylar.AUTOWANT_UPCOMING and lastpubdate == 'Present': #and 'Present' in gcdinfo['resultPublished']:
logger.info(u"Checking this week's pullist for new issues of " + comic['ComicName'])
updater.newpullcheck(comic['ComicName'], comicid)

View File

@ -224,6 +224,12 @@ def libraryScan(dir=None, append=False, ComicID=None, ComicName=None, cron=None)
com_NAME = cname
print ("com_NAME : " + com_NAME)
yearmatch = "True"
else:
# we're assuming that the year is in brackets (and it should be damnit)
if m[cnt][:-2] == '19' or m[cnt][:-2] == '20':
print ("year detected: " + str(m[cnt]))
ydetected = 'yes'
result_comyear = m[cnt]
cnt+=1
splitit = []

View File

@ -87,7 +87,7 @@ def findComic(name, mode, issue, limityear=None):
xmlcnt = result.getElementsByTagName('count_of_issues')[0].firstChild.wholeText
#here we can determine what called us, and either start gathering all issues or just limited ones.
#print ("n: " + str(n) + "--xmcnt" + str(xmlcnt))
if issue is not None and issue.isdigit():
if issue is not None and str(issue).isdigit():
#this gets buggered up with NEW/ONGOING series because the db hasn't been updated
#to reflect the proper count. Drop it by 1 to make sure.
limiter = int(issue) - 1

View File

@ -468,7 +468,8 @@ class WebInterface(object):
raise cherrypy.HTTPRedirect("home")
addArtists.exposed = True
def queueissue(self, mode, ComicName=None, ComicID=None, ComicYear=None, ComicIssue=None, IssueID=None, new=False, redirect=None):
def queueissue(self, mode, ComicName=None, ComicID=None, ComicYear=None, ComicIssue=None, IssueID=None, new=False, redirect=None, SeriesYear=None):
print 'tada'
now = datetime.datetime.now()
myDB = db.DBConnection()
#mode dictates type of queue - either 'want' for individual comics, or 'series' for series watchlist.
@ -479,6 +480,17 @@ class WebInterface(object):
# we can limit the search by including the issue # and searching for
# comics that have X many issues
raise cherrypy.HTTPRedirect("searchit?name=%s&issue=%s&mode=%s" % (ComicName, 'None', 'pullseries'))
elif ComicID is None and mode == 'readlist':
# this is for marking individual comics from a readlist to be downloaded.
# Because there is no associated ComicID or IssueID, follow same pattern as in 'pullwant'
# except we know the Year
if ComicYear is None: ComicYear = SeriesYear
logger.info(u"Marking " + ComicName + " " + ComicIssue + " as wanted...")
foundcom = search.search_init(ComicName=ComicName, IssueNumber=ComicIssue, ComicYear=ComicYear, SeriesYear=None, IssueDate=None, IssueID=None, AlternateSearch=None, UseFuzzy=None, ComicVersion=None)
if foundcom == "yes":
logger.info(u"Downloaded " + ComicName + " #" + ComicIssue + " (" + str(ComicYear) + ")")
raise cherrypy.HTTPRedirect("readlist")
elif ComicID is None and mode == 'pullwant':
#this is for marking individual comics from the pullist to be downloaded.
#because ComicID and IssueID will both be None due to pullist, it's probably
@ -763,17 +775,20 @@ class WebInterface(object):
myDB = db.DBConnection()
readlist = myDB.select("SELECT * from readinglist group by StoryArcID COLLATE NOCASE")
issuelist = myDB.select("SELECT * from readlist")
return serve_template(templatename="readinglist.html", title="Readlist", readlist=readlist, issuelist=issuelist)
readConfig = {
"read2filename" : helpers.checked(mylar.READ2FILENAME)
}
return serve_template(templatename="readinglist.html", title="Readlist", readlist=readlist, issuelist=issuelist,readConfig=readConfig)
return page
readlist.exposed = True
def detailReadlist(self,StoryArcID, StoryArcName):
myDB = db.DBConnection()
readlist = myDB.select("SELECT * from readinglist WHERE StoryArcID=? order by ReadingOrder ASC", [StoryArcID])
return serve_template(templatename="readlist.html", title="Detailed Arc list", readlist=readlist, storyarcname=StoryArcName)
return serve_template(templatename="readlist.html", title="Detailed Arc list", readlist=readlist, storyarcname=StoryArcName, storyarcid=StoryArcID)
detailReadlist.exposed = True
def removefromreadlist(self, IssueID=None, StoryArcID=None, IssueArcID=None):
def removefromreadlist(self, IssueID=None, StoryArcID=None, IssueArcID=None, AllRead=None):
myDB = db.DBConnection()
if IssueID:
myDB.action('DELETE from readlist WHERE IssueID=?', [IssueID])
@ -784,6 +799,9 @@ class WebInterface(object):
elif IssueArcID:
myDB.action('DELETE from readinglist WHERE IssueArcID=?', [IssueArcID])
logger.info("Removed " + str(IssueArcID) + " from the Story Arc.")
elif AllRead:
myDB.action("DELETE from readlist WHERE Status='Read'")
logger.info("Removed All issues that have been marked as Read from Reading List")
removefromreadlist.exposed = True
def markasRead(self, IssueID=None, IssueArcID=None):
@ -870,42 +888,78 @@ class WebInterface(object):
"TotalIssues": len(tracks)}
myDB.upsert("readinglist", NewVals, CtrlVal)
i+=1
raise cherrypy.HTTPRedirect("detailReadlist?StoryArcID=%s&StoryArcName=%s" % (storyarcid, storyarc))
importReadlist.exposed = True
#Story Arc Ascension...welcome to the next level :)
def ArcWatchlist(self):
def ArcWatchlist(self,StoryArcID=None):
myDB = db.DBConnection()
ArcWatch = myDB.select("SELECT * FROM readinglist")
if StoryArcID:
ArcWatch = myDB.select("SELECT * FROM readinglist WHERE StoryArcID=?", [StoryArcID])
else:
ArcWatch = myDB.select("SELECT * FROM readinglist")
if ArcWatch is None: logger.info("No Story Arcs to search")
else:
Comics = myDB.select("SELECT * FROM comics")
arc_match = []
wantedlist = []
showonreadlist = 1 # 0 won't show storyarcissues on readinglist main page, 1 will show
for arc in ArcWatch:
print ("arc: " + str(arc['ComicName']))
logger.fdebug("arc: " + arc['storyarc'] + " : " + arc['ComicName'] + " : " + arc['IssueNumber'])
#cycle through the story arcs here for matches on the watchlist
mod_arc = re.sub('[\:/,\'\/\-\&\%\$\#\@\!\*\+\.]', '', arc['ComicName'])
mod_arc = re.sub('\\bthe\\b', '', mod_arc.lower())
mod_arc = re.sub('\\band\\b', '', mod_arc.lower())
mod_arc = re.sub(r'\s', '', mod_arc)
matcheroso = "no"
for comic in Comics:
print ("comic: " + comic['ComicName'])
logger.fdebug("comic: " + comic['ComicName'])
mod_watch = re.sub('[\:\,\'\/\-\&\%\$\#\@\!\*\+\.]', '', comic['ComicName'])
mod_watch = re.sub('\\bthe\\b', '', mod_watch.lower())
mod_watch = re.sub('\\band\\b', '', mod_watch.lower())
mod_watch = re.sub(r'\s', '', mod_watch)
if mod_watch == mod_arc and arc['SeriesYear'] == comic['SeriesYear']:
#gather the matches now.
arc_match.append({
"match_name": arc['ComicName'],
"match_id": comic['ComicID'],
"match_issue": arc['IssueNumber'],
"match_issuearcid": arc['IssueArcID']})
logger.fdebu("arc_Match:" + arc_match)
logger.fdebu("we matched on " + str(len(arc_match)) + " issues")
if mod_watch == mod_arc:# and arc['SeriesYear'] == comic['ComicYear']:
logger.fdebug("intial name match - confirming issue # is present in series")
if comic['ComicID'][:1] == 'G':
# if it's a multi-volume series, it's decimalized - let's get rid of the decimal.
GCDissue, whocares = helpers.decimal_issue(arc['IssueNumber'])
GCDissue = int(GCDissue) / 1000
logger.fdebug("issue converted to " + str(GCDissue))
isschk = myDB.action("SELECT * FROM issues WHERE ComicName=? AND Issue_Number=?", [comic['ComicName'], str(GCDissue)]).fetchone()
else:
isschk = myDB.action("SELECT * FROM issues WHERE ComicName=? AND Issue_Number=?", [comic['ComicName'], arc['IssueNumber']]).fetchone()
if isschk is None:
logger.fdebug("we matched on name, but issue " + str(arc['IssueNumber']) + " doesn't exist for " + comic['ComicName'])
else:
logger.fdebug("issue #: " + str(arc['IssueNumber']) + " is present!")
print isschk
print ("Comicname: " + arc['ComicName'])
#print ("ComicID: " + str(isschk['ComicID']))
print ("Issue: " + arc['IssueNumber'])
print ("IssueArcID: " + arc['IssueArcID'])
#gather the matches now.
arc_match.append({
"match_name": arc['ComicName'],
"match_id": isschk['ComicID'],
"match_issue": arc['IssueNumber'],
"match_issuearcid": arc['IssueArcID'],
"match_seriesyear": comic['ComicYear']})
matcheroso = "yes"
if matcheroso == "no":
logger.fdebug("Unable to find a match for " + arc['ComicName'] + " :#" + str(arc['IssueNumber']))
wantedlist.append({
"ComicName": arc['ComicName'],
"IssueNumber": arc['IssueNumber'],
"IssueYear": arc['IssueYear']})
logger.fdebug("we matched on " + str(len(arc_match)) + " issues")
for m_arc in arc_match:
print m_arc
#now we cycle through the issues looking for a match.
issue = myDB.action("SELECT * FROM issues where ComicID=? and Issue_Number=?", [m_arc['match_id'],m_arc['match_issue']])
issue = myDB.action("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']))
@ -913,27 +967,59 @@ class WebInterface(object):
if issue['Issue_Number'] == m_arc['match_issue']:
logger.fdebug("we matched on " + str(issue['Issue_Number']) + " for " + str(m_arc['match_name']))
if issue['Status'] == 'Downloaded' or issue['Status'] == 'Archived':
ctrlVal = {"IssueArcID": match_issuearcid }
newVal = {"Status": issue['Status']}
ctrlVal = {"IssueArcID": m_arc['match_issuearcid'] }
newVal = {"Status": issue['Status'],
"IssueID": issue['IssueID']}
if showonreadlist:
showctrlVal = {"IssueID": issue['IssueID']}
shownewVal = {"ComicName": issue['ComicName'],
"Issue_Number": issue['Issue_Number'],
"IssueDate": issue['IssueDate'],
"SeriesYear": m_arc['match_seriesyear'],
"ComicID": m_arc['match_id']}
myDB.upsert("readlist", shownewVal, showctrlVal)
myDB.upsert("readinglist",newVal,ctrlVal)
logger.info("Already have " + match_issuearcid)
break
logger.info("Already have " + issue['ComicName'] + " :# " + str(issue['Issue_Number']))
else:
logger.fdebug("We don't have " + issue['ComicName'] + " :# " + str(issue['Issue_Number']))
ctrlVal = {"IssueArcID": m_arc['match_issuearcid'] }
newVal = {"Status": "Wanted",
"IssueID": issue['IssueID']}
myDB.upsert("readinglist",newVal,ctrlVal)
logger.info("Marked " + issue['ComicName'] + " :# " + str(issue['Issue_Number']) + " as WANTED.")
ArcWatchlist.exposed = True
def ReadMassCopy(self, StoryArcID, StoryArcName):
#this copies entire story arcs into the /cache/<storyarc> folder
#alternatively, it will copy the issues individually directly to a 3rd party device (ie.tablet)
myDB = db.DBConnection()
copylist = myDB.select("SELECT * FROM readlist WHERE StoryArcID=? AND Status='Downloaded'", [StoryArcID])
if copylist is None:
logger.fdebug("You don't have any issues from " + StoryArcName + ". Aborting Mass Copy.")
return
else:
dst = os.path.join(mylar.CACHE, StoryArcName)
for files in copylist:
copyloc = files['Location']
ReadMassCopy.exposed = True
def logs(self):
if mylar.LOG_LEVEL is None or mylar.LOG_LEVEL == '':
mylar.LOG_LEVEL = 'info'
mylar.LOG_LEVEL = 'INFO'
return serve_template(templatename="logs.html", title="Log", lineList=mylar.LOG_LIST, log_level=mylar.LOG_LEVEL)
logs.exposed = True
def log_change(self, **args):
print ("here: " + str(args))
for loglevel in args:
if loglevel is None: continue
else:
print ("changing logger to " + str(loglevel))
LOGGER.setLevel(loglevel)
return serve_template(templatename="logs.html", title="Log", lineList=mylar.LOG_LIST)
def log_change(self, loglevel):
if log_level is not None:
print ("changing logger to " + str(log_level))
LOGGER.setLevel(log_level)
return serve_template(templatename="logs.html", title="Log", lineList=mylar.LOG_LIST, log_level=log_level)
log_change.exposed = True
def clearhistory(self, type=None):
@ -947,21 +1033,45 @@ class WebInterface(object):
raise cherrypy.HTTPRedirect("history")
clearhistory.exposed = True
def downloadLocal(self, IssueID):
#print ("issueid: " + str(IssueID))
def downloadLocal(self, IssueID=None, IssueArcID=None, ReadOrder=None):
print "tada"
print ("issueid: " + str(IssueID))
myDB = db.DBConnection()
issueDL = myDB.action("SELECT * FROM issues WHERE IssueID=?", [IssueID]).fetchone()
comicid = issueDL['ComicID']
#print ("comicid: " + str(comicid))
comic = myDB.action("SELECT * FROM comics WHERE ComicID=?", [comicid]).fetchone()
issueLOC = comic['ComicLocation']
#print ("IssueLOC: " + str(issueLOC))
issueFILE = issueDL['Location']
#print ("IssueFILE: "+ str(issueFILE))
issuePATH = os.path.join(issueLOC,issueFILE)
#print ("IssuePATH: " + str(issuePATH))
dstPATH = os.path.join(mylar.CACHE_DIR, issueFILE)
#print ("dstPATH: " + str(dstPATH))
if IssueID:
issueDL = myDB.action("SELECT * FROM issues WHERE IssueID=?", [IssueID]).fetchone()
comicid = issueDL['ComicID']
#print ("comicid: " + str(comicid))
comic = myDB.action("SELECT * FROM comics WHERE ComicID=?", [comicid]).fetchone()
#---issue info
comicname = comic['ComicName']
issuenum = issueDL['Issue_Number']
issuedate = issueDL['IssueDate']
seriesyear = comic['ComicYear']
#---
issueLOC = comic['ComicLocation']
#print ("IssueLOC: " + str(issueLOC))
issueFILE = issueDL['Location']
#print ("IssueFILE: "+ str(issueFILE))
issuePATH = os.path.join(issueLOC,issueFILE)
#print ("IssuePATH: " + str(issuePATH))
dstPATH = os.path.join(mylar.CACHE_DIR, issueFILE)
#print ("dstPATH: " + str(dstPATH))
if IssueArcID:
if mylar.READ2FILENAME:
#if it's coming from a StoryArc, check to see if we're appending the ReadingOrder to the filename
ARCissueFILE = ReadOrder + "-" + issueFILE
dstPATH = os.path.join(mylar.CACHE_DIR, ARCissueFILE)
# issueDL = myDB.action("SELECT * FROM readinglist WHERE IssueArcID=?", [IssueArcID]).fetchone()
# storyarcid = issueDL['StoryArcID']
# #print ("comicid: " + str(comicid))
# issueLOC = mylar.DESTINATION_DIR
# #print ("IssueLOC: " + str(issueLOC))
# issueFILE = issueDL['Location']
# #print ("IssueFILE: "+ str(issueFILE))
# issuePATH = os.path.join(issueLOC,issueFILE)
# #print ("IssuePATH: " + str(issuePATH))
# dstPATH = os.path.join(mylar.CACHE_DIR, issueFILE)
# #print ("dstPATH: " + str(dstPATH))
try:
shutil.copy2(issuePATH, dstPATH)
except IOError as e:
@ -974,7 +1084,11 @@ class WebInterface(object):
'Location': issueFILE}
myDB.upsert("readlist", newValueDict, controlValueDict)
myDB.upsert("issues", newValueDict, controlValueDict)
if IssueArcID:
controlValueD = {'IssueArcID': IssueArcID}
newValueDict = {'inCacheDIR': 'True',
'Location': ARCissueFILE}
myDB.upsert("readinglist", newValueDict, controlValueD)
#print("DB updated - Download link now enabled.")
downloadLocal.exposed = True