mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-04-01 14:52:29 -04:00
Cleanup previous PR
This commit is contained in:
parent
17d1a7ada0
commit
d85fd0f15b
@ -1,6 +1,7 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2026, Rodrigo Pazos'
|
||||
|
||||
from calibre.ptempfile import PersistentTemporaryFile
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
|
||||
@ -69,10 +70,9 @@ class Cenital(BasicNewsRecipe):
|
||||
newsletter's latest article, with a dark overlay and the Cenital logo centred.
|
||||
Falls back to the static wide image if PIL is unavailable.
|
||||
'''
|
||||
import tempfile
|
||||
from io import BytesIO
|
||||
from urllib.request import Request, urlopen
|
||||
from xml.etree import ElementTree as ET
|
||||
from urllib.request import urlopen, Request
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
@ -137,6 +137,7 @@ class Cenital(BasicNewsRecipe):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
tmp = tempfile.NamedTemporaryFile(suffix='.jpg', delete=False)
|
||||
cover.convert('RGB').save(tmp.name, 'JPEG', quality=90)
|
||||
return tmp.name
|
||||
with PersistentTemporaryFile(suffix='.jpg') as tmp:
|
||||
pass
|
||||
cover.convert('RGB').save(tmp.name, 'JPEG', quality=80)
|
||||
return tmp.name
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user