McCloudS / subgen

Autogenerate subtitles using OpenAI Whisper Model via Jellyfin, Plex, Emby, Tautulli, or Bazarr
MIT License
590 stars 50 forks source link

How to do path mapping for TV AND Movies? #125

Open Unspec7 opened 1 day ago

Unspec7 commented 1 day ago

The documentation is very unclear on how to actually use the path mappings if you have multiple paths you need to map. Is it a comma separated list, space separated list, unsupported, documentation is absolutely silent on this issue.

For example, my plex path is /data/media/movies and /data/media/tv. subgen uses /tv and /movies (inside the container). How do I map those paths? Or does the current implementation make the assumption that plex and subgen are hosted on the same machine?

Do I even need path mapping if the actual path is the same outside of the containers? I use a SMB share to share that root data folder to the *arr apps, plex, and subgen to mount into their containers, and so technically inside the containers the paths might be different but in reality they're all accessing the same path outside of the container.

McCloudS commented 1 day ago

Seems pretty clear to me: “Similar to sonarr and radarr path mapping, this will attempt to replace paths on file systems that don't have identical paths. Currently only support for one path replacement. Examples below.”

https://trash-guides.info/Radarr/Tips/Radarr-remote-path-mapping/

If plex and subgen can see the same paths, you don’t need path mapping. In your example, it would probably be from: “/data/media/” to: “/“

Or if you’re using bazarr, you can use the bazarr provider and not even setup the plex side or any of the path mapping.

Unspec7 commented 19 hours ago

Ah, evidently I missed that line since I was focused on reading the PATH_MAPPING_FROM and PATH_MAPPING_TO comments.

I did follow the hardlink guide on trash-guides and all hardlinks are working properly. Couldn't path mapping be entirely done away with/replaced by allowing the /tv and /movie paths for subgen to be customized, in the same way the model path can be customized?

The Bazarr provider does indeed work, but for whatever reason crashes (along with subgen) whenever a transcription attempt begins (subgen reports that it can't find subgen.env), so I was trying to see if Plex was going to trigger the same issue.

McCloudS commented 17 hours ago

I'm not sure what you mean by allowing the /tv and /movie paths for subgen to be customized. No paths are hard-coded, the paths are provided by Plex in the webhook response (if using the Plex implementation) and they merely have to match so Subgen can find the file.

PATH_MAPPING really only exists for light testing. The overall assumption is either: you're using Docker so you can replicate that using Docker mounts or volumes, or that you're running on the same machine and don't need to do any mapping.

The testing I use it for, is my 'development' machine mounts an NFS share, and my Plex is on a different machine.

subgen.env not being found is just a warning, not an error or crash. If you have more info on the crash, or related logs, I can take a look at it.

Unspec7 commented 15 hours ago

Oh, I was under the assumption is hardcoded. That clarifies things.

The error is:

INFO:root:Transcribing file from Bazarr/ASR webhook
INFO:root:Bazarr-asr-Q2k6eX is being handled handled by ASR.
INFO:faster_whisper:Processing audio with duration 01:41:12.960
Traceback (most recent call last):
  File "/subgen/launcher.py", line 170, in <module>
    main()
  File "/subgen/launcher.py", line 165, in main
    subprocess.run([f'{python_cmd}', '-u', 'subgen.py'], check=True)
  File "/usr/local/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['python3', '-u', 'subgen.py']' died with <Signals.SIGKILL: 9>.
subgen.env file not found. Please run prompt_and_save_env_variables() first.
Downloading subgen.py from GitHub branch main...
File downloaded successfully to subgen.py
Launching subgen.py
INFO:root:Subgen v2024.10.1.123
INFO:root:Starting Subgen with listening webhooks!
INFO:root:Transcriptions are limited to running 2 at a time
INFO:root:Running 4 threads per transcription
INFO:root:Using cpu to encode
INFO:root:Using faster-whisper
INFO:     Started server process [7]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:9000 (Press CTRL+C to quit)
INFO:root:Transcribing file from Bazarr/ASR webhook

Ad infinitum.

McCloudS commented 15 hours ago

Sigkill 9 means something is killing the program for any number of reasons. It doesn't appear to be directly tied to Subgen crashing. Could be the linux scheduler, could be lack of resources. Are you running it with appropriate resources (RAM)? At a minimum you need enough to load the model and the file of interest into memory. If I had to guess, it's crashing while loading the model, setting DEBUG to True may give you more fidelity into the issue.

Unspec7 commented 14 hours ago

Debug is the default, which is True.

I have a feeling it is RAM - I am somewhat RAM constrained. Had to RMA my original 32gb set, and running "only" on 16GB for my entire Proxmox setup. I thought 2gb of free ram would be enough, but guess not. Will report back once the 32gb set comes back.