Add ability to mark existing episodes at source as already downloaded without downloading

This commit is contained in:
2026-05-14 21:20:07 +09:30
parent 4ccc43cdfc
commit ba808c4853
+35 -5
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
import argparse
@@ -11,10 +12,10 @@ from services.iview import iViewService
# -------------------------
# Metadata paths
# -------------------------
DOWNLOAD_META = Path("./.download")
DOWNLOAD_META = Path("./.config")
HISTORY_FILE = DOWNLOAD_META / ".history"
SERIES_FILE = DOWNLOAD_META / ".series"
HISTORY_FILE = DOWNLOAD_META / "history"
SERIES_FILE = DOWNLOAD_META / "series"
# -------------------------
@@ -30,10 +31,16 @@ SERVICES = {
# -------------------------
class AutoGrabber:
def __init__(self, download_dir, dry_run=False):
def __init__(
self,
download_dir,
dry_run=False,
mark_existing=False
):
self.download_dir = Path(download_dir)
self.dry_run = dry_run
self.mark_existing = mark_existing
self.history = self.load_history()
self.series_list = self.load_series()
@@ -197,6 +204,22 @@ class AutoGrabber:
continue
# mark-existing mode
if self.mark_existing:
print(
f"📝 "
f"{filename} "
f"(added to history)"
)
self.history[ep_id] = filename
self.save_history()
continue
# normal download mode
print(f"{filename} → downloading")
success = service.download_episode(
@@ -254,6 +277,12 @@ def parse_args():
help="Download directory"
)
parser.add_argument(
"--mark-existing",
action="store_true",
help="Add all available episodes to history without downloading"
)
return parser.parse_args()
@@ -266,5 +295,6 @@ if __name__ == "__main__":
AutoGrabber(
download_dir=args.downloads,
dry_run=args.dry_run
dry_run=args.dry_run,
mark_existing=args.mark_existing
).run()