McCloudS / subgen

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

typo in docker-compose.yml for jellyfin #30

Closed ndx1905-github closed 9 months ago

ndx1905-github commented 9 months ago

Hi

I'm trying to make it work with jellyfin but to no avail until now

I noticed a typo in the docker-compose.yml as one of the parameters is spelled JELYFINTOKEN instead of JELLYFINTOKEN (missing L)

This makes me think no one actually tried the jellyfin implementation yet. Has anyone tested successfully that it works?

I've corrected locally the typo. I have a working jellyfin server in one docker, a working subgen docker built with the corrected yml, and logs show that the unicorn server launches and waits for the web hook, but then nothing happens. The dockers both can be reach with their LAN address.

Thanks!

McCloudS commented 9 months ago

Jellyfin does work, I just don’t use docker-compose right now, so just an oversight on my part on the type. If you aren’t seeing any action, enable debug and try adding/playing files and see if anything pops up.

On Sun, Nov 19, 2023 at 2:20 PM ndx1905-github @.***> wrote:

Hi

I'm trying to make it work with jellyfin but to no avail until now

I noticed a typo in the docker-compose.yml as one of the parameters is spelled JELYFINTOKEN instead of JELLYFINTOKEN (missing L)

This makes me think no one actually tried the jellyfin implementation yet. Has anyone tested successfully that it works?

I've corrected locally the typo. I have a working jellyfin server in one docker, a working subgen docker built with the corrected yml, and logs show that the unicorn server launches and waits for the web hook, but then nothing happens. The dockers both can be reach with their LAN address.

Thanks!

— Reply to this email directly, view it on GitHub https://github.com/McCloudS/subgen/issues/30, or unsubscribe https://github.com/notifications/unsubscribe-auth/APJACQPLZQKETJ6DFXTBTTTYFJZZXAVCNFSM6AAAAAA7SAEGU2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYDCMBUGE4TMNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

McCloudS commented 9 months ago

I guess I’ll caveat it that Jellyfin worked when I implemented it a couple weeks ago. If they changed any of their API that is used, it could break.

ndx1905-github commented 9 months ago

thanks for the quick answer. My guess is I did something wrong, rather than a change of API..

I guess my problem is I have two containers Jellyfin has an internal docker ip 172.17.0.2 + docker gateway 172.17.0.1 and a LAN ip/port of 192.168.1.91:8096 Subgen has an internal docker ip 172.19.0.2 + docker gateway 172.19.0.1 and a LAN ip/port of 192.168.1.91:8090

Webhook log on jellyfin reports [2023-11-19 21:33:57.091 +00:00] [WRN] [11] Jellyfin.Server.Middleware.ResponseTimeMiddleware: Slow HTTP Response from "http://192.168.1.91:8096/Sessions/Capabilities/Full" to "172.17.0.1" in 0:00:00.510932 with Status Code 204

I'd want that to be sent to 192.168.1.91:8090/jellyfin

McCloudS commented 9 months ago

Assuming your Jellyfin and subgen can reach each other, that is the correct endpoint to use for subgen. Have you tried pinging the containers from each other?

To be honest, I have a knowledge gap in networking. All of my dockers are in the same bridge/subnet, but that should be transparent if the ports are mapped correctly.

Does debug on subgen show anything interesting?

I’m away for thanksgiving, so my troubleshooting capability is near zero.

ndx1905-github commented 9 months ago

Hey so I've done some changes, made sure the containers can ping each other. At some point it probably worked because the whisper model was downloaded. There was an error in the logs and my interpretation was that maybe one container could reach the other but that the opposite was not true.

That's when I decided I would simplify and would copy what you were doing since it worked, so I put both containers in the same bridge/subnet.

Now.. I see the webhooks notifications, subgen is aware of what jellyfin is doing when I play or add a file.. but I don't see the uvicorn start notification in the logs :/ http://0.0.0.0:8090 is not there

date | stream | content
2023/11/19 23:54:32 | stdout | INFO:     172.17.0.2:51392 - "POST /jellyfin HTTP/1.1" 200 OK
2023/11/19 23:54:32 | stdout | DEBUG:root:itemid is: ca34ecaf0712615e2022ab3c1aafa078
2023/11/19 23:54:32 | stdout | DEBUG:root:Jellyfin event detected is: PlaybackStart
2023/11/19 23:54:29 | stdout | INFO:     172.17.0.2:51392 - "POST /jellyfin HTTP/1.1" 200 OK
2023/11/19 23:54:29 | stdout | DEBUG:root:itemid is: ca34ecaf0712615e2022ab3c1aafa078
2023/11/19 23:54:29 | stdout | DEBUG:root:Jellyfin event detected is: PlaybackStart
2023/11/19 23:54:00 | stdout | INFO:     172.17.0.1:41560 - "GET / HTTP/1.1" 404 Not Found
2023/11/19 23:50:49 | stdout | INFO:     Application startup complete.
2023/11/19 23:50:49 | stdout | INFO:     Waiting for application startup.
2023/11/19 23:50:49 | stdout | INFO:     Started server process [35]
2023/11/19 23:50:49 | stdout | Starting webhook!
2023/11/19 23:50:49 | stdout | Running 2 threads per transcription
2023/11/19 23:50:49 | stdout | Transcriptions are limited to running 2 at a time

Now they both have 172.17.0.1 as a docker ip gateway ip for jellyfin is 172.17.0.2 ip for subgen is 172.17.0.3

jellyfin can still be reached with the LAN address of the docker host at 192.168.1.91:8096 while subgen is still available at 192.168.1.91:8090 too

Any guess ?

McCloudS commented 9 months ago

What do you have procmediaonplay set to? Your flow appears to be getting stuck on line 147 to see if it should actually do anything. It looks like Jellyfin sent the webhook correctly and subgen received it, but subgen didnt query Jellyfin for the file path.

Or you have your Jellyfin up/token setup incorrectly?

ndx1905-github commented 9 months ago

okay sorry for the long delay, I've reinstalled everything from the start to make sure there wasn't any change left in the dockers or files. It... almost worked. I mean your code worked 👍 but two things didn't work.

Image JPEG-422B-88DD-C7-0

But then.... I noticed RAM and CPU usage slowed down to an idle state without any error in the logs nor notification. The process of translation never stopped.

Also during my various attempts I noticed that some files audio were wrongly detected as English instead of French.

Long story short, I'm continuing tweaking and haven't managed to have a successful translation yet.

I'll update more soon

ndx1905-github commented 9 months ago

So after 2 reinstalls I can say it works I had tampered with number of threads and concurrent transcription to have lower number since it's working on a very small cpu with no gpu (Synology ds718) and other services running at the same time. If I leave it as is it works. It's probably not optimized but It works. For reference, on a DS718 NAS it takes 3 hours to produce the subtitles of a 1 hour show.

Thanks for the discussion.

+1 for a web interface to decide which jobs to start instead of a webhook