forked from kenzuya/unshackle
feat(dl): add --latest-episodes N to download the N newest episodes
Split episodes count once. Exposed as latest_episodes on the REST API. Closes #159.
This commit is contained in:
@@ -591,6 +591,7 @@ def perform_download(
|
||||
select_titles=False,
|
||||
wanted=params.get("wanted", []),
|
||||
latest_episode=params.get("latest_episode", False),
|
||||
latest_episodes=params.get("latest_episodes"),
|
||||
lang=ctx.params["lang"],
|
||||
v_lang=ctx.params["v_lang"],
|
||||
a_lang=ctx.params["a_lang"],
|
||||
|
||||
@@ -55,6 +55,7 @@ DEFAULT_DOWNLOAD_PARAMS = {
|
||||
"no_atmos": False,
|
||||
"wanted": [],
|
||||
"latest_episode": False,
|
||||
"latest_episodes": None,
|
||||
"lang": ["orig"],
|
||||
"v_lang": [],
|
||||
"a_lang": [],
|
||||
@@ -1871,7 +1872,7 @@ def validate_download_parameters(data: Dict[str, Any]) -> Optional[str]:
|
||||
if not isinstance(data["downloads"], int) or data["downloads"] <= 0:
|
||||
return "downloads must be a positive integer"
|
||||
|
||||
for name in ("tmdb_id", "tvdb_id"):
|
||||
for name in ("tmdb_id", "tvdb_id", "latest_episodes"):
|
||||
if data.get(name) is not None:
|
||||
value = data[name]
|
||||
if isinstance(value, bool) or not isinstance(value, int) or value <= 0:
|
||||
|
||||
@@ -853,6 +853,10 @@ async def download(request: web.Request) -> web.Response:
|
||||
latest_episode:
|
||||
type: boolean
|
||||
description: Download only the single most recent episode (default - false)
|
||||
latest_episodes:
|
||||
type: integer
|
||||
minimum: 1
|
||||
description: Download only the N most recent episodes; overrides latest_episode (default - null)
|
||||
lang:
|
||||
type: array
|
||||
items:
|
||||
|
||||
Reference in New Issue
Block a user