Add 'local' option to preferences

This commit is contained in:
Omar Roth 2019-03-12 21:05:49 -05:00
parent 21ebc398fa
commit e738e57e26
14 changed files with 29 additions and 2 deletions

View file

@ -50,6 +50,7 @@
"Autoplay: ": "تشغيل تلقائى: ",
"Autoplay next video: ": "شغل الفيديو التالى تلقائى: ",
"Listen by default: ": "تشغيل النسخة السمعية تلقائى: ",
"Proxy videos? ": "",
"Default speed: ": "السرعة الإفتراضية: ",
"Preferred video quality: ": "الجودة المفضلة للفيديوهات: ",
"Player volume: ": "صوت المشغل: ",

View file

@ -50,6 +50,7 @@
"Autoplay: ": "Automatisch abspielen: ",
"Autoplay next video: ": "nächstes Video automatisch abspielen: ",
"Listen by default: ": "Nur Ton als Standard: ",
"Proxy videos? ": "",
"Default speed: ": "Standardgeschwindigkeit: ",
"Preferred video quality: ": "Bevorzugte Videoqualität: ",
"Player volume: ": "Playerlautstärke: ",

View file

@ -50,6 +50,7 @@
"Autoplay: ": "Autoplay: ",
"Autoplay next video: ": "Autoplay next video: ",
"Listen by default: ": "Listen by default: ",
"Proxy videos? ": "Proxy videos? ",
"Default speed: ": "Default speed: ",
"Preferred video quality: ": "Preferred video quality: ",
"Player volume: ": "Player volume: ",

View file

@ -50,6 +50,7 @@
"Autoplay: ": "",
"Autoplay next video: ": "",
"Listen by default: ": "",
"Proxy videos? ": "",
"Default speed: ": "",
"Preferred video quality: ": "",
"Player volume: ": "",

View file

@ -50,6 +50,7 @@
"Autoplay: ": "Lire Automatiquement : ",
"Autoplay next video: ": "Lire automatiquement la vidéo suivante : ",
"Listen by default: ": "Audio Uniquement par défaut : ",
"Proxy videos? ": "",
"Default speed: ": "Vitesse par défaut : ",
"Preferred video quality: ": "Qualité vidéo souhaitée : ",
"Player volume: ": "Volume du lecteur : ",

View file

@ -50,6 +50,7 @@
"Autoplay: ": "Riproduzione automatica: ",
"Autoplay next video: ": "Riproduci automaticamente il prossimo video: ",
"Listen by default: ": "Modalità solo audio come predefinita: ",
"Proxy videos? ": "",
"Default speed: ": "Velocità di riproduzione predefinita: ",
"Preferred video quality: ": "Preferenza sulla qualità video: ",
"Player volume: ": "Volume di riproduzione: ",

View file

@ -50,6 +50,7 @@
"Autoplay: ": "Autoavspilling: ",
"Autoplay next video: ": "Autospill neste video: ",
"Listen by default: ": "Lytt som forvalg: ",
"Proxy videos? ": "",
"Default speed: ": "Forvalgt hastighet: ",
"Preferred video quality: ": "Foretrukket videokvalitet: ",
"Player volume: ": "Avspillerlydstyrke: ",

View file

@ -50,6 +50,7 @@
"Autoplay: ": "Automatisch afspelen: ",
"Autoplay next video: ": "Automatisch volgende video afspelen: ",
"Listen by default: ": "Standaard luisteren: ",
"Proxy videos? ": "",
"Default speed: ": "Standaard snelheid: ",
"Preferred video quality: ": "Video kwaliteit voorkeur: ",
"Player volume: ": "Afspeler volume: ",

View file

@ -50,6 +50,7 @@
"Autoplay: ": "Autoodtwarzanie: ",
"Autoplay next video: ": "Odtwórz następny film: ",
"Listen by default: ": "Tryb dźwiękowy: ",
"Proxy videos? ": "",
"Default speed: ": "Domyślna prędkość: ",
"Preferred video quality: ": "Preferowana jakość filmów: ",
"Player volume: ": "Głośność odtwarzacza: ",

View file

@ -50,6 +50,7 @@
"Autoplay: ": "Автовоспроизведение: ",
"Autoplay next video: ": "Автовоспроизведение следующего видео: ",
"Listen by default: ": "Режим \"только аудио\" по-умолчанию: ",
"Proxy videos? ": "",
"Default speed: ": "Скорость по-умолчанию: ",
"Preferred video quality: ": "Предпочтительное качество видео: ",
"Player volume: ": "Громкость воспроизведения: ",

View file

@ -1231,6 +1231,10 @@ post "/preferences" do |env|
listen ||= "off"
listen = listen == "on"
local = env.params.body["local"]?.try &.as(String)
local ||= "off"
local = local == "on"
speed = env.params.body["speed"]?.try &.as(String).to_f?
speed ||= DEFAULT_USER_PREFERENCES.speed
@ -1292,6 +1296,7 @@ post "/preferences" do |env|
"autoplay" => autoplay,
"continue" => continue,
"listen" => listen,
"local" => local,
"speed" => speed,
"quality" => quality,
"volume" => volume,

View file

@ -31,6 +31,7 @@ DEFAULT_USER_PREFERENCES = Preferences.from_json({
"video_loop" => false,
"autoplay" => false,
"continue" => false,
"local" => false,
"listen" => false,
"speed" => 1.0,
"quality" => "hd720",
@ -80,6 +81,10 @@ class Preferences
type: Bool,
default: DEFAULT_USER_PREFERENCES.continue,
},
local: {
type: Bool,
default: DEFAULT_USER_PREFERENCES.local,
},
listen: {
type: Bool,
default: DEFAULT_USER_PREFERENCES.listen,

View file

@ -747,10 +747,11 @@ def process_video_params(query, preferences)
# region ||= preferences.region
autoplay ||= preferences.autoplay.to_unsafe
continue ||= preferences.continue.to_unsafe
related_videos ||= preferences.related_videos.to_unsafe
listen ||= preferences.listen.to_unsafe
local ||= preferences.local.to_unsafe
preferred_captions ||= preferences.captions
quality ||= preferences.quality
related_videos ||= preferences.related_videos.to_unsafe
speed ||= preferences.speed
video_loop ||= preferences.video_loop.to_unsafe
volume ||= preferences.volume
@ -758,10 +759,11 @@ def process_video_params(query, preferences)
autoplay ||= DEFAULT_USER_PREFERENCES.autoplay.to_unsafe
continue ||= DEFAULT_USER_PREFERENCES.continue.to_unsafe
related_videos ||= DEFAULT_USER_PREFERENCES.related_videos.to_unsafe
listen ||= DEFAULT_USER_PREFERENCES.listen.to_unsafe
local ||= DEFAULT_USER_PREFERENCES.local.to_unsafe
preferred_captions ||= DEFAULT_USER_PREFERENCES.captions
quality ||= DEFAULT_USER_PREFERENCES.quality
related_videos ||= DEFAULT_USER_PREFERENCES.related_videos.to_unsafe
speed ||= DEFAULT_USER_PREFERENCES.speed
video_loop ||= DEFAULT_USER_PREFERENCES.video_loop.to_unsafe
volume ||= DEFAULT_USER_PREFERENCES.volume

View file

@ -28,6 +28,11 @@ function update_value(element) {
<input name="continue" id="continue" type="checkbox" <% if preferences.continue %>checked<% end %>>
</div>
<div class="pure-control-group">
<label for="local"><%= translate(locale, "Proxy videos? ") %></label>
<input name="local" id="local" type="checkbox" <% if preferences.local %>checked<% end %>>
</div>
<div class="pure-control-group">
<label for="listen"><%= translate(locale, "Listen by default: ") %></label>
<input name="listen" id="listen" type="checkbox" <% if preferences.listen %>checked<% end %>>