blacktwin / JBOPS

Just a Bunch Of Plex Scripts
1.69k stars 307 forks source link

FileNotFoundError: [Errno 2] No such file or directory when Plex server runs on docker #407

Closed MawRojas closed 10 months ago

MawRojas commented 10 months ago

I'm tying to run the hide_episode_spoilers script when the plex server runs on a docker container and I get the FileNotFoundError. The error makes sense since it's looking at the directory from the docker configuration, which is a mounted one. Is there a way to make the script work with docker?

For example, using the following docker compose:

  plex:
    image: lscr.io/linuxserver/plex:latest
    container_name: plex
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Mexico_City
      - VERSION=docker
      - PLEX_CLAIM= #optional
    ports:
      - 32400:32400
    restart: unless-stopped
    volumes:
      - /mnt/pool/media/Movies:/movies
      - /mnt/pool/media/Shows:/tv

When I run the scirpt:
python hide_episode_spoilers.py --rating_key 4457 --blur 25

Then I get the error:
FileNotFoundError: [Errno 2] No such file or directory: '/tv/Cyberpunk - Edgerunners/S01/S01E01.mkv'

It is searching for the file on the mounted volume rather than the actual directory. Is it possible to change this behavior?

MawRojas commented 10 months ago

I was able to modify the scrip to replace the /tv/ path with a path passed as an argument like this: python hide_episode_spoilers.py --base_directory /mnt/pool/media/Shows/ --rating_key 4457 --blur 25.
This works when running the script from the terminal. However, when I try to run it in Tautulli I get the following error:
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/pool/media/Shows/Cyberpunk - Edgerunners/S01/S01E01.png'
Any ideas on how to solve this?

This is most likely a permission error. I'm closing this to follow This issue

erickyun commented 9 months ago

I'm tying to run the hide_episode_spoilers script when the plex server runs on a docker container and I get the FileNotFoundError. The error makes sense since it's looking at the directory from the docker configuration, which is a mounted one. Is there a way to make the script work with docker?

For example, using the following docker compose:

  plex:
    image: lscr.io/linuxserver/plex:latest
    container_name: plex
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Mexico_City
      - VERSION=docker
      - PLEX_CLAIM= #optional
    ports:
      - 32400:32400
    restart: unless-stopped
    volumes:
      - /mnt/pool/media/Movies:/movies
      - /mnt/pool/media/Shows:/tv

Then I get the error: FileNotFoundError: [Errno 2] No such file or directory: '/tv/Cyberpunk - Edgerunners/S01/S01E01.mkv'

It is searching for the file on the mounted volume rather than the actual directory. Is it possible to change this behavior?

I found the solution! You need to add the volumes from plex to tautulli too.

      - /mnt/pool/media/Movies:/movies
      - /mnt/pool/media/Shows:/tv
  tautulli:
    image: lscr.io/linuxserver/tautulli:latest
    container_name: tautulli
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Mexico_City
    volumes:
      - ./tautilli/config:/config
      - /mnt/pool/media/Movies:/movies
      - /mnt/pool/media/Shows:/tv
    ports:
      - 8181:8181
    restart: unless-stopped