diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-06-15 22:39:13 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-06-15 22:39:13 +0200 |
commit | f869fff9e9b27562837e90400bb3cca098a0376a (patch) | |
tree | 9bba396534ece3ae7365689cc6786b9d8672664b | |
parent | fee89c4afdde4dacee51a763bc4d931320a9d69d (diff) |
Fix manga missing from open_media script
-rwxr-xr-x | open_media.py | 12 |
1 files changed, 11 insertions, 1 deletions
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 |