mirror of
https://github.com/tubearchivist/jellyfin.git
synced 2024-11-16 17:00:14 +00:00
Fixes
This commit is contained in:
parent
a4b5081c7a
commit
fccf9c865a
@ -29,6 +29,12 @@ def get_config_file() -> ConfigType | Literal[False]:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def get_variable_or_default(variable: str, default: str) -> str:
|
||||||
|
if not variable or len(variable) < 1:
|
||||||
|
return default
|
||||||
|
return variable
|
||||||
|
|
||||||
|
|
||||||
def get_config_env() -> ConfigType | Literal[False]:
|
def get_config_env() -> ConfigType | Literal[False]:
|
||||||
"""read config from environment"""
|
"""read config from environment"""
|
||||||
if "TA_URL" in os.environ:
|
if "TA_URL" in os.environ:
|
||||||
@ -38,7 +44,9 @@ def get_config_env() -> ConfigType | Literal[False]:
|
|||||||
"ta_token": os.environ["TA_TOKEN"],
|
"ta_token": os.environ["TA_TOKEN"],
|
||||||
"jf_url": os.environ["JF_URL"],
|
"jf_url": os.environ["JF_URL"],
|
||||||
"jf_token": os.environ["JF_TOKEN"],
|
"jf_token": os.environ["JF_TOKEN"],
|
||||||
"jf_folder": os.environ['JF_FOLDER']
|
"jf_folder": get_variable_or_default(
|
||||||
|
os.environ["JF_FOLDER"], "youtube"
|
||||||
|
),
|
||||||
}
|
}
|
||||||
return config_content
|
return config_content
|
||||||
|
|
||||||
|
@ -9,7 +9,13 @@ from src.static_types import ConfigType, TAChannel, TAVideo
|
|||||||
|
|
||||||
CONFIG: ConfigType = get_config()
|
CONFIG: ConfigType = get_config()
|
||||||
TIMEOUT = 60
|
TIMEOUT = 60
|
||||||
EXPECTED_ENV = {"ta_url", "ta_token", "jf_url", "jf_token", "ta_video_path"} # js_folder is optional
|
EXPECTED_ENV = {
|
||||||
|
"ta_url",
|
||||||
|
"ta_token",
|
||||||
|
"jf_url",
|
||||||
|
"jf_token",
|
||||||
|
"ta_video_path",
|
||||||
|
} # jf_folder is optional
|
||||||
|
|
||||||
|
|
||||||
class Jellyfin:
|
class Jellyfin:
|
||||||
|
@ -22,15 +22,10 @@ class Library:
|
|||||||
"""get collection id for youtube folder"""
|
"""get collection id for youtube folder"""
|
||||||
path: str = "Items?Recursive=true&includeItemTypes=Folder"
|
path: str = "Items?Recursive=true&includeItemTypes=Folder"
|
||||||
folders: dict = Jellyfin().get(path)
|
folders: dict = Jellyfin().get(path)
|
||||||
folder_name: str | None = get_config()["jf_folder"]
|
folder_name: str = 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"]:
|
for folder in folders["Items"]:
|
||||||
if folder.get("Name").lower() == folder_name:
|
if folder.get("Name").lower() == folder_name.lower():
|
||||||
return folder.get("Id")
|
return folder.get("Id")
|
||||||
|
|
||||||
raise ValueError("youtube folder not found")
|
raise ValueError("youtube folder not found")
|
||||||
|
@ -11,7 +11,7 @@ class ConfigType(TypedDict):
|
|||||||
ta_token: str
|
ta_token: str
|
||||||
jf_url: str
|
jf_url: str
|
||||||
jf_token: str
|
jf_token: str
|
||||||
jf_folder: str | None
|
jf_folder: str
|
||||||
|
|
||||||
|
|
||||||
class TAChannel(TypedDict):
|
class TAChannel(TypedDict):
|
||||||
|
Loading…
Reference in New Issue
Block a user