mirror of
https://github.com/tubearchivist/jellyfin.git
synced 2025-01-15 13:20:13 +00:00
add hook listening server to trigger refresh
This commit is contained in:
parent
7fa3ab4e9e
commit
45b7b27e86
25
Dockerfile
25
Dockerfile
@ -1,4 +1,21 @@
|
|||||||
FROM python:3.10.9-slim-bullseye
|
FROM python:3.11.3-slim-bullseye
|
||||||
COPY . /jellyfin
|
ARG INSTALL_DEBUG
|
||||||
WORKDIR jellyfin
|
ENV PYTHONUNBUFFERED 1
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
|
# install debug tools for testing environment
|
||||||
|
RUN if [ "$INSTALL_DEBUG" ] ; then \
|
||||||
|
apt-get -y update && apt-get -y install --no-install-recommends \
|
||||||
|
vim htop bmon net-tools iputils-ping procps \
|
||||||
|
&& pip install --user ipython \
|
||||||
|
; fi
|
||||||
|
|
||||||
|
# install requirements
|
||||||
|
COPY ./requirements.txt /requirements.txt
|
||||||
|
RUN pip install --user -r requirements.txt
|
||||||
|
|
||||||
|
COPY app /app
|
||||||
|
WORKDIR app
|
||||||
|
|
||||||
|
VOLUME /youtube
|
||||||
|
|
||||||
|
CMD ["python", "server.py"]
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
from src.connect import Jellyfin, TubeArchivist, env_check
|
from src.connect import Jellyfin, TubeArchivist, env_check
|
||||||
from src.series import Library
|
from src.series import Library
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""main thread"""
|
||||||
env_check()
|
env_check()
|
||||||
Jellyfin().ping()
|
Jellyfin().ping()
|
||||||
TubeArchivist().ping()
|
TubeArchivist().ping()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""main thread"""
|
|
||||||
library = Library()
|
library = Library()
|
||||||
library.validate_series()
|
library.validate_series()
|
||||||
|
|
||||||
|
19
app/server.py
Normal file
19
app/server.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
"""wait for hooks"""
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
from main import main as run_refresh
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/", methods=["POST"])
|
||||||
|
def home():
|
||||||
|
"""handle post grequest"""
|
||||||
|
run_refresh()
|
||||||
|
|
||||||
|
return "success"
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
PORT = 8080
|
||||||
|
app.run(host="0.0.0.0", port=PORT)
|
36
deploy.sh
36
deploy.sh
@ -15,22 +15,48 @@ function validate {
|
|||||||
# note: this logic is duplicated in the `./github/workflows/lint_python.yml` config
|
# note: this logic is duplicated in the `./github/workflows/lint_python.yml` config
|
||||||
# if you update this file, you should update that as well
|
# if you update this file, you should update that as well
|
||||||
echo "running black"
|
echo "running black"
|
||||||
black --exclude "migrations/*" --diff --color --check -l 79 "$check_path"
|
black --force-exclude "migrations/*" --diff --color --check -l 79 "$check_path"
|
||||||
echo "running codespell"
|
echo "running codespell"
|
||||||
codespell --skip="./.git,./package.json,./package-lock.json,./node_modules,./.mypy_cache" "$check_path"
|
codespell --skip="./.git,./.venv,./.mypy_cache" "$check_path"
|
||||||
echo "running flake8"
|
echo "running flake8"
|
||||||
flake8 "$check_path" --exclude "migrations" --count --max-complexity=10 \
|
flake8 "$check_path" --exclude "migrations,.venv" --count --max-complexity=10 \
|
||||||
--max-line-length=79 --show-source --statistics
|
--max-line-length=79 --show-source --statistics
|
||||||
echo "running isort"
|
echo "running isort"
|
||||||
isort --skip "migrations" --check-only --diff --profile black -l 79 "$check_path"
|
isort --skip "migrations" --skip ".venv" --check-only --diff --profile black -l 79 "$check_path"
|
||||||
printf " \n> all validations passed\n"
|
printf " \n> all validations passed\n"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sync_test {
|
||||||
|
|
||||||
|
# docker commands don't need sudo in testing vm
|
||||||
|
|
||||||
|
host="tubearchivist.local"
|
||||||
|
# make base folder
|
||||||
|
ssh "$host" "mkdir -p docker"
|
||||||
|
|
||||||
|
# copy project files to build image
|
||||||
|
rsync -a --progress --delete-after \
|
||||||
|
--exclude ".git" \
|
||||||
|
--exclude ".gitignore" \
|
||||||
|
--exclude "**/cache" \
|
||||||
|
--exclude "**/__pycache__/" \
|
||||||
|
--exclude ".venv" \
|
||||||
|
--exclude "db.sqlite3" \
|
||||||
|
--exclude ".mypy_cache" \
|
||||||
|
. -e ssh "$host":tubearchivist-jf
|
||||||
|
|
||||||
|
ssh "$host" "docker buildx build --build-arg INSTALL_DEBUG=1 -t bbilly1/tubearchivist-jf:latest tubearchivist-jf --load"
|
||||||
|
ssh "$host" 'docker compose -f docker/docker-compose.yml up -d'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $1 == "validate" ]]; then
|
if [[ $1 == "validate" ]]; then
|
||||||
validate "$2"
|
validate "$2"
|
||||||
|
elif [[ $1 == "test" ]]; then
|
||||||
|
sync_test
|
||||||
else
|
else
|
||||||
echo "valid options are: validate"
|
echo "valid options are: validate | test"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,23 @@
|
|||||||
|
version: '3.3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
ta-jf:
|
jellyfin:
|
||||||
build: ./
|
image: jellyfin/jellyfin
|
||||||
|
container_name: jellyfin
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 8096:8096
|
||||||
|
volumes:
|
||||||
|
- ./jellyfin/config:/config
|
||||||
|
- ./jellyfin/cache:/cache
|
||||||
|
- ./tubearchivist/youtube:/media/youtube:ro
|
||||||
|
tubearchivist-jf:
|
||||||
|
image: bbilly1/tubearchivist-jf
|
||||||
|
container_name: tubearchivist-jf
|
||||||
environment:
|
environment:
|
||||||
- TA_VIDEO_PATH="/youtube"
|
- TA_URL=http://tubearchivist:8000
|
||||||
- TA_URL="http://tubearchivist.local"
|
- TA_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
- TA_TOKEN="xxxxxxxxxxxxxxxx"
|
- JF_URL=http://jellyfin:8096
|
||||||
- JF_URL="http://jellyfin.local:8096"
|
- JF_TOKEN=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
|
||||||
- JF_TOKEN="yyyyyyyyyyyyyyyy"
|
volumes:
|
||||||
# volumes:
|
- ./tubearchivist/youtube:/youtube
|
||||||
# - ./config.json:/jellyfin/config.json:ro
|
|
||||||
# - /youtube:/youtube
|
|
||||||
command: python main.py
|
|
||||||
|
@ -1 +1,2 @@
|
|||||||
requests
|
requests==2.31.0
|
||||||
|
Flask==2.3.2
|
||||||
|
Loading…
Reference in New Issue
Block a user