Adds a strip index file

This should reduce the amount of time we spend on querying for comics that are already present
This commit is contained in:
2025-08-02 14:43:00 -06:00
parent c127a1f4bf
commit 10cd0a9547
3 changed files with 87 additions and 7 deletions

View File

@@ -71,11 +71,14 @@ if __name__ == "__main__":
logging.info("Beginning parsing")
threads = []
comics = []
thread_limit = threading.BoundedSemaphore(value=args.threads)
for url in args.url:
comic_type = find_comic_class(url.netloc + url.path)
comic = comic_type.create_from_url(url)
comics.append(comic)
comic.read_index(base_path)
comic.await_load()
logging.info("There are %d comics", comic.latest_identifier)
if args.latest:
@@ -85,11 +88,19 @@ if __name__ == "__main__":
start = args.start or comic.get_first_strip()
end = args.end or comic.get_latest_strip()
r = r[start - 1:end]
for index in reversed(r):
t = threading.Thread(name=str(comic.get_identifier_string()) + "-" + str(index), target=load_strip, args=(base_path, comic, index, args.plain, thread_limit))
threads.append(t)
t.start()
for t in threads:
t.join()
try:
for index in reversed(r):
if not comic.is_strip_present(base_path, ".cbz", str(index)):
t = threading.Thread(name=str(comic.get_identifier_string()) + "-" + str(index), target=load_strip, args=(base_path, comic, index, args.plain, thread_limit))
threads.append(t)
t.start()
finally:
comic.save_index(base_path)
try:
for t in threads:
t.join()
finally:
for comic in comics:
comic.save_index(base_path)