From f869fff9e9b27562837e90400bb3cca098a0376a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 15 Jun 2021 22:39:13 +0200 Subject: Fix manga missing from open_media script --- open_media.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/open_media.py b/open_media.py index b165d74..f894a61 100755 --- a/open_media.py +++ b/open_media.py @@ -36,11 +36,21 @@ def get_downloaded_list(): print("Failed to list downloaded items, error: {}".format(stderr)) return [] +def get_manga_chapters_in_dir(manga_dir): + files = [] + for filename in os.listdir(manga_dir): + full_path = os.path.join(manga_dir, filename) + if os.path.isdir(full_path) and not os.path.exists(os.path.join(full_path, ".in_progress")) and os.path.exists(os.path.join(full_path, ".finished")): + files.append(full_path) + return files + def get_files_in_download_dir(download_dir): files_in_media_path = [] for filename in os.listdir(download_dir): full_path = os.path.join(download_dir, filename) - if not os.path.exists(os.path.join(full_path, ".in_progress")) and (os.path.isfile(full_path) or (os.path.isdir(full_path) and os.path.exists(os.path.join(full_path, ".finished")))): + if os.path.isdir(full_path): + files_in_media_path.extend(get_manga_chapters_in_dir(full_path)) + if os.path.isfile(full_path): files_in_media_path.append(full_path) return files_in_media_path -- cgit v1.2.3