Fixes some bugs with the indexer
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
import logging
|
||||
import logging.handlers
|
||||
import argparse
|
||||
from signal import signal, SIGINT
|
||||
from sys import exit
|
||||
import datetime
|
||||
import threading
|
||||
import time
|
||||
@@ -100,7 +102,7 @@ def __main__():
|
||||
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)
|
||||
@@ -121,16 +123,18 @@ def __main__():
|
||||
if not comic_download.is_strip_present(comic, 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.daemon = True
|
||||
t.start()
|
||||
finally:
|
||||
logging.info("Saving index")
|
||||
comic_download.save_index(base_path)
|
||||
|
||||
try:
|
||||
for t in threads:
|
||||
t.join()
|
||||
while any([t.is_alive() for t in threads]):
|
||||
time.sleep(1)
|
||||
finally:
|
||||
for comic in comics:
|
||||
comic_download.save_index(base_path)
|
||||
logging.info("Saving index")
|
||||
comic_download.save_index(base_path)
|
||||
|
||||
if __name__ == "__main__":
|
||||
__main__()
|
||||
|
||||
Reference in New Issue
Block a user