aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/watch.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-07-13 16:54:33 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-07-13 16:54:33 -0700
commitcccffb83544fec8d3297d57ea36aef307616ac95 (patch)
tree1c1af6fdd1f547be216f6476304ec519177cad66 /youtube/watch.py
parent12382d5205fa3ba38f0dad8df8e4fc266ba01f29 (diff)
downloadyt-local-cccffb83544fec8d3297d57ea36aef307616ac95.tar.lz
yt-local-cccffb83544fec8d3297d57ea36aef307616ac95.tar.xz
yt-local-cccffb83544fec8d3297d57ea36aef307616ac95.zip
language settings and default-mode settings for subtitles
Diffstat (limited to 'youtube/watch.py')
-rw-r--r--youtube/watch.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/youtube/watch.py b/youtube/watch.py
index 47e9894..9d493af 100644
--- a/youtube/watch.py
+++ b/youtube/watch.py
@@ -7,6 +7,7 @@ import youtube.common as common
from youtube.common import default_multi_get, get_thumbnail_url, video_id, URL_ORIGIN
import youtube.comments as comments
import gevent
+import settings
video_height_priority = (360, 480, 240, 720, 1080)
@@ -252,17 +253,17 @@ def subtitles_html(info):
for language, formats in info['subtitles'].items():
for format in formats:
if format['ext'] == 'vtt':
- if language == "en":
+ if language == settings.subtitles_language:
default_found = True
result += subtitles_tag_template.substitute(
src = html.escape('/' + format['url']),
label = html.escape(language),
srclang = html.escape(language),
- default = 'default' if language == 'en' else '',
+ default = 'default' if language == settings.subtitles_language and settings.subtitles_mode > 0 else '',
)
break
try:
- formats = info['automatic_captions']['en']
+ formats = info['automatic_captions'][settings.subtitles_language]
except KeyError:
pass
else:
@@ -270,9 +271,9 @@ def subtitles_html(info):
if format['ext'] == 'vtt':
result += subtitles_tag_template.substitute(
src = html.escape('/' + format['url']),
- label = 'en' + ' - Automatic',
- srclang = 'en',
- default = '' if default_found else 'default',
+ label = settings.subtitles_language + ' - Automatic',
+ srclang = settings.subtitles_language,
+ default = 'default' if settings.subtitles_mode == 2 and not default_found else '',
)
return result