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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -747,10 +747,11 @@ def process_video_params(query, preferences)
# region ||= preferences.region # region ||= preferences.region
autoplay ||= preferences.autoplay.to_unsafe autoplay ||= preferences.autoplay.to_unsafe
continue ||= preferences.continue.to_unsafe continue ||= preferences.continue.to_unsafe
related_videos ||= preferences.related_videos.to_unsafe
listen ||= preferences.listen.to_unsafe listen ||= preferences.listen.to_unsafe
local ||= preferences.local.to_unsafe
preferred_captions ||= preferences.captions preferred_captions ||= preferences.captions
quality ||= preferences.quality quality ||= preferences.quality
related_videos ||= preferences.related_videos.to_unsafe
speed ||= preferences.speed speed ||= preferences.speed
video_loop ||= preferences.video_loop.to_unsafe video_loop ||= preferences.video_loop.to_unsafe
volume ||= preferences.volume volume ||= preferences.volume
@ -758,10 +759,11 @@ def process_video_params(query, preferences)
autoplay ||= DEFAULT_USER_PREFERENCES.autoplay.to_unsafe autoplay ||= DEFAULT_USER_PREFERENCES.autoplay.to_unsafe
continue ||= DEFAULT_USER_PREFERENCES.continue.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 listen ||= DEFAULT_USER_PREFERENCES.listen.to_unsafe
local ||= DEFAULT_USER_PREFERENCES.local.to_unsafe
preferred_captions ||= DEFAULT_USER_PREFERENCES.captions preferred_captions ||= DEFAULT_USER_PREFERENCES.captions
quality ||= DEFAULT_USER_PREFERENCES.quality quality ||= DEFAULT_USER_PREFERENCES.quality
related_videos ||= DEFAULT_USER_PREFERENCES.related_videos.to_unsafe
speed ||= DEFAULT_USER_PREFERENCES.speed speed ||= DEFAULT_USER_PREFERENCES.speed
video_loop ||= DEFAULT_USER_PREFERENCES.video_loop.to_unsafe video_loop ||= DEFAULT_USER_PREFERENCES.video_loop.to_unsafe
volume ||= DEFAULT_USER_PREFERENCES.volume 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 %>> <input name="continue" id="continue" type="checkbox" <% if preferences.continue %>checked<% end %>>
</div> </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"> <div class="pure-control-group">
<label for="listen"><%= translate(locale, "Listen by default: ") %></label> <label for="listen"><%= translate(locale, "Listen by default: ") %></label>
<input name="listen" id="listen" type="checkbox" <% if preferences.listen %>checked<% end %>> <input name="listen" id="listen" type="checkbox" <% if preferences.listen %>checked<% end %>>