mirror of https://github.com/evilhero/mylar
FIX:(#231) Error about lower() on startup via browser, FIX:(#230) Manual Renaming button did nothing (works now - code in place), FIX:(#220) Uncommented line required for pre-scripts, IMP: Removed unnecessary repetitive logging when parsing, IMP:InfoPop on Downloaded/Archived issues that shows Filename and size.
This commit is contained in:
parent
4d1555ea99
commit
3bdcf9dc16
|
@ -10,7 +10,7 @@
|
|||
<div id="subhead_menu">
|
||||
<a id="menu_link_refresh" onclick="doAjaxCall('refreshArtist?ComicID=${comic['ComicID']}', $(this)),'table'" href="#" data-success="'${comic['ComicName']}' is being refreshed">Refresh Comic</a>
|
||||
<a id="menu_link_delete" href="deleteArtist?ComicID=${comic['ComicID']}">Delete Comic</a>
|
||||
<a id="menu_link_refresh" onclick="doAjaxCall('manualRename?comicid=${comic['ComicID']}', $(this),'table'" href="#" data-success="Renaming files.">Rename Files</a>
|
||||
<a id="menu_link_refresh" onclick="doAjaxCall('manualRename?comicid=${comic['ComicID']}', $(this),'table')" data-success="Renaming files.">Rename Files</a>
|
||||
<a id="menu_link_refresh" onclick="doAjaxCall('forceRescan?ComicID=${comic['ComicID']}', $(this)),'table'" href="#" data-success="'${comic['ComicName']}' is being refreshed">Recheck Files</a>
|
||||
%if comic['Status'] == 'Paused':
|
||||
<a id="menu_link_resume" href="#" onclick="doAjaxCall('resumeArtist?ComicID=${comic['ComicID']}',$(this),true)" data-success="${comic['ComicName']} resumed">Resume Comic</a>
|
||||
|
@ -270,7 +270,12 @@
|
|||
<td id="issuenumber">${issue['Issue_Number']}</td>
|
||||
<td id="issuename">${issue['IssueName']}</td>
|
||||
<td id="reldate">${issue['IssueDate']}</td>
|
||||
<td id="status">${issue['Status']}</td>
|
||||
<td id="status">${issue['Status']}
|
||||
%if issue['Status'] == 'Downloaded' or issue['Status'] == 'Archived':
|
||||
<%Csize = mylar.helpers.human_size(issue['ComicSize'])%>
|
||||
<a href="#" title="${issue['Location']} (${Csize})"><img src="interfaces/default/images/info32.png" height="16" alt="" /></a>
|
||||
%endif
|
||||
</td>
|
||||
<td id="options">
|
||||
%if issue['Status'] == 'Skipped':
|
||||
<a href="#" title="Mark issue as Wanted" onclick="doAjaxCall('queueissue?ComicID=${issue['ComicID']}&IssueID=${issue['IssueID']}&ComicIssue=${issue['Issue_Number']}&ComicYear=${issue['IssueDate']}&mode=want',$(this),'table')"><img src="interfaces/default/images/wanted_icon.png" height="25" width="25" /></a>
|
||||
|
@ -296,6 +301,7 @@
|
|||
|
||||
<%def name="headIncludes()">
|
||||
<link rel="stylesheet" href="interfaces/default/css/data_table.css">
|
||||
|
||||
%if comic['Status'] == 'Loading':
|
||||
<meta http-equiv="refresh" content="60">
|
||||
%endif
|
||||
|
@ -305,6 +311,7 @@
|
|||
<%def name="javascriptIncludes()">
|
||||
<script src="js/libs/jquery.dataTables.min.js"></script>
|
||||
<script>
|
||||
|
||||
// show/hide different types of rows when the checkboxes are changed
|
||||
$("#checkboxControls input").change(function(e){
|
||||
var whichClass = $(this).attr('id')
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -71,7 +71,9 @@
|
|||
<td id="published">${comic['LatestDate']}</td>
|
||||
<td id="have"><span title="${percent}"></span><div class="progress-container"><div style="background-color:#a3e532; height:14px; width:${percent}%"><div class="havetracks">${havetracks}/${totaltracks}</div></div></div></td>
|
||||
<td id="status">
|
||||
%if 'present' in comic['ComicPublished'].lower():
|
||||
%if comic['ComicPublished'] is None or comic['ComicPublished'] == '':
|
||||
Unknown
|
||||
%elif 'present' in comic['ComicPublished'].lower():
|
||||
Continuing
|
||||
%else:
|
||||
Ended
|
||||
|
|
|
@ -92,7 +92,7 @@ class PostProcessor(object):
|
|||
self._log("initiating pre script detection.", logger.DEBUG)
|
||||
self._log("mylar.PRE_SCRIPTS : " + mylar.PRE_SCRIPTS, logger.DEBUG)
|
||||
# for currentScriptName in mylar.PRE_SCRIPTS:
|
||||
# currentScriptName = str(mylar.PRE_SCRIPTS).decode("string_escape")
|
||||
currentScriptName = str(mylar.PRE_SCRIPTS).decode("string_escape")
|
||||
self._log("pre script detected...enabling: " + str(currentScriptName), logger.DEBUG)
|
||||
# generate a safe command line string to execute the script and provide all the parameters
|
||||
script_cmd = shlex.split(currentScriptName, posix=False) + [str(nzb_name), str(nzb_folder), str(seriesmetadata)]
|
||||
|
|
|
@ -221,7 +221,7 @@ def GCDdetails(comseries, resultURL, vari_loop, ComicID, TotalIssues, issvariati
|
|||
# resultPublished will return just the date and not the word 'Present' which dictates on the main
|
||||
# page if a series is Continuing / Ended .
|
||||
if resultFormat != '':
|
||||
if 'ongoing series' in resultFormat.lower() and 'was' not in resultFormat.lower():
|
||||
if 'ongoing series' in resultFormat.lower() and 'was' not in resultFormat.lower() and 'present' not in resultPublished.lower():
|
||||
resultPublished = resultPublished + " - Present"
|
||||
coverst = soup.find("div", {"id" : "series_cover"})
|
||||
if coverst < 0:
|
||||
|
@ -291,7 +291,7 @@ def GCDdetails(comseries, resultURL, vari_loop, ComicID, TotalIssues, issvariati
|
|||
dec_ad = dec_chk[dec_st+1:]
|
||||
dec_ad = re.sub("\s", "", dec_ad)
|
||||
if dec_b4.isdigit() and dec_ad.isdigit():
|
||||
logger.fdebug("Alternate decimal issue...*Whew* glad I caught that")
|
||||
#logger.fdebug("Alternate decimal issue...*Whew* glad I caught that")
|
||||
ParseIssue = dec_b4 + "." + dec_ad
|
||||
else:
|
||||
#logger.fdebug("it's a decimal, but there's no digits before or after decimal")
|
||||
|
@ -301,7 +301,7 @@ def GCDdetails(comseries, resultURL, vari_loop, ComicID, TotalIssues, issvariati
|
|||
ParseIssue = re.sub("[^0-9]", " ", m[0])
|
||||
# ^^ removes everything but the digits from the remaining non-brackets
|
||||
|
||||
logger.fdebug("variant cover detected : " + str(ParseIssue))
|
||||
#logger.fdebug("variant cover detected : " + str(ParseIssue))
|
||||
variant="yes"
|
||||
altcount = 1
|
||||
isslen = ParseIssue.find(' ')
|
||||
|
@ -349,21 +349,22 @@ def GCDdetails(comseries, resultURL, vari_loop, ComicID, TotalIssues, issvariati
|
|||
datematch="false"
|
||||
|
||||
if not any(d.get('GCDIssue', None) == str(ParseIssue) for d in gcdchoice):
|
||||
logger.fdebug("preparing to add issue to db : " + str(ParseIssue))
|
||||
#logger.fdebug("preparing to add issue to db : " + str(ParseIssue))
|
||||
pass
|
||||
else:
|
||||
logger.fdebug("2 identical issue #'s have been found...determining if it's intentional")
|
||||
#get current issue & publication date.
|
||||
logger.fdebug("Issue #:" + str(ParseIssue))
|
||||
logger.fdebug("IssueDate: " + str(gcdinfo['ComicDate']))
|
||||
#logger.fdebug("2 identical issue #'s have been found...determining if it's intentional")
|
||||
#get current issue & publication date.
|
||||
#logger.fdebug("Issue #:" + str(ParseIssue))
|
||||
#logger.fdebug("IssueDate: " + str(gcdinfo['ComicDate']))
|
||||
#get conflicting issue from tuple
|
||||
for d in gcdchoice:
|
||||
if str(d['GCDIssue']) == str(ParseIssue):
|
||||
logger.fdebug("Issue # already in tuple - checking IssueDate:" + str(d['GCDDate']) )
|
||||
#logger.fdebug("Issue # already in tuple - checking IssueDate:" + str(d['GCDDate']) )
|
||||
if str(d['GCDDate']) == str(gcdinfo['ComicDate']):
|
||||
logger.fdebug("Issue #'s and dates match...skipping.")
|
||||
#logger.fdebug("Issue #'s and dates match...skipping.")
|
||||
datematch="true"
|
||||
else:
|
||||
logger.fdebug("Issue#'s match but different publication dates, not skipping.")
|
||||
#logger.fdebug("Issue#'s match but different publication dates, not skipping.")
|
||||
datematch="false"
|
||||
|
||||
if datematch == "false":
|
||||
|
@ -430,8 +431,8 @@ def GettheDate(parsed,PrevYRMO):
|
|||
basmonths = {'january':'01','february':'02','march':'03','april':'04','may':'05','june':'06','july':'07','august':'08','september':'09','october':'10','november':'11','december':'12'}
|
||||
pdlen = len(ParseDate)
|
||||
pdfind = ParseDate.find(' ',2)
|
||||
logger.fdebug("length: " + str(pdlen) + "....first space @ pos " + str(pdfind))
|
||||
logger.fdebug("this should be the year: " + str(ParseDate[pdfind+1:pdlen-1]))
|
||||
#logger.fdebug("length: " + str(pdlen) + "....first space @ pos " + str(pdfind))
|
||||
#logger.fdebug("this should be the year: " + str(ParseDate[pdfind+1:pdlen-1]))
|
||||
if ParseDate[pdfind+1:pdlen-1].isdigit():
|
||||
#assume valid date.
|
||||
#search for number as text, and change to numeric
|
||||
|
@ -440,7 +441,7 @@ def GettheDate(parsed,PrevYRMO):
|
|||
pconv = basmonths[numbs]
|
||||
ParseYear = re.sub('/s','',ParseDate[-5:])
|
||||
ParseDate = str(ParseYear) + "-" + str(pconv)
|
||||
logger.fdebug("!success - Publication date: " + str(ParseDate))
|
||||
#logger.fdebug("!success - Publication date: " + str(ParseDate))
|
||||
break
|
||||
# some comics are messed with pub.dates and have Spring/Summer/Fall/Winter
|
||||
else:
|
||||
|
@ -475,7 +476,7 @@ def GettheDate(parsed,PrevYRMO):
|
|||
if int(PrevMO) < 10:
|
||||
PrevMO = "0" + str(PrevMO)
|
||||
ParseDate = str(PrevYR) + "-" + str(PrevMO)
|
||||
logger.fdebug("parseDAte:" + str(ParseDate))
|
||||
#logger.fdebug("parseDAte:" + str(ParseDate))
|
||||
return ParseDate
|
||||
|
||||
def GCDAdd(gcdcomicid):
|
||||
|
|
|
@ -90,16 +90,18 @@ def upcoming_update(ComicID, ComicName, IssueNumber, IssueDate):
|
|||
if issuechk is None:
|
||||
logger.fdebug(str(ComicName) + " Issue: " + str(IssueNumber) + " not present in listings to mark for download...updating comic and adding to Upcoming Wanted Releases.")
|
||||
# we need to either decrease the total issue count, OR indicate that an issue is upcoming.
|
||||
upco_iss = myDB.action("SELECT COUNT(*) FROM UPCOMING WHERE ComicID=?",[ComicID]).fetchone()
|
||||
if upco_iss > 0:
|
||||
print ("There is " + str(upco_iss[0]) + " of " + str(ComicName) + " that's not accounted for")
|
||||
upco_results = myDB.action("SELECT COUNT(*) FROM UPCOMING WHERE ComicID=?",[ComicID]).fetchall()
|
||||
upco_iss = upco_results[0][0]
|
||||
#logger.info("upco_iss: " + str(upco_iss))
|
||||
if int(upco_iss) > 0:
|
||||
#logger.info("There is " + str(upco_iss) + " of " + str(ComicName) + " that's not accounted for")
|
||||
newKey = {"ComicID": ComicID}
|
||||
newVal = {"not_updated_db": str(upco_iss[0])}
|
||||
newVal = {"not_updated_db": str(upco_iss)}
|
||||
myDB.upsert("comics", newVal, newKey)
|
||||
elif upco_iss <=0 and lastupdatecheck['not_updated_db']:
|
||||
elif int(upco_iss) <=0 and lastupdatechk['not_updated_db']:
|
||||
#if not_updated_db has a value, and upco_iss is > 0, let's zero it back out cause it's updated now.
|
||||
newKey = {"ComicID": ComicID}
|
||||
newVal - {"not_updated_db": null}
|
||||
newVal = {"not_updated_db": ""}
|
||||
myDB.upsert("comics", newVal, newKey)
|
||||
|
||||
if hours > 5:
|
||||
|
|
|
@ -28,7 +28,6 @@ import time
|
|||
import threading
|
||||
import csv
|
||||
import platform
|
||||
import Queue
|
||||
import urllib
|
||||
import shutil
|
||||
|
||||
|
@ -45,7 +44,7 @@ def serve_template(templatename, **kwargs):
|
|||
|
||||
interface_dir = os.path.join(str(mylar.PROG_DIR), 'data/interfaces/')
|
||||
template_dir = os.path.join(str(interface_dir), mylar.INTERFACE)
|
||||
|
||||
|
||||
_hplookup = TemplateLookup(directories=[template_dir])
|
||||
|
||||
try:
|
||||
|
@ -86,10 +85,6 @@ class WebInterface(object):
|
|||
sconv = baseissues[seas]
|
||||
isCounts[sconv]+=1
|
||||
continue
|
||||
print ("skipped: " + str(isCounts[1]))
|
||||
print ("wanted: " + str(isCounts[2]))
|
||||
print ("archived: " + str(isCounts[3]))
|
||||
print ("downloaded: " + str(isCounts[4]))
|
||||
isCounts = {
|
||||
"Skipped" : str(isCounts[1]),
|
||||
"Wanted" : str(isCounts[2]),
|
||||
|
@ -109,8 +104,9 @@ class WebInterface(object):
|
|||
return serve_template(templatename="artistredone.html", title=comic['ComicName'], comic=comic, issues=issues, comicConfig=comicConfig, isCounts=isCounts)
|
||||
artistPage.exposed = True
|
||||
|
||||
def searchit(self, name, issue=None, mode=None):
|
||||
type = 'comic' # let's default this to comic search only for the time being (will add story arc, characters, etc later)
|
||||
def searchit(self, name, issue=None, mode=None, type=None):
|
||||
if type is None: type = 'comic' # let's default this to comic search only for the time being (will add story arc, characters, etc later)
|
||||
else: print (str(type) + " mode enabled.")
|
||||
#mode dictates type of search:
|
||||
# --series ... search for comicname displaying all results
|
||||
# --pullseries ... search for comicname displaying a limited # of results based on issue
|
||||
|
@ -124,6 +120,8 @@ class WebInterface(object):
|
|||
searchresults = mb.findComic(name, mode, issue=None)
|
||||
elif type == 'comic' and mode == 'want':
|
||||
searchresults = mb.findComic(name, mode, issue)
|
||||
elif type == 'storyarc':
|
||||
searchresults = mb.findComic(name, mode, issue=None, storyarc='yes')
|
||||
|
||||
searchresults = sorted(searchresults, key=itemgetter('comicyear','issues'), reverse=True)
|
||||
#print ("Results: " + str(searchresults))
|
||||
|
@ -554,10 +552,9 @@ class WebInterface(object):
|
|||
skipped2wanted.exposed = True
|
||||
|
||||
def manualRename(self, comicid):
|
||||
print ("entering.")
|
||||
if mylar.FILE_FORMAT == '':
|
||||
print ("You haven't specified a File Format in Configuration/Advanced")
|
||||
print ("Cannot rename files.")
|
||||
logger.error("You haven't specified a File Format in Configuration/Advanced")
|
||||
logger.error("Cannot rename files.")
|
||||
return
|
||||
|
||||
myDB = db.DBConnection()
|
||||
|
@ -565,27 +562,32 @@ class WebInterface(object):
|
|||
comicdir = comic['ComicLocation']
|
||||
comicname = comic['ComicName']
|
||||
extensions = ('.cbr', '.cbz')
|
||||
issues = myDB.action("SELECT * FROM issues WHERE ComicID=?", [comicid])
|
||||
issues = myDB.action("SELECT * FROM issues WHERE ComicID=?", [comicid]).fetchall()
|
||||
comfiles = []
|
||||
filefind = 0
|
||||
for root, dirnames, filenames in os.walk(comicdir):
|
||||
for filename in filenames:
|
||||
if filename.lower().endswith(extensions):
|
||||
print ("filename being checked is : " + str(filename))
|
||||
#logger.info("filename being checked is : " + str(filename))
|
||||
for issue in issues:
|
||||
if issue['Location'] == filename:
|
||||
print ("matched " + str(filename) + " to DB file " + str(issue['Location']))
|
||||
#logger.error("matched " + str(filename) + " to DB file " + str(issue['Location']))
|
||||
renameiss = helpers.rename_param(comicid, comicname, issue['Issue_Number'], filename, comicyear=None, issueid=None)
|
||||
nfilename = renameiss['nfilename']
|
||||
srciss = os.path.join(comicdir,filename)
|
||||
dstiss = os.path.join(comicdir,nfilename)
|
||||
logger.info("Renaming " + str(filename) + " ... to " + str(nfilename))
|
||||
try:
|
||||
shutil.move(srciss, dstiss)
|
||||
except (OSError, IOError):
|
||||
logger.error("Failed to move files - check directories and manually re-run.")
|
||||
continue
|
||||
|
||||
print ("hello")
|
||||
if filename != nfilename:
|
||||
logger.info("Renaming " + str(filename) + " ... to ... " + str(nfilename))
|
||||
try:
|
||||
shutil.move(srciss, dstiss)
|
||||
except (OSError, IOError):
|
||||
logger.error("Failed to move files - check directories and manually re-run.")
|
||||
return
|
||||
filefind+=1
|
||||
else:
|
||||
logger.info("Not renaming " + str(filename) + " as it is in desired format already.")
|
||||
#continue
|
||||
logger.info("I have renamed " + str(filefind) + " issues of " + str(comicname))
|
||||
manualRename.exposed = True
|
||||
|
||||
def searchScan(self, name):
|
||||
|
@ -1105,7 +1107,6 @@ class WebInterface(object):
|
|||
|
||||
error_change.exposed = True
|
||||
|
||||
|
||||
def comic_config(self, com_location, ComicID, alt_search=None, fuzzy_year=None):
|
||||
myDB = db.DBConnection()
|
||||
#--- this is for multipe search terms............
|
||||
|
|
Loading…
Reference in New Issue