Trying to fix issues with summary and Ampersand in title

This commit is contained in:
FrederikBaerentsen 2023-05-17 20:29:52 +02:00
parent c9dc8307b7
commit 8c69a958de
3 changed files with 40 additions and 38 deletions

10
main.py
View File

@ -245,7 +245,7 @@ def import2sql():
@app.route("/content/<path:path>") @app.route("/content/<path:path>")
@auth.login_required @auth.login_required
def send_content(path): def send_content(path):
print('content') #print('content')
return send_from_directory(config.CONTENT_BASE_DIR, path) return send_from_directory(config.CONTENT_BASE_DIR, path)
@app.route("/image/<path:path>") @app.route("/image/<path:path>")
@ -267,10 +267,10 @@ def catalog(path=""):
c = fromdir(request.root_url, request.url, config.CONTENT_BASE_DIR, path) c = fromdir(request.root_url, request.url, config.CONTENT_BASE_DIR, path)
#print("c: ") #print("c: ")
#pprint(vars(c)) #pprint(vars(c))
for x in c.entries: #for x in c.entries:
for y in x.links: # for y in x.links:
pprint(y.href) # pprint(y.href)
print("------") #print("------")
elapsed = timeit.default_timer() - start_time elapsed = timeit.default_timer() - start_time
print("-----------------------------------------------------------------------------------------------------------------------") print("-----------------------------------------------------------------------------------------------------------------------")
print("RENDERED IN: " + str(round(elapsed,2))+"s") print("RENDERED IN: " + str(round(elapsed,2))+"s")

View File

@ -55,12 +55,12 @@ class Entry(object):
#print(kwargs) #print(kwargs)
#print(kwargs["links"][0].get("rpath")) #print(kwargs["links"][0].get("rpath"))
#print("--end entry.py") #print("--end entry.py")
try:
if kwargs["links"][0].get("type") == 'application/x-cbz': if kwargs["links"][0].get("type") == 'application/x-cbz':
f=self.links[0].get("rpath")+"/"+self.title+".cbz" f=self.links[0].get("rpath")+"/"+self.title+".cbz"
if os.path.exists(f): if os.path.exists(f):
s = zipfile.ZipFile(f) s = zipfile.ZipFile(f)
self.size = extras.get_size(f, 'mb') #self.size = extras.get_size(f, 'mb')
data=BeautifulSoup(s.open('ComicInfo.xml').read(), "xml") data=BeautifulSoup(s.open('ComicInfo.xml').read(), "xml")
#self.cover=s.open('P00001.jpg').read() #self.cover=s.open('P00001.jpg').read()
@ -69,7 +69,7 @@ class Entry(object):
else: else:
config._print("No Writer found: " + str(data.select('Writer'))) config._print("No Writer found: " + str(data.select('Writer')))
self.cover = "/image/" + extras.get_cvdb(data.select('Notes')) + ".jpg" #self.cover = "/image/" + extras.get_cvdb(data.select('Notes')) + ".jpg"
if data.select('Summary') != []: if data.select('Summary') != []:
self.summary = data.select('Summary')[0].text self.summary = data.select('Summary')[0].text
@ -94,6 +94,8 @@ class Entry(object):
else: else:
self.title = kwargs["title"] self.title = kwargs["title"]
#self.title = data.select('Title')[0].text #self.title = data.select('Title')[0].text
except Exception as e:
config._print(e)
def get(self, key): def get(self, key):
return self._data.get(key, None) return self._data.get(key, None)

View File

@ -27,7 +27,7 @@
<entry> <entry>
<title>{{ entry.title }}</title> <title>{{ entry.title }}</title>
<id>{{ entry.id }}</id> <id>{{ entry.id }}</id>
<summary type="text">{{ entry.summary }}</summary> m!-- <summary type="text">{{ entry.summary }}</summary> -->
{% for author in entry.authors %} {% for author in entry.authors %}
<author> <author>
<name>{{ author }}</name> <name>{{ author }}</name>