Added 'smart list' using array
This commit is contained in:
parent
a25dff10ec
commit
7700601288
@ -48,6 +48,7 @@ def fromsearch(root_url, url, content_base_path, content_relative_path):
|
|||||||
|
|
||||||
def fromdir(root_url, url, content_base_path, content_relative_path):
|
def fromdir(root_url, url, content_base_path, content_relative_path):
|
||||||
|
|
||||||
|
searchArr=["Girl","Bat","Part One"]
|
||||||
path = os.path.join(content_base_path, content_relative_path)
|
path = os.path.join(content_base_path, content_relative_path)
|
||||||
#print(path)
|
#print(path)
|
||||||
c = Catalog(
|
c = Catalog(
|
||||||
@ -70,13 +71,16 @@ def fromdir(root_url, url, content_base_path, content_relative_path):
|
|||||||
|
|
||||||
|
|
||||||
if c.url.endswith("/catalog"):
|
if c.url.endswith("/catalog"):
|
||||||
link2 = Link(
|
|
||||||
href=quote(f"/catalog/search"),
|
for i in searchArr:
|
||||||
rel="subsection",
|
|
||||||
rpath=path,
|
link2 = Link(
|
||||||
type="application/atom+xml;profile=opds-catalog;kind=acquisition",
|
href=quote(f"/catalog/search["+i+"]"),
|
||||||
)
|
rel="subsection",
|
||||||
c.add_entry(Entry(title="Search",id=uuid4(),links=[link2]))
|
rpath=path,
|
||||||
|
type="application/atom+xml;profile=opds-catalog;kind=acquisition",
|
||||||
|
)
|
||||||
|
c.add_entry(Entry(title="Search["+i+"]",id=uuid4(),links=[link2]))
|
||||||
|
|
||||||
if not "search" in c.url:
|
if not "search" in c.url:
|
||||||
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))]
|
||||||
@ -92,30 +96,34 @@ def fromdir(root_url, url, content_base_path, content_relative_path):
|
|||||||
#fixed issue with multiple . in filename
|
#fixed issue with multiple . in filename
|
||||||
#print(c.render())
|
#print(c.render())
|
||||||
else:
|
else:
|
||||||
search="Man"
|
print(searchArr)
|
||||||
conn = sqlite3.connect('app.db')
|
for i in searchArr:
|
||||||
sql="SELECT * from COMICS where SERIES like '%" + search+ "%' or Title like '%" + search+ "%';"
|
if quote(f""+i) in c.url:
|
||||||
|
print(i)
|
||||||
s = conn.execute(sql)
|
conn = sqlite3.connect('app.db')
|
||||||
list=[]
|
|
||||||
for r in s:
|
sql="SELECT * from COMICS where SERIES like '%" + i+ "%' or Title like '%" + i+ "%';"
|
||||||
#print(r)
|
print(sql)
|
||||||
tUrl=f""+r[7].replace("/home/drudoo/ComicsTest/Comics/","/content/")
|
s = conn.execute(sql)
|
||||||
tTitle=r[6]
|
list=[]
|
||||||
link3 = Link(
|
for r in s:
|
||||||
#href=quote(f"/content/DC Comics/Earth Cities/Gotham City/Batgirl/Annual/(2012) Batgirl Annual/Batgirl Annual #001 - The Blood That Moves Us [December, 2012].cbz"),
|
#print(r)
|
||||||
href=quote(tUrl),
|
tUrl=f""+r[7].replace("/home/drudoo/ComicsTest/Comics/","/content/")
|
||||||
rel="http://opds-spec.org/acquisition",
|
tTitle=r[6]
|
||||||
rpath=path,
|
link3 = Link(
|
||||||
type="application/x-cbz",
|
#href=quote(f"/content/DC Comics/Earth Cities/Gotham City/Batgirl/Annual/(2012) Batgirl Annual/Batgirl Annual #001 - The Blood That Moves Us [December, 2012].cbz"),
|
||||||
)
|
href=quote(tUrl),
|
||||||
c.add_entry(
|
rel="http://opds-spec.org/acquisition",
|
||||||
Entry(
|
rpath=path,
|
||||||
title=tTitle,
|
type="application/x-cbz",
|
||||||
id=uuid4(),
|
|
||||||
links=[link3]
|
|
||||||
)
|
)
|
||||||
)
|
c.add_entry(
|
||||||
|
Entry(
|
||||||
|
title=tTitle,
|
||||||
|
id=uuid4(),
|
||||||
|
links=[link3]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
Loading…
Reference in New Issue
Block a user