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>")
@auth.login_required
def send_content(path):
print('content')
#print('content')
return send_from_directory(config.CONTENT_BASE_DIR, 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)
#print("c: ")
#pprint(vars(c))
for x in c.entries:
for y in x.links:
pprint(y.href)
print("------")
#for x in c.entries:
# for y in x.links:
# pprint(y.href)
#print("------")
elapsed = timeit.default_timer() - start_time
print("-----------------------------------------------------------------------------------------------------------------------")
print("RENDERED IN: " + str(round(elapsed,2))+"s")

View File

@ -55,45 +55,47 @@ class Entry(object):
#print(kwargs)
#print(kwargs["links"][0].get("rpath"))
#print("--end entry.py")
try:
if kwargs["links"][0].get("type") == 'application/x-cbz':
f=self.links[0].get("rpath")+"/"+self.title+".cbz"
if os.path.exists(f):
s = zipfile.ZipFile(f)
#self.size = extras.get_size(f, 'mb')
data=BeautifulSoup(s.open('ComicInfo.xml').read(), "xml")
#self.cover=s.open('P00001.jpg').read()
if kwargs["links"][0].get("type") == 'application/x-cbz':
f=self.links[0].get("rpath")+"/"+self.title+".cbz"
if os.path.exists(f):
s = zipfile.ZipFile(f)
self.size = extras.get_size(f, 'mb')
data=BeautifulSoup(s.open('ComicInfo.xml').read(), "xml")
#self.cover=s.open('P00001.jpg').read()
if data.select('Writer') != []:
self.authors = data.select('Writer')[0].text.split(",")
else:
config._print("No Writer found: " + str(data.select('Writer')))
if data.select('Writer') != []:
self.authors = data.select('Writer')[0].text.split(",")
else:
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') != []:
self.summary = data.select('Summary')[0].text
else:
config._print("No Summary found: " + str(data.select('Summary')))
if data.select('Summary') != []:
self.summary = data.select('Summary')[0].text
else:
config._print("No Summary found: " + str(data.select('Summary')))
#print(data)
#print(kwargs["links"][0])
#print(data.select('Series')[0].text)
#print(kwargs["links"][0].get("rpath"))
if data.select('Series')[0].text in kwargs["links"][0].get("rpath"):
releasedate=data.select('Year')[0].text+"-"+data.select('Month')[0].text.zfill(2)+"-"+data.select('Day')[0].text.zfill(2)
try:
self.title = "#"+data.select('Number')[0].text.zfill(2) + ": " + data.select('Title')[0].text + " (" + releasedate + ") [" + str(self.size) + "MB]"
except:
self.title = "#"+data.select('Number')[0].text.zfill(2) + " (" + releasedate + ") [" + str(self.size) + "MB]"
#print(self.title)
#print(data)
#print(kwargs["links"][0])
#print(data.select('Series')[0].text)
#print(kwargs["links"][0].get("rpath"))
if data.select('Series')[0].text in kwargs["links"][0].get("rpath"):
releasedate=data.select('Year')[0].text+"-"+data.select('Month')[0].text.zfill(2)+"-"+data.select('Day')[0].text.zfill(2)
try:
self.title = "#"+data.select('Number')[0].text.zfill(2) + ": " + data.select('Title')[0].text + " (" + releasedate + ") [" + str(self.size) + "MB]"
except:
self.title = "#"+data.select('Number')[0].text.zfill(2) + " (" + releasedate + ") [" + str(self.size) + "MB]"
#print(self.title)
else:
self.title = kwargs["title"]
else:
self.title = kwargs["title"]
else:
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):
return self._data.get(key, None)

View File

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