Compare commits
No commits in common. "d7f38882f2ce1935acc06d35817fd9f0c6f5c1e3" and "8c69a958def4c14a930e568692c98e30e2d6ed26" have entirely different histories.
d7f38882f2
...
8c69a958de
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,6 +2,4 @@
|
||||
__pycache__/
|
||||
.env
|
||||
deploy.sh
|
||||
env
|
||||
thumbnails
|
||||
*.db
|
||||
env
|
36
main.py
36
main.py
@ -125,7 +125,6 @@ def generate():
|
||||
files_without_comicinfo = 0
|
||||
errorcount = 0
|
||||
skippedcount = 0
|
||||
errormsg = ""
|
||||
for root, dirs, files in os.walk(os.path.abspath(config.CONTENT_BASE_DIR)):
|
||||
for file in files:
|
||||
f = os.path.join(root, file)
|
||||
@ -140,9 +139,8 @@ def generate():
|
||||
if force == 'True':
|
||||
ext = [i for i, x in enumerate(filelist) if re.search("(?i)\.jpg|png|jpeg$", x)]
|
||||
cover = s.open(filelist[ext[0]]).read()
|
||||
|
||||
|
||||
image = Image.open(BytesIO(cover))
|
||||
rgb_im = image.convert("RGB")
|
||||
image.thumbnail(config.MAXSIZE,Image.ANTIALIAS)
|
||||
image.save(config.THUMBNAIL_DIR + "/" + str(CVDB) + ".jpg")
|
||||
|
||||
@ -151,23 +149,18 @@ def generate():
|
||||
#c.write(cover)
|
||||
#c.close()
|
||||
generated = generated + 1
|
||||
if Path(config.THUMBNAIL_DIR + "/" + str(CVDB) + ".jpg").exists() == False:
|
||||
config._print("generating for " + str(CVDB))
|
||||
try:
|
||||
ext = [i for i, x in enumerate(filelist) if re.search("(?i)\.jpg|png|jpeg$", x)]
|
||||
#config._print(filelist)
|
||||
#config._print(ext)
|
||||
#config._print(filelist[ext[0]])
|
||||
cover = s.open(filelist[ext[0]]).read()
|
||||
#xyz = [i for i, x in enumerate(filelist) if re.match('*\.py$',x)]
|
||||
#config._print(xyz)
|
||||
image = Image.open(BytesIO(cover))
|
||||
image.thumbnail(config.MAXSIZE,Image.ANTIALIAS)
|
||||
image.save(config.THUMBNAIL_DIR + "/" + str(CVDB) + ".jpg")
|
||||
generated = generated + 1
|
||||
except Exception as e:
|
||||
errormsg = str(e)
|
||||
print(e)
|
||||
elif Path(config.THUMBNAIL_DIR + "/" + str(CVDB) + ".jpg").exists() == False:
|
||||
ext = [i for i, x in enumerate(filelist) if re.search("(?i)\.jpg|png|jpeg$", x)]
|
||||
config._print(filelist)
|
||||
config._print(ext)
|
||||
config._print(filelist[ext[0]])
|
||||
cover = s.open(filelist[ext[0]]).read()
|
||||
#xyz = [i for i, x in enumerate(filelist) if re.match('*\.py$',x)]
|
||||
#config._print(xyz)
|
||||
image = Image.open(BytesIO(cover))
|
||||
image.thumbnail(config.MAXSIZE,Image.ANTIALIAS)
|
||||
image.save(config.THUMBNAIL_DIR + "/" + str(CVDB) + ".jpg")
|
||||
generated = generated + 1
|
||||
else:
|
||||
skippedcount = skippedcount + 1
|
||||
else:
|
||||
@ -176,8 +169,7 @@ def generate():
|
||||
errorcount = errorcount + 1
|
||||
config._print("Error (/generate): " + str(e))
|
||||
config._print(f)
|
||||
errormsg = str(e)
|
||||
return "Forced generation: " + str(force) + "<br>Comics: " + str(comiccount) + "<br>Generated: " + str(generated) + "<br>CBZ files without ComicInfo.xml: " + str(files_without_comicinfo) + "<br>Errors: " + str(errorcount) + "<br>Skipped: " + str(skippedcount) + "<br>" + errormsg
|
||||
return "Forced generation: " + str(force) + "<br>Comics: " + str(comiccount) + "<br>Generated: " + str(generated) + "<br>CBZ files without ComicInfo.xml: " + str(files_without_comicinfo) + "<br>Errors: " + str(errorcount) + "<br>Skipped: " + str(skippedcount)
|
||||
|
||||
|
||||
@app.route('/import')
|
||||
|
@ -53,7 +53,6 @@ class Entry(object):
|
||||
|
||||
#print(">>entry.py")
|
||||
#print(kwargs)
|
||||
print(kwargs["title"])
|
||||
#print(kwargs["links"][0].get("rpath"))
|
||||
#print("--end entry.py")
|
||||
try:
|
||||
@ -61,8 +60,8 @@ class Entry(object):
|
||||
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(), features="html.parser")
|
||||
#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') != []:
|
||||
@ -70,17 +69,10 @@ class Entry(object):
|
||||
else:
|
||||
config._print("No Writer found: " + str(data.select('Writer')))
|
||||
|
||||
self.cover = "/image/" + extras.get_cvdb(data.select('Notes')) + ".jpg"
|
||||
#if data.select('Title') != []:
|
||||
# self.title = data.select('Title')[0]
|
||||
|
||||
# print(data.select('Title')[0])
|
||||
title = data.select('Title')[0].text.replace("&","&")
|
||||
kwargs["title"] = title
|
||||
print(title)
|
||||
#self.cover = "/image/" + extras.get_cvdb(data.select('Notes')) + ".jpg"
|
||||
|
||||
if data.select('Summary') != []:
|
||||
#print(data.select('Summary')[0].text)
|
||||
self.summary = data.select('Summary')[0]
|
||||
self.summary = data.select('Summary')[0].text
|
||||
else:
|
||||
config._print("No Summary found: " + str(data.select('Summary')))
|
||||
|
||||
@ -92,12 +84,12 @@ class Entry(object):
|
||||
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) + ": " + title + " (" + releasedate + ") [" + str(self.size) + "MB]"
|
||||
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 = title
|
||||
self.title = kwargs["title"]
|
||||
|
||||
else:
|
||||
self.title = kwargs["title"]
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user