mirror of
https://github.com/evilhero/mylar
synced 2025-02-22 22:10:30 +00:00
Further Fixes to OPDS - Story Arcs and Unicode fixes
This commit is contained in:
parent
5ff4c200d8
commit
74a7c07dcb
1 changed files with 54 additions and 54 deletions
|
@ -96,14 +96,6 @@ class OPDS(object):
|
||||||
cherrypy.response.headers['Content-Type'] = "text/xml"
|
cherrypy.response.headers['Content-Type'] = "text/xml"
|
||||||
return error
|
return error
|
||||||
|
|
||||||
def _uni(self, instr):
|
|
||||||
outstr = ""
|
|
||||||
try:
|
|
||||||
outstr = unicode(instr, "utf-8")
|
|
||||||
except UnicodeError:
|
|
||||||
return instr
|
|
||||||
return outstr
|
|
||||||
|
|
||||||
def _dic_from_query(self, query):
|
def _dic_from_query(self, query):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
rows = myDB.select(query)
|
rows = myDB.select(query)
|
||||||
|
@ -388,7 +380,7 @@ class OPDS(object):
|
||||||
'id': escape('comic:%s - %s' % (issue['ComicName'], issue['Issue_Number'])),
|
'id': escape('comic:%s - %s' % (issue['ComicName'], issue['Issue_Number'])),
|
||||||
'updated': updated,
|
'updated': updated,
|
||||||
'content': escape('%s' % (metainfo[0]['summary'])),
|
'content': escape('%s' % (metainfo[0]['summary'])),
|
||||||
'href': '%s?cmd=Issue&issueid=%s&file=%s' % (self.opdsroot, quote_plus(issue['IssueID']),quote_plus(self._uni(issue['Location']))),
|
'href': '%s?cmd=Issue&issueid=%s&file=%s' % (self.opdsroot, quote_plus(issue['IssueID']),quote_plus(issue['Location'].encode('utf-8'))),
|
||||||
'kind': 'acquisition',
|
'kind': 'acquisition',
|
||||||
'rel': 'file',
|
'rel': 'file',
|
||||||
'author': metainfo[0]['writer'],
|
'author': metainfo[0]['writer'],
|
||||||
|
@ -443,7 +435,7 @@ class OPDS(object):
|
||||||
else:
|
else:
|
||||||
title = escape('%03d: %s Annual %s - %s' % (index + number, issuebook['ComicName'], issuebook['Issue_Number'], issuebook['IssueName']))
|
title = escape('%03d: %s Annual %s - %s' % (index + number, issuebook['ComicName'], issuebook['Issue_Number'], issuebook['IssueName']))
|
||||||
# logger.info("%s - %s" % (comic['ComicLocation'], issuebook['Location']))
|
# logger.info("%s - %s" % (comic['ComicLocation'], issuebook['Location']))
|
||||||
location = self._uni(issuebook['Location'])
|
location = issuebook['Location'].encode('utf-8')
|
||||||
number +=1
|
number +=1
|
||||||
if not issuebook['Location']:
|
if not issuebook['Location']:
|
||||||
continue
|
continue
|
||||||
|
@ -580,7 +572,7 @@ class OPDS(object):
|
||||||
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'])
|
||||||
issue['filename'] = self._uni(bookentry['Location'])
|
issue['filename'] = bookentry['Location'].encode('utf-8')
|
||||||
issue['image'] = bookentry['ImageURL_ALT']
|
issue['image'] = bookentry['ImageURL_ALT']
|
||||||
issue['thumbnail'] = bookentry['ImageURL']
|
issue['thumbnail'] = bookentry['ImageURL']
|
||||||
if bookentry['DateAdded']:
|
if bookentry['DateAdded']:
|
||||||
|
@ -593,7 +585,7 @@ class OPDS(object):
|
||||||
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'])
|
||||||
issue['filename'] = self._uni(annualentry['Location'])
|
issue['filename'] = annualentry['Location'].encode('utf-8')
|
||||||
issue['image'] = None
|
issue['image'] = None
|
||||||
issue['thumbnail'] = None
|
issue['thumbnail'] = None
|
||||||
issue['updated'] = annualentry['IssueDate']
|
issue['updated'] = annualentry['IssueDate']
|
||||||
|
@ -665,13 +657,21 @@ class OPDS(object):
|
||||||
issue['Title'] = '%s #%s' % (book['ComicName'],book['IssueNumber'])
|
issue['Title'] = '%s #%s' % (book['ComicName'],book['IssueNumber'])
|
||||||
issue['IssueID'] = book['IssueID']
|
issue['IssueID'] = book['IssueID']
|
||||||
issue['fileloc'] = ''
|
issue['fileloc'] = ''
|
||||||
|
if book['Location']:
|
||||||
|
issue['fileloc'] = book['Location']
|
||||||
|
fileexists = True
|
||||||
|
issue['filename'] = os.path.split(book['Location'])[1].encode('utf-8')
|
||||||
|
issue['image'] = None
|
||||||
|
issue['thumbnail'] = None
|
||||||
|
issue['updated'] = book['IssueDate']
|
||||||
|
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 and len(bookentry) > 0:
|
||||||
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
|
||||||
issue['fileloc'] = os.path.join(comic['ComicLocation'], bookentry['Location'])
|
issue['fileloc'] = os.path.join(comic['ComicLocation'], bookentry['Location'])
|
||||||
issue['filename'] = self._uni(bookentry['Location'])
|
issue['filename'] = bookentry['Location'].encode('utf-8')
|
||||||
issue['image'] = bookentry['ImageURL_ALT']
|
issue['image'] = bookentry['ImageURL_ALT']
|
||||||
issue['thumbnail'] = bookentry['ImageURL']
|
issue['thumbnail'] = bookentry['ImageURL']
|
||||||
if bookentry['DateAdded']:
|
if bookentry['DateAdded']:
|
||||||
|
@ -685,7 +685,7 @@ class OPDS(object):
|
||||||
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'])
|
||||||
issue['filename'] = self._uni(annualentry['Location'])
|
issue['filename'] = annualentry['Location'].encode('utf-8')
|
||||||
issue['image'] = None
|
issue['image'] = None
|
||||||
issue['thumbnail'] = None
|
issue['thumbnail'] = None
|
||||||
issue['updated'] = annualentry['IssueDate']
|
issue['updated'] = annualentry['IssueDate']
|
||||||
|
@ -693,7 +693,7 @@ class OPDS(object):
|
||||||
if book['Location']:
|
if book['Location']:
|
||||||
fileexists = True
|
fileexists = True
|
||||||
issue['fileloc'] = book['Location']
|
issue['fileloc'] = book['Location']
|
||||||
issue['filename'] = self._uni(os.path.split(book['Location'])[1])
|
issue['filename'] = os.path.split(book['Location'])[1].encode('utf-8')
|
||||||
issue['image'] = None
|
issue['image'] = None
|
||||||
issue['thumbnail'] = None
|
issue['thumbnail'] = None
|
||||||
issue['updated'] = book['IssueDate']
|
issue['updated'] = book['IssueDate']
|
||||||
|
|
Loading…
Reference in a new issue