Fixes some bugs with non-code file handling in the new setup
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
requests
|
||||
beautifulsoup4
|
||||
lxml
|
||||
pillow
|
||||
atproto
|
||||
pycryptodome
|
||||
@@ -352,7 +352,7 @@ class AssetRepo(ABC):
|
||||
iterator = range(len(self.image_urls))
|
||||
for name in iterator:
|
||||
logging.info(" Downloading repository %s resource %s", repr(self), name)
|
||||
image_path = NamedTemporaryFile(mode='wb', suffix=str(name.replace('/', '-')), prefix=str(self), delete = False)
|
||||
image_path = NamedTemporaryFile(mode='wb', suffix=str(name).replace('/', '-'), prefix=str(self), delete = False)
|
||||
result = requests.get(self.image_urls[name], headers=self.download_headers)
|
||||
result.raise_for_status()
|
||||
# Handles necessary transformations for a URL (i.e., redirections)
|
||||
|
||||
@@ -24,6 +24,7 @@ import json
|
||||
import re
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from importlib import resources
|
||||
from pathlib import Path
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
@@ -139,6 +140,7 @@ class ExistentialComicStrip(ComicStrip):
|
||||
safety_size = 24
|
||||
caption_size = 15
|
||||
f_size = (1000, 1500)
|
||||
with resources.path("comic_download", "Lucida Sans Bold.ttf") as luc_sans_bold, resources.path("comic_download", "Lucida Sans.ttf") as luc_sans:
|
||||
title_font = ImageFont.truetype(Path(Path(__file__).parent, "Lucida Sans Bold.ttf"), title_size)
|
||||
safety_font = ImageFont.truetype(Path(Path(__file__).parent, "Lucida Sans Bold.ttf"), safety_size)
|
||||
caption_font = ImageFont.truetype(Path(Path(__file__).parent, "Lucida Sans.ttf"), caption_size)
|
||||
|
||||
@@ -24,6 +24,7 @@ import textwrap
|
||||
from zipfile import ZipFile
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from importlib import resources
|
||||
from pathlib import Path
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
@@ -110,6 +111,8 @@ class XKCDComicStrip(ComicStrip):
|
||||
f_width = 780
|
||||
title_size = 21
|
||||
caption_size = 12
|
||||
|
||||
with resources.path("comic_download", "Lucida Sans Bold.ttf") as luc_sans_bold, resources.path("comic_download", "Lucida Sans.ttf") as luc_sans:
|
||||
title_font = ImageFont.truetype(Path(Path(__file__).parent, "Lucida Sans Bold.ttf"), title_size, layout_engine=ImageFont.Layout.RAQM)
|
||||
caption_font = ImageFont.truetype(Path(Path(__file__).parent, "Lucida Sans.ttf"), caption_size)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user