Implement non-interactive mode for PlaylistDownloader to support CI automation

This commit is contained in:
2025-10-21 21:45:23 +03:00
parent 1402af52d6
commit e1ec65094f
+6 -1
View File
@@ -18,6 +18,8 @@ class PlaylistDownloader:
# If the manager (or config) defines debug, prefer that # If the manager (or config) defines debug, prefer that
if hasattr(config, "debug"): if hasattr(config, "debug"):
self.debug = bool(config.debug) self.debug = bool(config.debug)
# non-interactive mode for CI/automated runs
self.non_interactive = bool(getattr(config, "non_interactive", False))
self.url = playlist.get("url") self.url = playlist.get("url")
self.skip = False self.skip = False
@@ -358,7 +360,10 @@ class PlaylistDownloader:
self.logger.warning(" %s", f.name) self.logger.warning(" %s", f.name)
try: try:
confirm = input("Delete these files? [y/N]: ").strip().lower() if self.non_interactive:
confirm = "y"
else:
confirm = input("Delete these files? [y/N]: ").strip().lower()
except EOFError: except EOFError:
confirm = "n" confirm = "n"