diff --git a/README.md b/README.md index 70d808b..8107822 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ An example configuration is provided in the docker-compose.yml file. Configure t - `TA_TOKEN`: Tube Archivist API token, accessible from the settings page - `JF_URL`: Full URL where Jellyfin is reachable - `JF_TOKEN`: Jellyfin API token + - `JF_FOLDER`: Folder override if your folder is not named "YouTube" on your Filesystem. - `LISTEN_PORT`: Optionally change the port where the integration is listening for messages. Defaults to `8001`. If you change this, make sure to also change the json link for auto trigger as described below. Mount the `/youtube` folder from Tube Archivist also in this container at `/youtube` to give this integration access to the media archive. @@ -83,6 +84,7 @@ pip install requests - `ta_token`: Tube Archivist API token, accessible from the settings page - `jf_url`: Full URL where Jellyfin is reachable - `jf_token`: Jellyfin API token + - `jf_folder`: Name of the folder where TubeArchivist puts the files into Then run the script from the main folder with python, e.g. ```python diff --git a/app/src/config.py b/app/src/config.py index 7a27663..58b428a 100644 --- a/app/src/config.py +++ b/app/src/config.py @@ -38,6 +38,7 @@ def get_config_env() -> ConfigType | Literal[False]: "ta_token": os.environ["TA_TOKEN"], "jf_url": os.environ["JF_URL"], "jf_token": os.environ["JF_TOKEN"], + "jf_folder": os.environ['JF_FOLDER'] } return config_content diff --git a/app/src/connect.py b/app/src/connect.py index 7c41c1f..4478f5e 100644 --- a/app/src/connect.py +++ b/app/src/connect.py @@ -9,7 +9,7 @@ from src.static_types import ConfigType, TAChannel, TAVideo CONFIG: ConfigType = get_config() TIMEOUT = 60 -EXPECTED_ENV = {"ta_url", "ta_token", "jf_url", "jf_token", "ta_video_path"} +EXPECTED_ENV = {"ta_url", "ta_token", "jf_url", "jf_token", "ta_video_path"} # js_folder is optional class Jellyfin: diff --git a/app/src/series.py b/app/src/series.py index 0e9a7f2..82f55e8 100644 --- a/app/src/series.py +++ b/app/src/series.py @@ -22,8 +22,15 @@ class Library: """get collection id for youtube folder""" path: str = "Items?Recursive=true&includeItemTypes=Folder" folders: dict = Jellyfin().get(path) + folder_name: str | None = get_config()["jf_folder"] + + if not folder_name or len(folder_name) < 1: + folder_name = "youtube" + else: + folder_name = folder_name.lower() + for folder in folders["Items"]: - if folder.get("Name").lower() == "youtube": + if folder.get("Name").lower() == folder_name: return folder.get("Id") raise ValueError("youtube folder not found") diff --git a/app/src/static_types.py b/app/src/static_types.py index bf011b1..1c2d62a 100644 --- a/app/src/static_types.py +++ b/app/src/static_types.py @@ -11,6 +11,7 @@ class ConfigType(TypedDict): ta_token: str jf_url: str jf_token: str + jf_folder: str | None class TAChannel(TypedDict): diff --git a/config.sample.json b/config.sample.json index 444b661..fab8ff2 100644 --- a/config.sample.json +++ b/config.sample.json @@ -3,5 +3,6 @@ "ta_url": "http://tubearchivist.local", "ta_token": "xxxxxxxxxxxxxxxx", "jf_url": "http://jellyfin.local:8096", - "jf_token": "yyyyyyyyyyyyyyyy" + "jf_token": "yyyyyyyyyyyyyyyy", + "jf_folder": "YouTube" }