Add watchlist auto-download settings
This commit is contained in:
+16
-1
@@ -19,7 +19,7 @@ from uuid import uuid4
|
||||
PROJECT_ROOT = Path(__file__).resolve().parent
|
||||
ANI_CLI = os.environ.get("ANI_CLI_BIN") or shutil.which("ani-cli") or "ani-cli"
|
||||
APP_NAME = "ani-cli-web"
|
||||
VERSION = "0.38.0"
|
||||
VERSION = "0.39.0"
|
||||
ALLANIME_BASE = "allanime.day"
|
||||
ALLANIME_API = f"https://api.{ALLANIME_BASE}"
|
||||
ALLANIME_REFERER = "https://allmanga.to"
|
||||
@@ -140,6 +140,9 @@ DEFAULT_CONFIG = {
|
||||
"watchlist_auto_refresh_enabled": False,
|
||||
"watchlist_auto_refresh_minutes": WATCHLIST_AUTO_REFRESH_DEFAULT_MINUTES,
|
||||
"watchlist_refresh_delay_seconds": WATCHLIST_REFRESH_DELAY_DEFAULT_SECONDS,
|
||||
"auto_download_enabled": False,
|
||||
"auto_download_mode": "dub",
|
||||
"auto_download_quality": "best",
|
||||
"discord_webhook_url": "",
|
||||
"discord_webhook_events": [],
|
||||
}
|
||||
@@ -285,6 +288,11 @@ def normalize_config(data):
|
||||
auto_refresh_enabled = config.get("watchlist_auto_refresh_enabled")
|
||||
auto_refresh_minutes = config.get("watchlist_auto_refresh_minutes")
|
||||
refresh_delay_seconds = config.get("watchlist_refresh_delay_seconds")
|
||||
auto_download_enabled = config.get("auto_download_enabled")
|
||||
auto_download_mode = str(config.get("auto_download_mode", "dub")).lower()
|
||||
auto_download_quality = str(config.get("auto_download_quality", "best")).lower()
|
||||
if auto_download_quality.endswith("p") and auto_download_quality[:-1].isdigit():
|
||||
auto_download_quality = auto_download_quality[:-1]
|
||||
webhook_url = str(config.get("discord_webhook_url") or "").strip()
|
||||
webhook_events = config.get("discord_webhook_events")
|
||||
|
||||
@@ -292,6 +300,10 @@ def normalize_config(data):
|
||||
auto_refresh_enabled = auto_refresh_enabled.strip().lower() in {"1", "true", "yes", "on"}
|
||||
else:
|
||||
auto_refresh_enabled = bool(auto_refresh_enabled)
|
||||
if isinstance(auto_download_enabled, str):
|
||||
auto_download_enabled = auto_download_enabled.strip().lower() in {"1", "true", "yes", "on"}
|
||||
else:
|
||||
auto_download_enabled = bool(auto_download_enabled)
|
||||
|
||||
try:
|
||||
auto_refresh_minutes = int(str(auto_refresh_minutes).strip() or WATCHLIST_AUTO_REFRESH_DEFAULT_MINUTES)
|
||||
@@ -316,6 +328,9 @@ def normalize_config(data):
|
||||
config["watchlist_auto_refresh_enabled"] = auto_refresh_enabled
|
||||
config["watchlist_auto_refresh_minutes"] = auto_refresh_minutes
|
||||
config["watchlist_refresh_delay_seconds"] = refresh_delay_seconds
|
||||
config["auto_download_enabled"] = auto_download_enabled
|
||||
config["auto_download_mode"] = auto_download_mode if auto_download_mode in MODE_CHOICES else "dub"
|
||||
config["auto_download_quality"] = auto_download_quality if auto_download_quality in QUALITY_CHOICES else "best"
|
||||
if isinstance(webhook_events, str):
|
||||
webhook_events = [part.strip() for part in webhook_events.split(",")]
|
||||
elif not isinstance(webhook_events, list):
|
||||
|
||||
Reference in New Issue
Block a user