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

refactor get_subtitle_sources #136

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zrose584
Copy link
Contributor

'settings.subtitles_language' is now a ',' seperated list of languages
that the user understands.

This allows to eliminate cases in which a translated caption would
be preferred over captions with the native language of the video, even
tough a multilingual user might understand them.

'settings.subtitles_language' is now a ',' seperated list of languages
that the user understands.

This allows to eliminate cases in which a translated caption would
be preferred over captions with the native language of the video, even
tough a multilingual user might understand them.
native_video_lang = None
if info['automatic_caption_languages']:
native_video_lang = info['automatic_caption_languages'][0]

highest_fidelity_is_manual = False
kManual, kNativeVideoLang, kUserSpeaksIt = 1, 2, 4
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be kNativeVideoLang, kManual, kUserSpeaksIt = 1, 2, 4?

Manually created subtitles in a different language than the video are always going to be higher quality than automatically generated ones. Comparing the current scores to the comment at the top of the code with the ideal ordering:

010    native_video_lang (Automatic)
001    foreign_langs (Manual)

110    native_video_lang (Automatic) -> pref_lang
101    foreign_langs (Manual) -> pref_lang
111    native_video_lang (Manual) -> pref_lang

110   pref_lang (Automatic)
111   pref_lang (Manual) (101 if pref_lang != native_video_lang)'''

Swapping the last two bits will fix it

Additionally, these constants should be changed to NATIVE_VIDEO_LANG, MANUAL, etc. to match the convention in the rest of the code that constants are indicated with uppercase snakecase; we dont use hungarian notation in the code.

if len(sources) == 0:
assert len(info['automatic_caption_languages']) == 0 and len(info['manual_caption_languages']) == 0
if settings.video_player == 1: # Plyr
sources[-1]['on'] = True
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we always turning captions on for Plyr only?

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 this pull request may close these issues.

None yet

2 participants