From 66085da71a86f507d09cf21df121a24a2b2a0537 Mon Sep 17 00:00:00 2001 From: Dreu LaVelle Date: Thu, 25 Jul 2024 02:34:16 -0500 Subject: [PATCH] chore: release 0.8.3 Release-As: 0.8.3 --- .env.example | 42 +++++++-- README.md | 125 ++++++------------------- docker-compose-dev.yml | 6 +- docker-compose-full.yml | 156 +++++++++++++++++++++++++++++++ docker-compose.yml | 28 +++--- entrypoint.sh | 9 +- src/program/libraries/symlink.py | 4 +- src/program/media/item.py | 2 + src/program/program.py | 7 +- 9 files changed, 243 insertions(+), 136 deletions(-) create mode 100644 docker-compose-full.yml diff --git a/.env.example b/.env.example index 47ea68f8..2188e085 100644 --- a/.env.example +++ b/.env.example @@ -43,10 +43,6 @@ RIVEN_LOGGER_SCRAPER_ICON=👻 RIVEN_LOGGER_COMPLETED_FG=FFFFFF RIVEN_LOGGER_COMPLETED_ICON=🟢 -# CACHE log level -RIVEN_LOGGER_CACHE_FG=527826 -RIVEN_LOGGER_CACHE_ICON=📜 - # NOT_FOUND log level RIVEN_LOGGER_NOT_FOUND_FG=818589 RIVEN_LOGGER_NOT_FOUND_ICON=🤷‍ @@ -80,7 +76,7 @@ RIVEN_LOGGER_TRAKT_FG=1DB954 RIVEN_LOGGER_TRAKT_ICON=🎵 # Riven Settings -RIVEN_VERSION=0.6.4 +RIVEN_VERSION=0.8.3 RIVEN_DEBUG=false RIVEN_LOG=false RIVEN_PLEX_UPDATE_INTERNAL=120 @@ -89,11 +85,28 @@ RIVEN_PLEX_URL=http://plex:32400 RIVEN_SYMLINK_RCLONE_PATH=/mnt/zurg/__all__ RIVEN_SYMLINK_LIBRARY_PATH=/mnt/library +# Indexer +RIVEN_INDEXER_UPDATE_INTERVAL=3600 + +# Database +RIVEN_DATABASE_HOST=sqlite:////riven/data/media.db + # Downloaders +RIVEN_DOWNLOADERS_MOVIE_FILESIZE_MIN=200 +RIVEN_DOWNLOADERS_MOVIE_FILESIZE_MAX=-1 +RIVEN_DOWNLOADERS_EPISODE_FILESIZE_MIN=40 +RIVEN_DOWNLOADERS_EPISODE_FILESIZE_MAX=-1 RIVEN_DOWNLOADERS_REAL_DEBRID_ENABLED=false -RIVEN_DOWNLOADERS_REAL_DEBRID_API_KEY= +RIVEN_DOWNLOADERS_REAL_DEBRID_API_KEY=xxxxx +RIVEN_DOWNLOADERS_REAL_DEBRID_UPDATE_INTERVAL=60 +RIVEN_DOWNLOADERS_REAL_DEBRID_PROXY_ENABLED=false +RIVEN_DOWNLOADERS_REAL_DEBRID_PROXY_URL= +RIVEN_DOWNLOADERS_ALL_DEBRID_ENABLED=false +RIVEN_DOWNLOADERS_ALL_DEBRID_API_KEY=xxxxx +RIVEN_DOWNLOADERS_ALL_DEBRID_PROXY_ENABLED=false +RIVEN_DOWNLOADERS_ALL_DEBRID_PROXY_URL= RIVEN_DOWNLOADERS_TORBOX_ENABLED=false -RIVEN_DOWNLOADERS_TORBOX_API_KEY= +RIVEN_DOWNLOADERS_TORBOX_API_KEY=xxxxx # Content RIVEN_CONTENT_OVERSEERR_ENABLED=false @@ -134,6 +147,9 @@ RIVEN_SCRAPING_JACKETT_LIMITER_SECONDS=60 RIVEN_SCRAPING_PROWLARR_ENABLED=false RIVEN_SCRAPING_PROWLARR_URL=http://prowlarr:9696 RIVEN_SCRAPING_PROWLARR_API_KEY= +RIVEN_SCRAPING_PROWLARR_TIMEOUT=30 +RIVEN_SCRAPING_PROWLARR_RATELIMIT=true +RIVEN_SCRAPING_PROWLARR_LIMITER_SECONDS=60 RIVEN_SCRAPING_ORIONOID_ENABLED=false RIVEN_SCRAPING_ORIONOID_API_KEY= RIVEN_SCRAPING_ORIONOID_LIMITCOUNT=5 @@ -145,6 +161,15 @@ RIVEN_SCRAPING_TORBOX_SCRAPER_ENABLED=false RIVEN_SCRAPING_MEDIAFUSION_ENABLED=false RIVEN_SCRAPING_MEDIAFUSION_URL=https://mediafusion.elfhosted.com RIVEN_SCRAPING_MEDIAFUSION_CATALOGS=["prowlarr_streams","torrentio_streams"] +RIVEN_SCRAPING_ZILEAN_ENABLED=false +RIVEN_SCRAPING_ZILEAN_URL=http://zilean:8181 +RIVEN_SCRAPING_ZILEAN_TIMEOUT=30 +RIVEN_SCRAPING_ZILEAN_RATELIMIT=true +RIVEN_SCRAPING_COMET_ENABLED=false +RIVEN_SCRAPING_COMET_URL=http://comet:8000 +RIVEN_SCRAPING_COMET_TIMEOUT=30 +RIVEN_SCRAPING_COMET_RATELIMIT=true +RIVEN_SCRAPING_COMET_INDEXERS=["bitsearch, eztv, thepiratebay, yts"] # Ranking RIVEN_RANKING_PROFILE=default @@ -222,6 +247,3 @@ RIVEN_RANKING_CUSTOM_RANKS_SUBBED_RANK=4 RIVEN_RANKING_CUSTOM_RANKS_AV1_ENABLED=false RIVEN_RANKING_CUSTOM_RANKS_AV1_FETCH=false RIVEN_RANKING_CUSTOM_RANKS_AV1_RANK=0 - -# Indexer -RIVEN_INDEXER_UPDATE_INTERVAL=3600 diff --git a/README.md b/README.md index dafcc617..8cbbac13 100644 --- a/README.md +++ b/README.md @@ -47,20 +47,29 @@ We are constantly adding features and improvements as we go along and squashing ## Table of Contents -- [Table of Contents](#table-of-contents) -- [ElfHosted](#elfhosted) -- [Self Hosted](#self-hosted) - - [Docker Compose](#docker-compose) - - [What is ORIGIN ?](#what-is-origin-) - - [Running outside of Docker](#running-outside-of-docker) - - [First terminal:](#first-terminal) - - [Second terminal:](#second-terminal) - - [Symlinking settings](#symlinking-settings) - - [Example:](#example) -- [Development](#development) - - [Development without `make`](#development-without-make) -- [Contributing](#contributing) -- [License](#license) +- [Table of Contents](#table-of-contents) +- [ElfHosted](#elfhosted) +- [Self Hosted](#self-hosted) + - [Docker Compose](#docker-compose) + - [What is ORIGIN ?](#what-is-origin-) + - [Running outside of Docker](#running-outside-of-docker) + - [First terminal:](#first-terminal) + - [Second terminal:](#second-terminal) + - [Symlinking settings](#symlinking-settings) +- [Development](#development) + - [Prerequisites](#prerequisites) + - [Initial Setup](#initial-setup) + - [Using `make` for Development](#using-make-for-development) + - [Development without `make`](#development-without-make) + - [Additional Tips](#additional-tips) +- [Contributing](#contributing) + - [Submitting Changes](#submitting-changes) + - [Code Formatting](#code-formatting) + - [Dependency Management](#dependency-management) + - [Setting Up Your Environment](#setting-up-your-environment) + - [Adding or Updating Dependencies](#adding-or-updating-dependencies) + - [Running Tests and Linters](#running-tests-and-linters) +- [License](#license) --- @@ -80,92 +89,10 @@ We are constantly adding features and improvements as we go along and squashing ### Docker Compose -Create a `docker-compose.yml` file with the following contents: +Copy over the contents of [docker-compose.yml](docker-compose.yml) to your `docker-compose.yml` file. -docker-compose.yml (Backend Only) -```yml ---- -services: - riven: - image: spoked/riven:latest - container_name: riven - restart: unless-stopped - ports: - - "8080:8080" - tty: true - environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Amsterdam - - RIVEN_DATABASE_HOST=sqlite:////riven/data/media.db - volumes: - - ./data:/riven/data - - /mnt:/mnt -``` - -docker-compose.yml (Frontend + Backend + Postgress / SQLite + ports: / network_mode: host) -```yml ---- -services: - riven-frontend: - image: spoked/riven-frontend:latest - container_name: riven-frontend - restart: unless-stopped - ports: - - "3000:3000" - #network_mode: host - tty: true - environment: - - PUID=1000 - - PGID=1000 - - ORIGIN=http://localhost:3000 - - BACKEND_URL=http://127.0.0.1:8080 - - TZ=America/New_York - depends_on: - riven: - condition: service_healthy - - riven: - image: spoked/riven:latest - container_name: riven - restart: unless-stopped - ports: - - "8080:8080" - #network_mode: host - tty: true - environment: - - PUID=1000 - - PGID=1000 - - TZ=America/New_York - - RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@riven_postgres/riven #Postgres database - #- RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@localhost/riven #nework_mode: host {use @localhost} - #- RIVEN_DATABASE_HOST=sqlite:////riven/data/media.db #SQLite database - healthcheck: - test: curl -s http://localhost:8080 >/dev/null || exit 1 - interval: 30s - timeout: 10s - retries: 10 - volumes: - - ./data:/riven/data - - /mnt:/mnt - depends_on: # Add # before all {depend: riven_postgress} lines when using SQLite - riven_postgres: - condition: service_healthy - - riven_postgres: # Add # before all {riven_postgres} lines when using SQLite - image: postgres:16.3-alpine3.20 - container_name: riven-db - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: riven - healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres"] - interval: 30s - timeout: 10s - retries: 5 - #network_mode: host -``` +> [!NOTE] +> You can check out the [docker-compose-full.yml](docker-compose-full.yml) file to get an idea of how things tie together. Then run `docker compose up -d` to start the container in the background. You can then access the web interface at `http://localhost:3000` or whatever port and origin you set in the `docker-compose.yml` file. diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 42afb1bc..6e8f19e2 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -11,10 +11,10 @@ services: environment: - PUID=1000 - PGID=1000 - - ORIGIN=${RIVEN_ORIGIN:-http://localhost:8080} - # - RIVEN_FORCE_ENV=true - # - RIVEN_DATABASE_HOST=sqlite:////riven/data/media.db - TZ=UTC + - ORIGIN=${RIVEN_ORIGIN:-http://localhost:8080} + - RIVEN_FORCE_ENV=true + - RIVEN_DATABASE_HOST=sqlite:////riven/data/media.db volumes: - ./data:/riven/data - /mnt:/mnt \ No newline at end of file diff --git a/docker-compose-full.yml b/docker-compose-full.yml new file mode 100644 index 00000000..cac19888 --- /dev/null +++ b/docker-compose-full.yml @@ -0,0 +1,156 @@ +# This is a full setup for Riven with Plex, Overseerr, Zilean, and Torrentio. +# This compose assumes you already setup rclone and zurg. See notes below! + +## Notes: + +# Zurg & Rclone will have to be supplied as well and visible to Riven as well as Plex. +# Rclone should be mounted to: /mnt/zurg (optional directory) +# You will need to set the rclone_path in riven to use the `/mnt/zurg/__all__` dir though +# so that Riven can see all the torrents from their parent directory. + +services: + riven-frontend: + image: spoked/riven-frontend:latest + container_name: riven-frontend + restart: unless-stopped + ports: + - "3000:3000" + tty: true + environment: + - PUID=1000 + - PGID=1000 + - ORIGIN=http://localhost:3000 # Set to IP or FQDN of the server + - BACKEND_URL=http://riven:8080 + - TZ=America/New_York + depends_on: + riven: + condition: service_healthy + + riven: + image: spoked/riven:latest + container_name: riven + restart: unless-stopped + ports: + - "8080:8080" + tty: true + environment: + - PUID=1000 + - PGID=1000 + - TZ=Etc/UTC + - RIVEN_FORCE_ENV=true # forces the use of env vars to be always used! + - RIVEN_SYMLINK_RCLONE_PATH=/mnt/zurg/__all__ # Set this to your rclone's mount `__all__` dir if using Zurg + - RIVEN_SYMLINK_LIBRARY_PATH=/mnt/library # This is the path that symlinks will be placed in + - RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@riven-db/riven + - RIVEN_DOWNLOADERS_REAL_DEBRID_ENABLED=true + - RIVEN_DOWNLOADERS_REAL_DEBRID_API_KEY=xxxxx # set your real debrid api key + - RIVEN_UPDATERS_PLEX_ENABLED=true + - RIVEN_UPDATERS_PLEX_URL=http://plex:32400 + - RIVEN_UPDATERS_PLEX_TOKEN=xxxxx # set your plex token + - RIVEN_CONTENT_OVERSEERR_ENABLED=true + - RIVEN_CONTENT_OVERSEERR_URL=http://overseerr:5055 + - RIVEN_CONTENT_OVERSEERR_API_KEY=xxxxx # set your overseerr token + - RIVEN_SCRAPING_TORRENTIO_ENABLED=true + - RIVEN_SCRAPING_ZILEAN_ENABLED=true + - RIVEN_SCRAPING_ZILEAN_URL=http://zilean:8181 + healthcheck: + test: curl -s http://localhost:8080 >/dev/null || exit 1 + interval: 30s + timeout: 10s + retries: 10 + volumes: + - ./data:/riven/data + - /mnt:/mnt + depends_on: + riven_postgres: + condition: service_healthy + + riven_postgres: + image: postgres:16.3-alpine3.20 + container_name: riven-db + restart: unless-stopped + environment: + PGDATA: /var/lib/postgresql/data/pgdata + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: riven + volumes: + - ./riven-db:/var/lib/postgresql/data/pgdata + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 5s + retries: 5 + + ## Plex (optional media server) + + plex: + image: plexinc/pms-docker:latest + container_name: plex + restart: unless-stopped + ports: + - "32400:32400" + environment: + - PUID=1000 + - PGID=1000 + - TZ=Etc/UTC + - VERSION=docker + volumes: + - ./config:/config + - /mnt:/mnt + devices: + - "/dev/dri:/dev/dri" + + ## Overseerr (optional content service) + + overseerr: + image: lscr.io/linuxserver/overseerr:latest + container_name: overseerr + restart: unless-stopped + environment: + - PUID=1000 + - PGID=1000 + - TZ=Etc/UTC + volumes: + - ./config:/config + ports: + - 5055:5055 + + ## Zilean (optional scraper service) + + zilean: + image: ipromknight/zilean:latest + container_name: zilean + restart: unless-stopped + ports: + - "8181:8181" + volumes: + - zilean_data:/app/data + environment: + Zilean__ElasticSearch__Url: http://elasticsearch:9200 + healthcheck: + test: curl --connect-timeout 10 --silent --show-error --fail http://localhost:8181/healthchecks/ping + timeout: 60s + interval: 30s + retries: 10 + depends_on: + elasticsearch: + condition: service_healthy + + elasticsearch: + image: elasticsearch:8.14.1@sha256:ff3998ab3d8a84984e5298d33d01a174fc5f8abed15ad58d0a54364fc63d68d9 + container_name: elasticsearch + environment: + ES_SETTING_DISCOVERY_TYPE: single-node + ES_SETTING_XPACK_SECURITY_ENABLED: false + ES_SETTING_BOOTSTRAP_MEMORY__LOCK: true + ES_JAVA_OPTS: "-Xms512m -Xmx512m" + ports: + - "9200:9200" + - "9300:9300" + healthcheck: + test: curl -s http://localhost:9200 >/dev/null || exit 1 + interval: 30s + timeout: 10s + retries: 10 + volumes: + - elastic_data:/usr/share/elasticsearch/data:rw diff --git a/docker-compose.yml b/docker-compose.yml index f3d22680..b1154da7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ ---- services: riven-frontend: image: spoked/riven-frontend:latest @@ -6,33 +5,30 @@ services: restart: unless-stopped ports: - "3000:3000" - #network_mode: host tty: true environment: - PUID=1000 - PGID=1000 - - ORIGIN=http://localhost:3000 - - BACKEND_URL=http://127.0.0.1:8080 - TZ=America/New_York + - ORIGIN=http://localhost:3000 # set to the url or ip where the frontend is hosted + - BACKEND_URL=http://riven:8080 depends_on: riven: condition: service_healthy - + riven: image: spoked/riven:latest container_name: riven restart: unless-stopped ports: - "8080:8080" - #network_mode: host tty: true environment: - PUID=1000 - PGID=1000 - TZ=America/New_York - - RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@riven_postgres/riven #Postgres database - #- RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@localhost/riven #nework_mode: host {use @localhost} - #- RIVEN_DATABASE_HOST=sqlite:////riven/data/media.db #SQLite database + - RIVEN_FORCE_ENV=true + - RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@riven-db/riven healthcheck: test: curl -s http://localhost:8080 >/dev/null || exit 1 interval: 30s @@ -41,20 +37,22 @@ services: volumes: - ./data:/riven/data - /mnt:/mnt - depends_on: # Add # before all {depend: riven_postgress} lines when using SQLite + depends_on: riven_postgres: condition: service_healthy - - riven_postgres: # Add # before all {riven_postgres} lines when using SQLite + + riven_postgres: image: postgres:16.3-alpine3.20 container_name: riven-db environment: + PGDATA: /var/lib/postgresql/data/pgdata POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: riven + volumes: + - ./riven-db:/var/lib/postgresql/data/pgdata healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] - interval: 30s - timeout: 10s + interval: 10s + timeout: 5s retries: 5 - #network_mode: host diff --git a/entrypoint.sh b/entrypoint.sh index ac33c49d..a1376b30 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -72,9 +72,12 @@ export HOME="$USER_HOME" # Ensure poetry is in the PATH export PATH="$PATH:/app/.venv/bin" -su -m "$USERNAME" -c "poetry config virtualenvs.create false" +poetry config virtualenvs.create false echo "Container Initialization complete." -# Start the backend echo "Starting Riven (Backend)..." -su -m "$USERNAME" -c "cd /riven/src && poetry run python3 main.py" +if [ "$PUID" = "0" ]; then + cd /riven/src && poetry run python3 main.py +else + su -m "$USERNAME" -c "cd /riven/src && poetry run python3 main.py" +fi \ No newline at end of file diff --git a/src/program/libraries/symlink.py b/src/program/libraries/symlink.py index a396c938..e0af78f9 100644 --- a/src/program/libraries/symlink.py +++ b/src/program/libraries/symlink.py @@ -68,7 +68,7 @@ def process_items(directory: Path, item_class, item_type: str, is_anime: bool = item = item_class({"imdb_id": imdb_id.group(), "title": title.group(1)}) if settings_manager.settings.force_refresh: item.set("symlinked", True) - item.set("update_folder", path) + item.set("update_folder", str(path)) else: item.set("symlinked", True) item.set("update_folder", "updated") @@ -104,7 +104,7 @@ def process_shows(directory: Path, item_type: str, is_anime: bool = False) -> Sh episode_item = Episode({"number": int(episode_number.group(1))}) if settings_manager.settings.force_refresh: episode_item.set("symlinked", True) - episode_item.set("update_folder", f"{directory}/{show}/{season}/{episode}") + episode_item.set("update_folder", str(Path(directory) / show / season / episode)) else: episode_item.set("symlinked", True) episode_item.set("update_folder", "updated") diff --git a/src/program/media/item.py b/src/program/media/item.py index 8abe8f37..f696aa61 100644 --- a/src/program/media/item.py +++ b/src/program/media/item.py @@ -507,10 +507,12 @@ def _determine_state(self): if any(season.state == States.Requested for season in self.seasons): return States.Requested return States.Unknown + def store_state(self) -> None: for season in self.seasons: season.store_state() self.last_state = self._determine_state().name + def __repr__(self): return f"Show:{self.log_string}:{self.state.name}" diff --git a/src/program/program.py b/src/program/program.py index 48c6bcb1..9ab6727f 100644 --- a/src/program/program.py +++ b/src/program/program.py @@ -243,15 +243,14 @@ def _id_in_running_items(self, id): def _push_event_queue(self, event): with self.mutex: if( event.item not in self.queued_items and event.item not in self.running_items): - if hasattr(event.item, "_id"): + if hasattr(event.item, "_id") and event.item._id is not None: if isinstance(event.item, Show): for s in event.item.seasons: - if self._id_in_queue(s._id) or self._id_in_running_items(s._id): + if s._id and (self._id_in_queue(s._id) or self._id_in_running_items(s._id)): return None for e in s.episodes: - if self._id_in_queue(e._id) or self._id_in_running_items(e._id): + if e._id and (self._id_in_queue(e._id) or self._id_in_running_items(e._id)): return None - if isinstance(event.item, Season): for e in event.item.episodes: if self._id_in_queue(e._id) or self._id_in_running_items(e._id):