Fixed showing non-cbz files

This commit is contained in:
Frederik Baerentsen 2024-01-29 14:16:28 -05:00
parent c85185d975
commit 18e9575799
3 changed files with 10 additions and 6 deletions

View File

@ -275,11 +275,11 @@ def catalog(path=""):
#start_time = timeit.default_timer()
#print(request.root_url)
c = fromdir(request.root_url, request.url, config.CONTENT_BASE_DIR, path)
print("c: ")
#print("c: ")
#pprint(vars(c))
for x in c.entries:
for y in x.links:
pprint(y.href)
#for x in c.entries:
# for y in x.links:
# pprint(y.href)
#print("------")
#elapsed = timeit.default_timer() - start_time
#print("-----------------------------------------------------------------------------------------------------------------------")

View File

@ -86,8 +86,10 @@ def fromdir(root_url, url, content_base_path, content_relative_path):
onlydirs = [
f for f in os.listdir(path) if not os.path.isfile(os.path.join(path, f))
]
#print(onlydirs)
onlydirs.sort()
print(onlydirs)
for dirname in onlydirs:
print(dirname)
link = Link(
href=quote(f"/catalog/{content_relative_path}/{dirname}").replace('//','/'), #windows fix
rel="subsection",
@ -113,6 +115,8 @@ def fromdir(root_url, url, content_base_path, content_relative_path):
onlyfiles = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
onlyfiles.sort()
for filename in onlyfiles:
if not filename.endswith('cbz'):
continue
link = Link(
href=quote(f"/content/{content_relative_path}/{filename}"),
rel="http://opds-spec.org/acquisition",

View File

@ -62,7 +62,7 @@ class Entry(object):
if os.path.exists(f):
s = zipfile.ZipFile(f)
self.size = extras.get_size(f, 'mb')
data=BeautifulSoup(s.open('ComicInfo.xml').read(), features="lxml")
data=BeautifulSoup(s.open('ComicInfo.xml').read(), features="xml")
#self.cover=s.open('P00001.jpg').read()
if data.select('Writer') != []: