Compare commits
No commits in common. "8c971b044d69ff6310c709e0a1ab5bf17262e014" and "f54414c30031e300308deaa382b0d2df28e13b6b" have entirely different histories.
8c971b044d
...
f54414c300
@ -7,5 +7,5 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- '5000:5000'
|
- '5000:5000'
|
||||||
volumes:
|
volumes:
|
||||||
- '/opt/data/Comics/ComicRack:/library:ro'
|
- '/opt/data/Comics/ComicRack/Oni Press:/library:ro'
|
||||||
- '${PWD}/:/app'
|
- '${PWD}/:/app'
|
||||||
|
53
main.py
53
main.py
@ -45,35 +45,34 @@ def import2sql():
|
|||||||
for file in files:
|
for file in files:
|
||||||
f = os.path.join(root, file)
|
f = os.path.join(root, file)
|
||||||
#try:
|
#try:
|
||||||
if f.endswith('.cbz'):
|
try:
|
||||||
try:
|
s = zipfile.ZipFile(f)
|
||||||
s = zipfile.ZipFile(f)
|
#s = gzip.GzipFile(f)
|
||||||
#s = gzip.GzipFile(f)
|
Bs_data = BeautifulSoup(s.open('ComicInfo.xml').read(), "xml")
|
||||||
Bs_data = BeautifulSoup(s.open('ComicInfo.xml').read(), "xml")
|
#print(Bs_data.select('Series')[0].text, file=sys.stderr)
|
||||||
#print(Bs_data.select('Series')[0].text, file=sys.stderr)
|
#print(Bs_data.select('Title')[0].text, file=sys.stderr)
|
||||||
#print(Bs_data.select('Title')[0].text, file=sys.stderr)
|
CVDB=re.findall('(?<=\[CVDB)(.*)(?=].)', Bs_data.select('Notes')[0].text)
|
||||||
CVDB=re.findall('(?<=\[CVDB)(.*)(?=].)', Bs_data.select('Notes')[0].text)
|
#list.append('CVDB'+CVDB[0] + ': ' + Bs_data.select('Series')[0].text + "(" + Bs_data.select('Volume')[0].text + ") : " + Bs_data.select('Number')[0].text )
|
||||||
#list.append('CVDB'+CVDB[0] + ': ' + Bs_data.select('Series')[0].text + "(" + Bs_data.select('Volume')[0].text + ") : " + Bs_data.select('Number')[0].text )
|
#print(list, file=sys.stdout)
|
||||||
#print(list, file=sys.stdout)
|
|
||||||
|
|
||||||
ISSUE=Bs_data.select('Number')[0].text
|
ISSUE=Bs_data.select('Number')[0].text
|
||||||
SERIES=Bs_data.select('Series')[0].text
|
SERIES=Bs_data.select('Series')[0].text
|
||||||
VOLUME=Bs_data.select('Volume')[0].text
|
VOLUME=Bs_data.select('Volume')[0].text
|
||||||
PUBLISHER=Bs_data.select('Publisher')[0].text
|
PUBLISHER=Bs_data.select('Publisher')[0].text
|
||||||
try:
|
try:
|
||||||
TITLE=Bs_data.select('Title')[0].text
|
TITLE=Bs_data.select('Title')[0].text
|
||||||
except:
|
|
||||||
TITLE="" #sometimes title is blank.
|
|
||||||
PATH=f
|
|
||||||
UPDATED=str(datetime.datetime.now())
|
|
||||||
#print(UPDATED,file=sys.stdout)
|
|
||||||
#sql="INSERT OR REPLACE INTO COMICS (CVDB,ISSUE,SERIES,VOLUME, PUBLISHER, TITLE, FILE,PATH,UPDATED) VALUES ("+CVDB[0]+",'"+ISSUE+"','"+SERIES+"','"+VOLUME+"','"+PUBLISHER+"','"+TITLE+"','"+file+"','" + f + "','" + UPDATED + "')"
|
|
||||||
#print(sql,file=sys.stdout)
|
|
||||||
#conn.execute(sql);
|
|
||||||
conn.execute("INSERT OR REPLACE INTO COMICS (CVDB,ISSUE,SERIES,VOLUME, PUBLISHER, TITLE, FILE,PATH,UPDATED) VALUES (?,?,?,?,?,?,?,?,?)", (CVDB[0], ISSUE, SERIES, VOLUME, PUBLISHER, TITLE, file, f, UPDATED))
|
|
||||||
conn.commit()
|
|
||||||
except:
|
except:
|
||||||
print(f,file=sys.stdout)
|
TITLE="" #sometimes title is blank.
|
||||||
|
PATH=f
|
||||||
|
UPDATED=str(datetime.datetime.now())
|
||||||
|
#print(UPDATED,file=sys.stdout)
|
||||||
|
#sql="INSERT OR REPLACE INTO COMICS (CVDB,ISSUE,SERIES,VOLUME, PUBLISHER, TITLE, FILE,PATH,UPDATED) VALUES ("+CVDB[0]+",'"+ISSUE+"','"+SERIES+"','"+VOLUME+"','"+PUBLISHER+"','"+TITLE+"','"+file+"','" + f + "','" + UPDATED + "')"
|
||||||
|
#print(sql,file=sys.stdout)
|
||||||
|
#conn.execute(sql);
|
||||||
|
conn.execute("INSERT OR REPLACE INTO COMICS (CVDB,ISSUE,SERIES,VOLUME, PUBLISHER, TITLE, FILE,PATH,UPDATED) VALUES (?,?,?,?,?,?,?,?,?)", (CVDB[0], ISSUE, SERIES, VOLUME, PUBLISHER, TITLE, file, f, UPDATED))
|
||||||
|
conn.commit()
|
||||||
|
except:
|
||||||
|
print(f,file=sys.stdout)
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
elapsed = timeit.default_timer() - start_time
|
elapsed = timeit.default_timer() - start_time
|
||||||
|
@ -5,3 +5,4 @@ Flask-HTTPAuth==4.5.0
|
|||||||
gevent==21.8.0
|
gevent==21.8.0
|
||||||
bs4
|
bs4
|
||||||
lxml
|
lxml
|
||||||
|
gzip
|
||||||
|
Loading…
Reference in New Issue
Block a user