Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtitle filenames have language code appended after .srt file extension #22

Open
joelpurra opened this issue Oct 11, 2024 · 3 comments · May be fixed by #23
Open

Subtitle filenames have language code appended after .srt file extension #22

joelpurra opened this issue Oct 11, 2024 · 3 comments · May be fixed by #23

Comments

@joelpurra
Copy link

joelpurra commented Oct 11, 2024

@berkanteber wrote (#17 (comment)):

3.1.0 has just been approved (for Nexus and above). This should improve subtitle language identification.

The subtitle filename now (https://github.com/putdotio/putio-kodi/releases/tag/v3.1.0) has the language code/shortname appended, but it is appended after the .srt file extension. This makes "srt" part of the subtitle "name" as parsed by Kodi. In general, it also breaks filename-based file type detection

Example:

  • Video Name.srt - eng
  • English - Video Name - srt (External).
@berkanteber
Copy link
Member

berkanteber commented Oct 11, 2024

In general, it also breaks filename-based file type detection

What do you mean by this?

@joelpurra
Copy link
Author

joelpurra commented Oct 11, 2024

In general, it also breaks filename-based file type detection

What do you mean by this?

I mean that it changes the filename's file extension. Video Name.srt - eng (incorrect extension) has a different file extension type from Video Name - eng.srt (SubRip Text (SRT) subtitle file; correct).

- Video Name.srt - eng
+ Video Name - eng.srt

May or may not matter to Kodi, because Kodi gets "told" it's a subtitle file (https://github.com/putdotio/putio-kodi/blob/v3.1.0/main.py#L135), but I certainly consider it a bug.

tree ~/.kodi/temp/plugin.video.putio
~/.kodi/temp/plugin.video.putio
└── subtitles
    └── 0000000000
        ├── abc_de
        │   └── Video Name.srt - eng
        ...

@berkanteber
Copy link
Member

berkanteber commented Oct 11, 2024

Got it.

We have 3 types of subtitles:

  • Folder subtitles: We look at current directory for a .srt file. So, name always have extension. We don't detect language for these, always unknown.
  • File subtitles: We extract these from file and save as ...-{lang}.srt. So, name always have extension and language code. {lang} here is how it is tagged in MKV, so may be improper (seems < 0.2%).
  • OpenSubtitles subtitles: These always have .srt extension. Name can include language code (depends how it's uploaded), but we have language code separately.

What are your thought on when we should append language code?

I think:

  • In cases we have language we append language. It's simple and shown name is always the actual subtitle name (minus extension). If name has right/wrong language in it, it stays in the name.
  • For folder subtitles we append und except name has explicit language in form {name}.{lang}.srt. Identifying the language wrong is IMO worse than saying Unknown. I saw this with a HI (hearing impaired) subtitle identified as Hindi. It also matches the behavior of our other apps (currently always marked Unknown without exception).
  • In all cases, make the filename {name}.{lang}.srt.

@berkanteber berkanteber changed the title Subtitle filenames have langauge code appended after .srt file extension Subtitle filenames have language code appended after .srt file extension Oct 11, 2024
@berkanteber berkanteber linked a pull request Oct 11, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants