mirror of
https://github.com/tubearchivist/jellyfin.git
synced 2025-01-15 13:20:13 +00:00
Merge pull request #8 from jonasrosland/docker
Add initial docker setup
This commit is contained in:
commit
3a13b6ab17
4
Dockerfile
Normal file
4
Dockerfile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM python:3.10.9-slim-bullseye
|
||||||
|
COPY . /jellyfin
|
||||||
|
WORKDIR jellyfin
|
||||||
|
RUN pip install -r requirements.txt
|
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
ta-jf:
|
||||||
|
build: ./
|
||||||
|
environment:
|
||||||
|
- TA_VIDEO_PATH="/youtube"
|
||||||
|
- TA_URL="http://tubearchivist.local"
|
||||||
|
- TA_TOKEN="xxxxxxxxxxxxxxxx"
|
||||||
|
- JF_URL="http://jellyfin.local:8096"
|
||||||
|
- JF_TOKEN="yyyyyyyyyyyyyyyy"
|
||||||
|
# volumes:
|
||||||
|
# - ./config.json:/jellyfin/config.json:ro
|
||||||
|
# - /youtube:/youtube
|
||||||
|
command: python main.py
|
@ -1,13 +1,28 @@
|
|||||||
"""handle config file"""
|
"""handle config file"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
from src.static_types import ConfigType
|
from src.static_types import ConfigType
|
||||||
|
|
||||||
|
|
||||||
def get_config() -> ConfigType:
|
def get_config() -> ConfigType:
|
||||||
"""get connection config"""
|
"""get connection config"""
|
||||||
with open("config.json", "r", encoding="utf-8") as f:
|
|
||||||
config_content: ConfigType = json.loads(f.read())
|
|
||||||
|
|
||||||
return config_content
|
if os.path.exists("config.json"):
|
||||||
|
print("config.json file found, skipping environment variables")
|
||||||
|
with open("config.json", "r", encoding="utf-8") as f:
|
||||||
|
config_content: ConfigType = json.loads(f.read())
|
||||||
|
return config_content
|
||||||
|
elif "TA_URL" in os.environ:
|
||||||
|
print("Environment variables found, continuing")
|
||||||
|
data = {}
|
||||||
|
data['ta_video_path'] = os.getenv('TA_VIDEO_PATH', '/youtube')
|
||||||
|
data['ta_url'] = os.getenv('TA_URL')
|
||||||
|
data['ta_token'] = os.getenv('TA_TOKEN')
|
||||||
|
data['jf_url'] = os.getenv('JF_URL')
|
||||||
|
data['jf_token'] = os.getenv('JF_TOKEN')
|
||||||
|
config_content: ConfigType = json.loads(json.dumps(data))
|
||||||
|
return config_content
|
||||||
|
else:
|
||||||
|
raise ValueError("No config.json or environment variable found, exiting")
|
@ -100,11 +100,30 @@ class TubeArchivist:
|
|||||||
|
|
||||||
def env_check() -> None:
|
def env_check() -> None:
|
||||||
"""check if ta_video_path is accessible"""
|
"""check if ta_video_path is accessible"""
|
||||||
if not os.path.exists("config.json"):
|
# if not os.path.exists("config.json"):
|
||||||
raise FileNotFoundError("config.json file not found")
|
# raise FileNotFoundError("config.json file not found")
|
||||||
|
if not CONFIG["ta_url"]:
|
||||||
|
raise ValueError("TA_URL not set")
|
||||||
|
else:
|
||||||
|
print("TA_URL =", CONFIG["ta_url"])
|
||||||
|
|
||||||
|
if not CONFIG["ta_token"]:
|
||||||
|
raise ValueError("TA_TOKEN not set")
|
||||||
|
else:
|
||||||
|
print("TA_TOKEN =", CONFIG["ta_token"])
|
||||||
|
|
||||||
|
if not CONFIG["jf_url"]:
|
||||||
|
raise ValueError("JF_URL not set")
|
||||||
|
else:
|
||||||
|
print("JF_URL =", CONFIG["jf_url"])
|
||||||
|
|
||||||
|
if not CONFIG["jf_token"]:
|
||||||
|
raise ValueError("JF_TOKEN not set")
|
||||||
|
else:
|
||||||
|
print("JF_TOKEN =", CONFIG["jf_token"])
|
||||||
|
|
||||||
if not os.path.exists(CONFIG["ta_video_path"]):
|
if not os.path.exists(CONFIG["ta_video_path"]):
|
||||||
raise FileNotFoundError("failed to access ta_video_path")
|
raise FileNotFoundError("failed to access ta_video_path", CONFIG["ta_video_path"])
|
||||||
|
|
||||||
|
|
||||||
def clean_overview(overview_raw: str) -> str:
|
def clean_overview(overview_raw: str) -> str:
|
||||||
|
Loading…
Reference in New Issue
Block a user