Fixed showing non-cbz files
This commit is contained in:
parent
c85185d975
commit
18e9575799
8
main.py
8
main.py
@ -275,11 +275,11 @@ def catalog(path=""):
|
|||||||
#start_time = timeit.default_timer()
|
#start_time = timeit.default_timer()
|
||||||
#print(request.root_url)
|
#print(request.root_url)
|
||||||
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("-----------------------------------------------------------------------------------------------------------------------")
|
||||||
|
@ -86,8 +86,10 @@ def fromdir(root_url, url, content_base_path, content_relative_path):
|
|||||||
onlydirs = [
|
onlydirs = [
|
||||||
f for f in os.listdir(path) if not os.path.isfile(os.path.join(path, f))
|
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:
|
for dirname in onlydirs:
|
||||||
|
print(dirname)
|
||||||
link = Link(
|
link = Link(
|
||||||
href=quote(f"/catalog/{content_relative_path}/{dirname}").replace('//','/'), #windows fix
|
href=quote(f"/catalog/{content_relative_path}/{dirname}").replace('//','/'), #windows fix
|
||||||
rel="subsection",
|
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 = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
|
||||||
onlyfiles.sort()
|
onlyfiles.sort()
|
||||||
for filename in onlyfiles:
|
for filename in onlyfiles:
|
||||||
|
if not filename.endswith('cbz'):
|
||||||
|
continue
|
||||||
link = Link(
|
link = Link(
|
||||||
href=quote(f"/content/{content_relative_path}/{filename}"),
|
href=quote(f"/content/{content_relative_path}/{filename}"),
|
||||||
rel="http://opds-spec.org/acquisition",
|
rel="http://opds-spec.org/acquisition",
|
||||||
|
@ -62,7 +62,7 @@ class Entry(object):
|
|||||||
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(), features="lxml")
|
data=BeautifulSoup(s.open('ComicInfo.xml').read(), features="xml")
|
||||||
#self.cover=s.open('P00001.jpg').read()
|
#self.cover=s.open('P00001.jpg').read()
|
||||||
|
|
||||||
if data.select('Writer') != []:
|
if data.select('Writer') != []:
|
||||||
|
Loading…
Reference in New Issue
Block a user