Formalizes the bluesky process

This commit is contained in:
2025-08-02 16:13:00 -06:00
parent 10cd0a9547
commit 771d1422d8
4 changed files with 198 additions and 552 deletions

View File

@@ -4,7 +4,7 @@ import logging
import logging.handlers
import argparse
from abc import ABC, abstractmethod
from datetime import datetime
from datetime import datetime, date
from threading import Lock, Condition
import bisect
import time
@@ -153,8 +153,8 @@ class ImageRepo(ABC):
if not self._data_loaded:
self._load_data()
logging.info("Completed loading of %s", self.get_identifier_string())
self._data_loaded = True
self._load_lock.notify_all()
self._data_loaded = True
self._load_lock.notify_all()
def await_load(self):
"""
@@ -204,8 +204,8 @@ class ImageRepo(ABC):
logging.info("Downloading %s", self.get_identifier_string())
self._download_data()
logging.info("Completed downloading of %s", self.get_identifier_string())
self._data_downloaded = True
self._download_lock.notify_all()
self._data_downloaded = True
self._download_lock.notify_all()
def await_download(self):
"""
@@ -426,9 +426,9 @@ class ComicStrip(ImageRepo, ABC):
prefix = prefix_num_form.format(self.identifier)
elif (type(self.identifier) == list or type(self.identifier) == tuple) and type(self.identifier[-1]) == int:
prefix = prefix_num_form.format(self.identifier[-1])
elif type(self.date) == datetime.date:
elif type(self.date) == date:
prefix = self.date.isoformat()
elif type(self.date) == datetime.datetime:
elif type(self.date) == datetime:
prefix = self.date.date().isoformat()
else:
prefix = self.get_identifier_string()
@@ -447,21 +447,21 @@ class ComicStrip(ImageRepo, ABC):
return Path(base_path, f"{self.get_filename()}.cbz")
def load_data(self):
super().load_data()
self.comic.load_data()
super().load_data()
self.comic.index_strip(self)
def download_data(self):
super().download_data()
self.comic.download_data()
super().download_data()
def await_load(self):
super().await_load()
self.comic.await_load()
super().await_load()
def await_download(self):
super().await_download()
self.comic.await_download()
super().await_download()
@abstractmethod
def _load_data(self):
@@ -519,7 +519,8 @@ class ComicStrip(ImageRepo, ABC):
for i in range(len(self.transformed_images)):
image = self.transformed_images[i]
image_path = Path(image.name)
with open(image.name, 'rb') as image_stream, comic_zip.open(str(i + 1) + image_path.suffix, 'w') as zip_stream:
logging.info("Packaging %s" % image_path.suffix)
with open(image.name, 'rb') as image_stream, comic_zip.open(str(i + 1) + (image_path.suffix or '.png'), 'w') as zip_stream:
zip_stream.write(image_stream.read())
# Delete the base images, as they are no longer needed.
# We cannot touch the transformed images, since some