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
|
||||
@@ -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__()
|
||||
|
||||
@@ -158,9 +158,9 @@ def index_strip(strip):
|
||||
global _index_loaded
|
||||
global _index_lock
|
||||
with _index_lock:
|
||||
if not strip.comic.identifier in strip_index:
|
||||
if not strip.comic.get_identifier_string() in strip_index:
|
||||
strip_index[strip.comic.get_identifier_string()] = {}
|
||||
strip_index[strip.comic.get_identifier_string()][strip.identifier] = strip.get_filename()
|
||||
strip_index[strip.comic.get_identifier_string()][strip.get_identifier_string()] = strip.get_filename()
|
||||
|
||||
def is_strip_present(comic, base_path: Path, suffix: str, identifier) -> bool:
|
||||
"""
|
||||
@@ -177,9 +177,9 @@ def is_strip_present(comic, base_path: Path, suffix: str, identifier) -> bool:
|
||||
global _index_lock
|
||||
if not comic.get_identifier_string() in strip_index:
|
||||
return False
|
||||
if not identifier in strip_index[comic.get_identifier_string()]:
|
||||
if not get_identifier_string(identifier) in strip_index[comic.get_identifier_string()]:
|
||||
return False
|
||||
path = Path(base_path, strip_index[comic.get_identifier_string()][identifier] + suffix)
|
||||
path = Path(base_path, strip_index[comic.get_identifier_string()][get_identifier_string(identifier)] + suffix)
|
||||
return path.exists()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user