feat(release): publish minimal self-contained Magent source
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"""Shared Sonarr/Radarr configuration helpers."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
class RootFolderNotFoundError(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
async def resolve_root_folder_path(client: Any, root_folder: str, service_name: str) -> str:
|
||||
configured = str(root_folder or "").strip()
|
||||
if not configured.isdigit():
|
||||
return configured
|
||||
folders = await client.get_root_folders()
|
||||
if isinstance(folders, list):
|
||||
for folder in folders:
|
||||
if isinstance(folder, dict) and folder.get("id") == int(configured):
|
||||
path = str(folder.get("path") or "").strip()
|
||||
if path:
|
||||
return path
|
||||
raise RootFolderNotFoundError(f"{service_name} root folder id {configured} not found")
|
||||
Reference in New Issue
Block a user