McCloudS / subgen

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

Writing over LRC files in Jellyfin #94

Closed Tyler-Jay-Stevahn closed 4 months ago

Tyler-Jay-Stevahn commented 4 months ago

Full disclosure, this might just be something I am doing wrong.

I was thinking if you added a "If it doesn't exist" piece of code to these lines it should fix it.

""" if isAudioFileExtension(file_extension) and lrc_for_audio_files: write_lrc(result, file_name + '.lrc') """

Into something like below """ if isAudioFileExtension(file_extension) and lrc_for_audio_files: if exists(): # the file already exists pass else: write_lrc(result, file_name + '.lrc') """

McCloudS commented 4 months ago

To be clear, it's overwriting the LRC files every time? If so, I might be missing a check, similar to one I have for SRTs.

McCloudS commented 4 months ago

If my above statement is true, I may have fixed it.

https://github.com/McCloudS/subgen/commit/5b5fba3d82f047cbf3fd216dea92680a3d511bdb

While your implementation would have worked, it still would have ran a transcription (wasting time/resources). This will check before queueing the work.

Tyler-Jay-Stevahn commented 4 months ago

That solution seems like it would work, I'll have to test it later today and get back to you.

Tyler-Jay-Stevahn commented 4 months ago

This solution works. If I wanted to get subtitles in Spanish instead of English, how would I do that?

McCloudS commented 4 months ago

If the source file is in spanish, you would set TRANSCRIBE_OR_TRANSLATE to transcribe. Whisper is only trained to translate to english or transcribe in the source audio.

Tyler-Jay-Stevahn commented 4 months ago

Oh that's a bummer, thanks for letting me know.