FIX:(#259) More checks in place to avoid errors on loading Main Home page, FIX:(#267) Previous/Next comic selection now working

This commit is contained in:
evilhero 2013-03-14 04:33:16 -04:00
parent 5f8e11740d
commit 31fc75fdd6
8 changed files with 106 additions and 20 deletions

View File

@ -903,6 +903,48 @@ div#artistheader h2 a {
font-weight: bold;
font-family: "Trebuchet MS", Helvetica, Arial, sans-serif;
}
#read_detail th#options {
min-width: 150px;
text-align: left;
}
#read_detail th#comicname {
min-width: 300px;
text-align: left;
}
#read_detail th#issue,
#read_detail th#status {
min-width: 30px;
text-align: center;
}
#read_detail th#issueyear {
min-width: 75px;
text-align: center;
}
#read_detail td#comicname {
min-width: 300px;
text-align: left;
vertical-align: middle;
font-size: 12px;
}
#read_detail td#status,
#read_detail td#issue {
min-width: 30px;
text-align: left;
vertical-align: middle;
}
#read_detail td#issueyear{
min-width: 75px;
text-align: left;
vertical-align: middle;
}
#read_detail td#options {
min-width: 150px;
text-align: left;
vertical-align: middle;
}
#weekly_pull th#publisher {
min-width: 150px;
text-align: left;

0
data/interfaces/default/images/cross.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -58,7 +58,7 @@
elif comic['Status'] == 'Loading':
grade = 'L'
elif comic['Status'] == 'Error':
grade = 'Z'
grade = 'X'
else:
grade = 'A'
@ -81,9 +81,9 @@
</td>
<td id="active" align="center">
%if comic['Status'] == "Active":
<img src="/images/checkmark.png" alt="Y" width="16" height="16" />
<img src="/interfaces/default/images/checkmark.png" alt="Y" width="16" height="16" />
%else:
<img src="/images/cross.png" alt="N" width="16" height="16" />
<img src="/interfaces/default/images/cross.png" alt="N" width="16" height="16" />
%endif
</td>
</tr>

View File

@ -729,6 +729,10 @@ def start():
SCHED.add_interval_job(updater.dbUpdate, hours=48)
SCHED.add_interval_job(search.searchforissue, minutes=SEARCH_INTERVAL)
#SCHED.add_interval_job(librarysync.libraryScan, minutes=LIBRARYSCAN_INTERVAL)
#Ordering comics here
logger.info("Remapping the sorting to allow for new additions.")
threading.Thread(target=helpers.ComicSort).start()
#weekly pull list gets messed up if it's not populated first, so let's populate it then set the scheduler.
logger.info("Checking for existance of Weekly Comic listing...")
@ -755,7 +759,7 @@ 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, AlternateSearch TEXT, UseFuzzy TEXT, ComicVersion TEXT)')
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, UseFuzzy TEXT, ComicVersion TEXT, SortOrder INTEGER)')
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)')
@ -805,6 +809,10 @@ def dbcheck():
except sqlite3.OperationalError:
c.execute('ALTER TABLE comics ADD COLUMN ComicVersion TEXT')
try:
c.execute('SELECT SortOrder from comics')
except sqlite3.OperationalError:
c.execute('ALTER TABLE comics ADD COLUMN SortOrder INTEGER')
try:
c.execute('SELECT ComicSize from issues')
@ -897,7 +905,6 @@ def dbcheck():
conn.commit()
c.close()
def csv_load():
# for redudant module calls..include this.
conn=sqlite3.connect(DB_FILE)

View File

@ -380,3 +380,24 @@ def apiremove(apistring, type):
apiremoved = value_regex.sub("xUDONTNEEDTOKNOWTHISx", apistring)
return apiremoved
def ComicSort(imported=None):
from mylar import db, logger
myDB = db.DBConnection()
comicsort = myDB.action("SELECT * FROM comics ORDER BY ComicSortName")
if imported != None:
#if it's an Add Series, set it to the last record for now so it doesn't throw a 500.
cid = {"ComicID": imported}
val = {"SortOrder": 999}
myDB.upsert("comics", val, cid)
logger.info("New Series...Set SortOrder to last record to avoid errors for now.")
else:
i = -1
for csort in comicsort:
cid = {"ComicID": csort['ComicID']}
val = {"SortOrder": i}
myDB.upsert("comics", val, cid)
i+=1
logger.info("Sucessfully ordered " + str(i) + " series in your watchlist.")
return

View File

@ -64,6 +64,9 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None):
myDB.upsert("comics", newValueDict, controlValueDict)
#run the re-sortorder here in order to properly display the page
helpers.ComicSort(comicid)
# we need to lookup the info for the requested ComicID in full now
comic = cv.getComic(comicid,'comic')
#comic = myDB.action('SELECT * FROM comics WHERE ComicID=?', [comicid]).fetchone()
@ -234,6 +237,10 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None):
myDB.upsert("comics", newValueDict, controlValueDict)
#re-run the re-sortorder here now that the ComicName has been written to the db.
helpers.ComicSort()
issued = cv.getComic(comicid,'issue')
logger.info(u"Sucessfully retrieved issue details for " + comic['ComicName'] )
n = 0
@ -317,7 +324,12 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None):
issaftdec = str(decisval)
gcd_issue = issb4dec + "." + issaftdec
#logger.fdebug("gcd_issue:" + str(gcd_issue))
gcdis = (int(issb4dec) * 1000) + decisval
try:
gcdis = (int(issb4dec) * 1000) + decisval
except ValueError:
logger.error("This has no issue #'s for me to get - Either a Graphic Novel or one-shot. This feature to allow these will be added in the near future.")
updater.no_searchresults(comicid)
return
else:
gcdis = int(str(gcdval['GCDIssue'])) * 1000
if gcdis == issis:

View File

@ -175,7 +175,8 @@ def no_searchresults(ComicID):
myDB = db.DBConnection()
controlValue = { "ComicID": ComicID}
newValue = {"Status": "Error",
"ComicName": "None"}
"LatestDate": "Error",
"LatestIssue": "Error"}
myDB.upsert("comics", newValue, controlValue)
def nzblog(IssueID, NZBName):

View File

@ -73,21 +73,24 @@ class WebInterface(object):
#let's cheat. :)
comicskip = myDB.select('SELECT * from comics order by ComicSortName COLLATE NOCASE')
series = {}
found = "no"
i=0
for cskip in comicskip:
if i == 0: first = cskip['ComicID']
current = cskip['ComicID']
if found == "yes":
series['Next'] = current
found == "no"
if cskip['ComicID'] == ComicID:
cursortnum = cskip['SortOrder']
series['Current'] = cskip['ComicID']
if cursortnum == 1 or cursortnum == 999:
# if first record, set the Previous record to the LAST record.
previous = myDB.action("SELECT ComicID from Comics order by SortOrder DESC LIMIT 1").fetchone()
else:
previous = myDB.action("SELECT ComicID from Comics WHERE SortOrder=?", [cursortnum-1]).fetchone()
next = myDB.action("SELECT ComicID from Comics WHERE SortOrder=?", [cursortnum+1]).fetchone()
if next is None:
# if last record, set the Next record to the FIRST record.
next = myDB.action("SELECT ComicID from Comics order by ComicSortName").fetchone()
series['Previous'] = previous[0]
series['Next'] = next[0]
break
if current == ComicID:
series['Current'] = current
series['Previous'] = previous
found = "yes"
previous = current
i+=1
issues = myDB.select('SELECT * FROM issues WHERE ComicID=? order by Int_IssueNumber DESC', [ComicID])
isCounts = {}