22from pathlib import Path
33from typing import Annotated
44
5- from typer import Argument
5+ from typer import Argument , Option
66from ..app import app
77from os import getenv , scandir
88from .utils import JellyfinAPIClient
@@ -24,15 +24,25 @@ async def add_all_subdirectories_to_library(
2424 ],
2525 jellyfin_server_url : str = getenv ("JELLYFIN_SERVER_URL" , "http://localhost:8096" ),
2626 api_key : str | None = getenv ("JELLYFIN_API_KEY" ),
27- path_replace_from : str | None = Argument (
27+ path_replace_from : str | None = Option (
2828 default = None ,
2929 help = "A substring in the folder paths to replace. Useful for adjusting paths when the server sees them differently." ,
3030 ),
31- path_replace_to : str | None = Argument (
31+ path_replace_to : str | None = Option (
3232 default = None ,
3333 help = "The substring to replace with in the folder paths." ,
3434 ),
3535):
36+ """Add all subdirectories of a given parent folder to a specified Jellyfin library.
37+
38+ :param library_name: The name of the Jellyfin library to which subdirectories will be added. Must exist and match casing.
39+ :param parent_folder_path: The parent folder containing subdirectories to add to the Jellyfin library.
40+ :param jellyfin_server_url: The base URL of the Jellyfin server, defaults to the JELLYFIN_SERVER_URL environment variable or "http://localhost:8096"
41+ :param api_key: The API key for authenticating with the Jellyfin server, defaults to the JELLYFIN_API_KEY environment variable
42+ :param path_replace_from: A substring in the folder paths to replace. Useful for adjusting paths when the server sees them differently.
43+ :param path_replace_to: The substring to replace with in the folder paths.
44+ :raises ValueError: If the API key is not provided or if only one of the path replacement parameters is provided.
45+ """
3646 if not api_key :
3747 raise ValueError (
3848 "JELLYFIN_API_KEY environment variable must be set or the --api-key option must be provided."
0 commit comments