Skip to content

Commit 5585be3

Browse files
committed
Version 2.0.10
1 parent 028095c commit 5585be3

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

getcomic/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__='2.0.9'
1+
__version__='2.0.10'
22
name='getcomic'

getcomic/getcomic.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import collections
66
from fpdf import FPDF
77
from pathlib import Path
8+
from PIL import Image
89
from selenium import webdriver
910
from selenium.webdriver.common.by import By
1011
from selenium.webdriver.support.ui import WebDriverWait
@@ -288,17 +289,24 @@ def createpdf(urls,sz,chapterpath,filename):
288289
i=1
289290
progress='==>| '
290291
pdf=FPDF('P','mm','A4')
291-
x,y,w,h=0,0,200,250
292+
x,y,w,h=0,0,210,297
292293
stat='Completed: '
293294
for url in urls:
294-
tfn=str(i)+'.jpg'
295+
tfn=str(i)
296+
res=urllib.request.urlopen(url)
297+
contype=res.info().get_content_subtype()
298+
#print(contype)
299+
if contype=='jpeg':
300+
tfn=tfn+'.jpg'
301+
elif contype=='png':
302+
tfn=tfn+'.png'
295303
fp=open(tfn,'wb')
296-
fp.write(urllib.request.urlopen(url).read())
304+
fp.write(res.read())
297305
fp.close()
306+
origimg=Image.open(chapterpath+'/'+tfn)
298307
pdf.add_page()
299308
pdf.image(chapterpath+'/'+tfn,x,y,w,h)
300309
os.remove(tfn)
301-
#pdf.image(url,x,y,w,h)
302310
p=str(int(i/sz*100))
303311
i=i+1
304312
progress='='+progress

0 commit comments

Comments
 (0)