Story Arc Fix for OPDS

This commit is contained in:
DarkSir23 2017-12-07 14:02:57 -05:00 committed by evilhero
parent c7aa240f5b
commit 994113dd5a
1 changed files with 11 additions and 11 deletions

View File

@ -338,7 +338,7 @@ class OPDS(object):
links = [] links = []
entries=[] entries=[]
comic = myDB.selectone('SELECT * from comics where ComicID=?', (kwargs['comicid'],)).fetchone() comic = myDB.selectone('SELECT * from comics where ComicID=?', (kwargs['comicid'],)).fetchone()
if len(comic) == 0: if not comic:
self.data = self._error_with_message('Comic Not Found') self.data = self._error_with_message('Comic Not Found')
return return
issues = self._dic_from_query('SELECT * from issues WHERE ComicID="' + kwargs['comicid'] + '"order by Int_IssueNumber DESC') issues = self._dic_from_query('SELECT * from issues WHERE ComicID="' + kwargs['comicid'] + '"order by Int_IssueNumber DESC')
@ -422,7 +422,7 @@ class OPDS(object):
subset = recents[index:(index+self.PAGE_SIZE)] subset = recents[index:(index+self.PAGE_SIZE)]
for issue in subset: for issue in subset:
issuebook = myDB.fetch('SELECT * from issues WHERE IssueID = ?', (issue['IssueID'],)).fetchone() issuebook = myDB.fetch('SELECT * from issues WHERE IssueID = ?', (issue['IssueID'],)).fetchone()
if not issuebook or len(issuebook) == 0: if not issuebook:
issuebook = myDB.fetch('SELECT * from annuals WHERE IssueID = ?', (issue['IssueID'])).fetchone() issuebook = myDB.fetch('SELECT * from annuals WHERE IssueID = ?', (issue['IssueID'])).fetchone()
comic = myDB.fetch('SELECT * from comics WHERE ComicID = ?', (issue['ComicID'],)).fetchone() comic = myDB.fetch('SELECT * from comics WHERE ComicID = ?', (issue['ComicID'],)).fetchone()
updated = issue['DateAdded'] updated = issue['DateAdded']
@ -486,17 +486,17 @@ class OPDS(object):
myDB = db.DBConnection() myDB = db.DBConnection()
issue = myDB.selectone("SELECT * from issues WHERE IssueID=?", (kwargs['issueid'],)).fetchone() issue = myDB.selectone("SELECT * from issues WHERE IssueID=?", (kwargs['issueid'],)).fetchone()
issuetype = 0 issuetype = 0
if len(issue) == 0: if not issue:
issue = myDB.selectone("SELECT * from annuals WHERE IssueID=?", (kwargs['issueid'],)).fetchone() issue = myDB.selectone("SELECT * from annuals WHERE IssueID=?", (kwargs['issueid'],)).fetchone()
if len(issue) == 0: if not issue:
issue = myDB.selectone("SELECT * from readinglist WHERE IssueID=? and Location IS NOT NULL", (kwargs['issueid'],)).fetchone() issue = myDB.selectone("SELECT * from readinglist WHERE IssueID=? and Location IS NOT NULL", (kwargs['issueid'],)).fetchone()
if len(issue) == 0: if not issue:
self.data = self._error_with_message('Issue Not Found') self.data = self._error_with_message('Issue Not Found')
return return
else: else:
issuetype = 1 issuetype = 1
comic = myDB.selectone("SELECT * from comics WHERE ComicID=?", (issue['ComicID'],)).fetchone() comic = myDB.selectone("SELECT * from comics WHERE ComicID=?", (issue['ComicID'],)).fetchone()
if len(comic) ==0: if not comic:
self.data = self._error_with_message('Comic Not Found') self.data = self._error_with_message('Comic Not Found')
return return
if issuetype: if issuetype:
@ -577,7 +577,7 @@ class OPDS(object):
issue['IssueID'] = book['IssueID'] issue['IssueID'] = book['IssueID']
comic = myDB.selectone("SELECT * from comics WHERE ComicID=?", (book['ComicID'],)).fetchone() comic = myDB.selectone("SELECT * from comics WHERE ComicID=?", (book['ComicID'],)).fetchone()
bookentry = myDB.selectone("SELECT * from issues WHERE IssueID=?", (book['IssueID'],)).fetchone() bookentry = myDB.selectone("SELECT * from issues WHERE IssueID=?", (book['IssueID'],)).fetchone()
if bookentry and len(bookentry) > 0: if bookentry:
if bookentry['Location']: if bookentry['Location']:
fileexists = True fileexists = True
issue['fileloc'] = os.path.join(comic['ComicLocation'], bookentry['Location']) issue['fileloc'] = os.path.join(comic['ComicLocation'], bookentry['Location'])
@ -590,7 +590,7 @@ class OPDS(object):
issue['updated'] = bookentry['IssueDate'] issue['updated'] = bookentry['IssueDate']
else: else:
annualentry = myDB.selectone("SELECT * from annuals WHERE IssueID=?", (book['IssueID'],)).fetchone() annualentry = myDB.selectone("SELECT * from annuals WHERE IssueID=?", (book['IssueID'],)).fetchone()
if annualentry and len(annualentry) > 0: if annualentry:
if annualentry['Location']: if annualentry['Location']:
fileexists = True fileexists = True
issue['fileloc'] = os.path.join(comic['ComicLocation'], annualentry['Location']) issue['fileloc'] = os.path.join(comic['ComicLocation'], annualentry['Location'])
@ -675,7 +675,7 @@ class OPDS(object):
issue['updated'] = book['IssueDate'] issue['updated'] = book['IssueDate']
else: else:
bookentry = myDB.selectone("SELECT * from issues WHERE IssueID=?", (book['IssueID'],)).fetchone() bookentry = myDB.selectone("SELECT * from issues WHERE IssueID=?", (book['IssueID'],)).fetchone()
if bookentry and len(bookentry) > 0: if bookentry:
if bookentry['Location']: if bookentry['Location']:
comic = myDB.selectone("SELECT * from comics WHERE ComicID=?", ( bookentry['ComicID'],)).fetchone() comic = myDB.selectone("SELECT * from comics WHERE ComicID=?", ( bookentry['ComicID'],)).fetchone()
fileexists = True fileexists = True
@ -689,8 +689,8 @@ class OPDS(object):
issue['updated'] = bookentry['IssueDate'] issue['updated'] = bookentry['IssueDate']
else: else:
annualentry = myDB.selectone("SELECT * from annuals WHERE IssueID=?", (book['IssueID'],)).fetchone() annualentry = myDB.selectone("SELECT * from annuals WHERE IssueID=?", (book['IssueID'],)).fetchone()
if annualentry and len(annualentry) > 0: if annualentry:
if annualentry['Location']: if annualentry['Location']:
comic = myDB.selectone("SELECT * from comics WHERE ComicID=?", ( annualentry['ComicID'],)) comic = myDB.selectone("SELECT * from comics WHERE ComicID=?", ( annualentry['ComicID'],))
fileexists = True fileexists = True
issue['fileloc'] = os.path.join(comic['ComicLocation'], annualentry['Location']) issue['fileloc'] = os.path.join(comic['ComicLocation'], annualentry['Location'])