Skip to content

Commit 8ca9e63

Browse files
committed
Actually import it
1 parent 9254769 commit 8ca9e63

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from .app import app as app
2-
from .backup import find_hardlinks as find_hardlinks
2+
from .backup import find_hardlinks # noqa: F401
3+
from .jellyfin import add_all_subdirectories_to_library # noqa: F401

src/jellyfin/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .add_all_subdirectories_to_library import add_all_subdirectories_to_library # noqa: F401

src/jellyfin/add_all_subdirectories_to_library.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33
from typing import Annotated
44

5-
from typer import Argument
5+
from typer import Argument, Option
66
from ..app import app
77
from os import getenv, scandir
88
from .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

Comments
 (0)