aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xopen_media.py12
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