Add annotation preferences

pull/303/head
Omar Roth 6 years ago
parent e48a000784
commit 56fe3ede5b

@ -65,10 +65,12 @@
"Default captions: ": "الترجمات الإفتراضية: ", "Default captions: ": "الترجمات الإفتراضية: ",
"Fallback captions: ": "الترجمات المصاحبة: ", "Fallback captions: ": "الترجمات المصاحبة: ",
"Show related videos? ": "عرض مقاطع الفيديو ذات الصلة؟", "Show related videos? ": "عرض مقاطع الفيديو ذات الصلة؟",
"Show annotations by default? ": "",
"Visual preferences": "التفضيلات المرئية", "Visual preferences": "التفضيلات المرئية",
"Dark mode: ": "الوضع الليلى: ", "Dark mode: ": "الوضع الليلى: ",
"Thin mode: ": "الوضع الخفيف: ", "Thin mode: ": "الوضع الخفيف: ",
"Subscription preferences": "تفضيلات الإشتراك", "Subscription preferences": "تفضيلات الإشتراك",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "إعادة التوجية من الصفحة الرئيسية لصفحة المشتركين (لرؤية اخر فيديوهات المشتركين): ", "Redirect homepage to feed: ": "إعادة التوجية من الصفحة الرئيسية لصفحة المشتركين (لرؤية اخر فيديوهات المشتركين): ",
"Number of videos shown in feed: ": "عدد الفيديوهات التى ستظهر فى صفحة المشتركين: ", "Number of videos shown in feed: ": "عدد الفيديوهات التى ستظهر فى صفحة المشتركين: ",
"Sort videos by: ": "ترتيب الفيديو بـ: ", "Sort videos by: ": "ترتيب الفيديو بـ: ",
@ -118,6 +120,8 @@
"Trending": "الشائع", "Trending": "الشائع",
"Unlisted": "غير مصنف", "Unlisted": "غير مصنف",
"Watch on YouTube": "مشاهدة الفيديو على اليوتيوب", "Watch on YouTube": "مشاهدة الفيديو على اليوتيوب",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "النوع: ", "Genre: ": "النوع: ",
"License: ": "التراخيص: ", "License: ": "التراخيص: ",
"Family friendly? ": "محتوى عائلى? ", "Family friendly? ": "محتوى عائلى? ",

@ -65,10 +65,12 @@
"Default captions: ": "Standarduntertitel: ", "Default captions: ": "Standarduntertitel: ",
"Fallback captions: ": "Ersatzuntertitel: ", "Fallback captions: ": "Ersatzuntertitel: ",
"Show related videos? ": "Ähnliche Videos anzeigen? ", "Show related videos? ": "Ähnliche Videos anzeigen? ",
"Show annotations by default? ": "",
"Visual preferences": "Anzeigeeinstellungen", "Visual preferences": "Anzeigeeinstellungen",
"Dark mode: ": "Nachtmodus: ", "Dark mode: ": "Nachtmodus: ",
"Thin mode: ": "Schlanker Modus: ", "Thin mode: ": "Schlanker Modus: ",
"Subscription preferences": "Abonnementeinstellungen", "Subscription preferences": "Abonnementeinstellungen",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Startseite zu Feed umleiten: ", "Redirect homepage to feed: ": "Startseite zu Feed umleiten: ",
"Number of videos shown in feed: ": "Anzahl von Videos die im Feed angezeigt werden: ", "Number of videos shown in feed: ": "Anzahl von Videos die im Feed angezeigt werden: ",
"Sort videos by: ": "Videos sortieren nach: ", "Sort videos by: ": "Videos sortieren nach: ",
@ -118,6 +120,8 @@
"Trending": "Trending", "Trending": "Trending",
"Unlisted": "", "Unlisted": "",
"Watch on YouTube": "Video auf YouTube ansehen", "Watch on YouTube": "Video auf YouTube ansehen",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Genre: ", "Genre: ": "Genre: ",
"License: ": "Lizenz: ", "License: ": "Lizenz: ",
"Family friendly? ": "Familienfreundlich? ", "Family friendly? ": "Familienfreundlich? ",

@ -71,10 +71,12 @@
"Default captions: ": "Default captions: ", "Default captions: ": "Default captions: ",
"Fallback captions: ": "Fallback captions: ", "Fallback captions: ": "Fallback captions: ",
"Show related videos? ": "Show related videos? ", "Show related videos? ": "Show related videos? ",
"Show annotations by default? ": "Show annotations by default? ",
"Visual preferences": "Visual preferences", "Visual preferences": "Visual preferences",
"Dark mode: ": "Dark mode: ", "Dark mode: ": "Dark mode: ",
"Thin mode: ": "Thin mode: ", "Thin mode: ": "Thin mode: ",
"Subscription preferences": "Subscription preferences", "Subscription preferences": "Subscription preferences",
"Show annotations by default for subscribed channels? ": "Show annotations by default for subscribed channels? ",
"Redirect homepage to feed: ": "Redirect homepage to feed: ", "Redirect homepage to feed: ": "Redirect homepage to feed: ",
"Number of videos shown in feed: ": "Number of videos shown in feed: ", "Number of videos shown in feed: ": "Number of videos shown in feed: ",
"Sort videos by: ": "Sort videos by: ", "Sort videos by: ": "Sort videos by: ",
@ -133,6 +135,8 @@
"Trending": "Trending", "Trending": "Trending",
"Unlisted": "Unlisted", "Unlisted": "Unlisted",
"Watch on YouTube": "Watch on YouTube", "Watch on YouTube": "Watch on YouTube",
"Hide annotations": "Hide annotations",
"Show annotations": "Show annotations",
"Genre: ": "Genre: ", "Genre: ": "Genre: ",
"License: ": "License: ", "License: ": "License: ",
"Family friendly? ": "Family friendly? ", "Family friendly? ": "Family friendly? ",

@ -65,10 +65,12 @@
"Default captions: ": "Defaŭltaj subtekstoj: ", "Default captions: ": "Defaŭltaj subtekstoj: ",
"Fallback captions: ": "Retrodefaŭltaj subtekstoj: ", "Fallback captions: ": "Retrodefaŭltaj subtekstoj: ",
"Show related videos? ": "Ĉu montri rilatajn videojn? ", "Show related videos? ": "Ĉu montri rilatajn videojn? ",
"Show annotations by default? ": "",
"Visual preferences": "Vidaj preferoj", "Visual preferences": "Vidaj preferoj",
"Dark mode: ": "Malhela reĝimo: ", "Dark mode: ": "Malhela reĝimo: ",
"Thin mode: ": "Maldika reĝimo: ", "Thin mode: ": "Maldika reĝimo: ",
"Subscription preferences": "Abonaj agordoj", "Subscription preferences": "Abonaj agordoj",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Alidirekti hejmpâgon al fluo: ", "Redirect homepage to feed: ": "Alidirekti hejmpâgon al fluo: ",
"Number of videos shown in feed: ": "Nombro da videoj montritaj en fluo: ", "Number of videos shown in feed: ": "Nombro da videoj montritaj en fluo: ",
"Sort videos by: ": "Ordi videojn laŭ: ", "Sort videos by: ": "Ordi videojn laŭ: ",
@ -118,6 +120,8 @@
"Trending": "Tendencoj", "Trending": "Tendencoj",
"Unlisted": "Ne listigita", "Unlisted": "Ne listigita",
"Watch on YouTube": "Vidi videon en Youtube", "Watch on YouTube": "Vidi videon en Youtube",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Ĝenro: ", "Genre: ": "Ĝenro: ",
"License: ": "Licenco: ", "License: ": "Licenco: ",
"Family friendly? ": "Ĉu familie amika? ", "Family friendly? ": "Ĉu familie amika? ",

@ -65,10 +65,12 @@
"Default captions: ": "Subtítulos por defecto: ", "Default captions: ": "Subtítulos por defecto: ",
"Fallback captions: ": "Subtítulos alternativos: ", "Fallback captions: ": "Subtítulos alternativos: ",
"Show related videos? ": "¿Mostrar vídeos relacionados? ", "Show related videos? ": "¿Mostrar vídeos relacionados? ",
"Show annotations by default? ": "",
"Visual preferences": "Preferencias visuales", "Visual preferences": "Preferencias visuales",
"Dark mode: ": "Modo oscuro: ", "Dark mode: ": "Modo oscuro: ",
"Thin mode: ": "Modo compacto: ", "Thin mode: ": "Modo compacto: ",
"Subscription preferences": "Preferencias de la suscripción", "Subscription preferences": "Preferencias de la suscripción",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Redirigir la página de inicio a la fuente: ", "Redirect homepage to feed: ": "Redirigir la página de inicio a la fuente: ",
"Number of videos shown in feed: ": "Número de vídeos mostrados en la fuente: ", "Number of videos shown in feed: ": "Número de vídeos mostrados en la fuente: ",
"Sort videos by: ": "Ordenar los vídeos por: ", "Sort videos by: ": "Ordenar los vídeos por: ",
@ -118,6 +120,8 @@
"Trending": "Tendencias", "Trending": "Tendencias",
"Unlisted": "No listado", "Unlisted": "No listado",
"Watch on YouTube": "Ver el vídeo en Youtube", "Watch on YouTube": "Ver el vídeo en Youtube",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Género: ", "Genre: ": "Género: ",
"License: ": "Licencia: ", "License: ": "Licencia: ",
"Family friendly? ": "¿Filtrar contenidos? ", "Family friendly? ": "¿Filtrar contenidos? ",

@ -65,10 +65,12 @@
"Default captions: ": "", "Default captions: ": "",
"Fallback captions: ": "", "Fallback captions: ": "",
"Show related videos? ": "", "Show related videos? ": "",
"Show annotations by default? ": "",
"Visual preferences": "", "Visual preferences": "",
"Dark mode: ": "", "Dark mode: ": "",
"Thin mode: ": "", "Thin mode: ": "",
"Subscription preferences": "", "Subscription preferences": "",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "", "Redirect homepage to feed: ": "",
"Number of videos shown in feed: ": "", "Number of videos shown in feed: ": "",
"Sort videos by: ": "", "Sort videos by: ": "",
@ -118,6 +120,8 @@
"Trending": "", "Trending": "",
"Unlisted": "", "Unlisted": "",
"Watch on YouTube": "", "Watch on YouTube": "",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "", "Genre: ": "",
"License: ": "", "License: ": "",
"Family friendly? ": "", "Family friendly? ": "",

@ -65,10 +65,12 @@
"Default captions: ": "Sous-titres par défaut : ", "Default captions: ": "Sous-titres par défaut : ",
"Fallback captions: ": "Fallback captions: ", "Fallback captions: ": "Fallback captions: ",
"Show related videos? ": "Voir les vidéos liées ? ", "Show related videos? ": "Voir les vidéos liées ? ",
"Show annotations by default? ": "",
"Visual preferences": "Préférences du site", "Visual preferences": "Préférences du site",
"Dark mode: ": "Mode Sombre : ", "Dark mode: ": "Mode Sombre : ",
"Thin mode: ": "Mode Simplifié : ", "Thin mode: ": "Mode Simplifié : ",
"Subscription preferences": "Préférences de la page d'abonnements", "Subscription preferences": "Préférences de la page d'abonnements",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Rediriger la page d'accueil vers la page d'abonnements : ", "Redirect homepage to feed: ": "Rediriger la page d'accueil vers la page d'abonnements : ",
"Number of videos shown in feed: ": "Nombre de vidéos montrées dans la page d'abonnements : ", "Number of videos shown in feed: ": "Nombre de vidéos montrées dans la page d'abonnements : ",
"Sort videos by: ": "Trier les vidéos par : ", "Sort videos by: ": "Trier les vidéos par : ",
@ -118,6 +120,8 @@
"Trending": "Tendances", "Trending": "Tendances",
"Unlisted": "Non répertoriée", "Unlisted": "Non répertoriée",
"Watch on YouTube": "Voir la vidéo sur Youtube", "Watch on YouTube": "Voir la vidéo sur Youtube",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Genre : ", "Genre: ": "Genre : ",
"License: ": "Licence : ", "License: ": "Licence : ",
"Family friendly? ": "Tout Public ? ", "Family friendly? ": "Tout Public ? ",

@ -65,10 +65,12 @@
"Default captions: ": "Sottotitoli predefiniti: ", "Default captions: ": "Sottotitoli predefiniti: ",
"Fallback captions: ": "Sottotitoli alternativi: ", "Fallback captions: ": "Sottotitoli alternativi: ",
"Show related videos? ": "Mostra video correlati? ", "Show related videos? ": "Mostra video correlati? ",
"Show annotations by default? ": "",
"Visual preferences": "Preferenze grafiche", "Visual preferences": "Preferenze grafiche",
"Dark mode: ": "Tema scuro: ", "Dark mode: ": "Tema scuro: ",
"Thin mode: ": "Modalità per connessioni lente: ", "Thin mode: ": "Modalità per connessioni lente: ",
"Subscription preferences": "Preferenze iscrizioni", "Subscription preferences": "Preferenze iscrizioni",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Reindirizza la pagina principale a quella delle iscrizioni: ", "Redirect homepage to feed: ": "Reindirizza la pagina principale a quella delle iscrizioni: ",
"Number of videos shown in feed: ": "Numero di video da mostrare nelle iscrizioni: ", "Number of videos shown in feed: ": "Numero di video da mostrare nelle iscrizioni: ",
"Sort videos by: ": "Ordinare i video per: ", "Sort videos by: ": "Ordinare i video per: ",
@ -118,6 +120,8 @@
"Trending": "Tendenze", "Trending": "Tendenze",
"Unlisted": "", "Unlisted": "",
"Watch on YouTube": "Guarda il video su YouTube", "Watch on YouTube": "Guarda il video su YouTube",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Genere: ", "Genre: ": "Genere: ",
"License: ": "Licenza: ", "License: ": "Licenza: ",
"Family friendly? ": "Per tutti? ", "Family friendly? ": "Per tutti? ",

@ -65,10 +65,12 @@
"Default captions: ": "Forvalgte undertitler: ", "Default captions: ": "Forvalgte undertitler: ",
"Fallback captions: ": "Tilbakefallsundertitler: ", "Fallback captions: ": "Tilbakefallsundertitler: ",
"Show related videos? ": "Vis relaterte videoer? ", "Show related videos? ": "Vis relaterte videoer? ",
"Show annotations by default? ": "",
"Visual preferences": "Visuelle innstillinger", "Visual preferences": "Visuelle innstillinger",
"Dark mode: ": "Mørk drakt: ", "Dark mode: ": "Mørk drakt: ",
"Thin mode: ": "Tynt modus: ", "Thin mode: ": "Tynt modus: ",
"Subscription preferences": "Abonnementsinnstillinger", "Subscription preferences": "Abonnementsinnstillinger",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Videresend hjemmeside til flyt: ", "Redirect homepage to feed: ": "Videresend hjemmeside til flyt: ",
"Number of videos shown in feed: ": "Antall videoer å vise i flyt: ", "Number of videos shown in feed: ": "Antall videoer å vise i flyt: ",
"Sort videos by: ": "Sorter videoer etter: ", "Sort videos by: ": "Sorter videoer etter: ",
@ -118,6 +120,8 @@
"Trending": "Trendsettende", "Trending": "Trendsettende",
"Unlisted": "Ulistet", "Unlisted": "Ulistet",
"Watch on YouTube": "Vis video på YouTube", "Watch on YouTube": "Vis video på YouTube",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Sjanger: ", "Genre: ": "Sjanger: ",
"License: ": "Lisens: ", "License: ": "Lisens: ",
"Family friendly? ": "Familievennlig? ", "Family friendly? ": "Familievennlig? ",

@ -65,10 +65,12 @@
"Default captions: ": "Standaard ondertitels: ", "Default captions: ": "Standaard ondertitels: ",
"Fallback captions: ": "Alternatieve ondertitels: ", "Fallback captions: ": "Alternatieve ondertitels: ",
"Show related videos? ": "Laat gerelateerde videos zien? ", "Show related videos? ": "Laat gerelateerde videos zien? ",
"Show annotations by default? ": "",
"Visual preferences": "Visuele voorkeuren", "Visual preferences": "Visuele voorkeuren",
"Dark mode: ": "Donkere modus: ", "Dark mode: ": "Donkere modus: ",
"Thin mode: ": "Smalle modus: ", "Thin mode: ": "Smalle modus: ",
"Subscription preferences": "Abonnement voorkeuren", "Subscription preferences": "Abonnement voorkeuren",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Startpagina omleiden naar feed: ", "Redirect homepage to feed: ": "Startpagina omleiden naar feed: ",
"Number of videos shown in feed: ": "Aantal videos te zien in feed: ", "Number of videos shown in feed: ": "Aantal videos te zien in feed: ",
"Sort videos by: ": "Sorteer videos op: ", "Sort videos by: ": "Sorteer videos op: ",
@ -118,6 +120,8 @@
"Trending": "Trending", "Trending": "Trending",
"Unlisted": "", "Unlisted": "",
"Watch on YouTube": "Bekijk video op Youtube", "Watch on YouTube": "Bekijk video op Youtube",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Genre: ", "Genre: ": "Genre: ",
"License: ": "Licentie: ", "License: ": "Licentie: ",
"Family friendly? ": "Gezinsvriendelijk? ", "Family friendly? ": "Gezinsvriendelijk? ",

@ -65,10 +65,12 @@
"Default captions: ": "Domyślne napisy: ", "Default captions: ": "Domyślne napisy: ",
"Fallback captions: ": "Zastępcze napisy: ", "Fallback captions: ": "Zastępcze napisy: ",
"Show related videos? ": "Pokaż powiązane filmy? ", "Show related videos? ": "Pokaż powiązane filmy? ",
"Show annotations by default? ": "",
"Visual preferences": "Preferencje Wizualne", "Visual preferences": "Preferencje Wizualne",
"Dark mode: ": "Ciemny motyw: ", "Dark mode: ": "Ciemny motyw: ",
"Thin mode: ": "Tryb minimalny: ", "Thin mode: ": "Tryb minimalny: ",
"Subscription preferences": "Preferencje subskrybcji", "Subscription preferences": "Preferencje subskrybcji",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Przekieruj stronę główną do subskrybcji: ", "Redirect homepage to feed: ": "Przekieruj stronę główną do subskrybcji: ",
"Number of videos shown in feed: ": "Liczba filmów widoczna na stronie subskrybcji: ", "Number of videos shown in feed: ": "Liczba filmów widoczna na stronie subskrybcji: ",
"Sort videos by: ": "Sortuj filmy: ", "Sort videos by: ": "Sortuj filmy: ",
@ -118,6 +120,8 @@
"Trending": "Na czasie", "Trending": "Na czasie",
"Unlisted": "", "Unlisted": "",
"Watch on YouTube": "Zobacz film na YouTube", "Watch on YouTube": "Zobacz film na YouTube",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Gatunek: ", "Genre: ": "Gatunek: ",
"License: ": "Licencja: ", "License: ": "Licencja: ",
"Family friendly? ": "Przyjazny rodzinie? ", "Family friendly? ": "Przyjazny rodzinie? ",

@ -65,10 +65,12 @@
"Default captions: ": "Субтитры по умолчанию: ", "Default captions: ": "Субтитры по умолчанию: ",
"Fallback captions: ": "Резервные субтитры: ", "Fallback captions: ": "Резервные субтитры: ",
"Show related videos? ": "Показывать похожие видео? ", "Show related videos? ": "Показывать похожие видео? ",
"Show annotations by default? ": "",
"Visual preferences": "Визуальные настройки", "Visual preferences": "Визуальные настройки",
"Dark mode: ": "Темная тема: ", "Dark mode: ": "Темная тема: ",
"Thin mode: ": "Облегченный режим: ", "Thin mode: ": "Облегченный режим: ",
"Subscription preferences": "Настройки подписок", "Subscription preferences": "Настройки подписок",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Отображать ленту вместо главной страницы: ", "Redirect homepage to feed: ": "Отображать ленту вместо главной страницы: ",
"Number of videos shown in feed: ": "Число видео в ленте: ", "Number of videos shown in feed: ": "Число видео в ленте: ",
"Sort videos by: ": "Сортировать видео по: ", "Sort videos by: ": "Сортировать видео по: ",
@ -118,6 +120,8 @@
"Trending": "В тренде", "Trending": "В тренде",
"Unlisted": "Доступно по ссылке", "Unlisted": "Доступно по ссылке",
"Watch on YouTube": "Смотреть на YouTube", "Watch on YouTube": "Смотреть на YouTube",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Жанр: ", "Genre: ": "Жанр: ",
"License: ": "Лицензия: ", "License: ": "Лицензия: ",
"Family friendly? ": "Семейный просмотр: ", "Family friendly? ": "Семейный просмотр: ",

@ -65,10 +65,12 @@
"Default captions: ": "Основна мова субтитрів: ", "Default captions: ": "Основна мова субтитрів: ",
"Fallback captions: ": "Запасна мова субтитрів: ", "Fallback captions: ": "Запасна мова субтитрів: ",
"Show related videos? ": "Показувати схожі відео? ", "Show related videos? ": "Показувати схожі відео? ",
"Show annotations by default? ": "",
"Visual preferences": "Налаштування сайту", "Visual preferences": "Налаштування сайту",
"Dark mode: ": "Темне оформлення: ", "Dark mode: ": "Темне оформлення: ",
"Thin mode: ": "Полегшене оформлення: ", "Thin mode: ": "Полегшене оформлення: ",
"Subscription preferences": "Налаштування підписок", "Subscription preferences": "Налаштування підписок",
"Show annotations by default for subscribed channels? ": "",
"Redirect homepage to feed: ": "Показувати відео з каналів, на які підписані, як головну сторінку: ", "Redirect homepage to feed: ": "Показувати відео з каналів, на які підписані, як головну сторінку: ",
"Number of videos shown in feed: ": "Кількість відео з каналів, на які підписані, у потоці: ", "Number of videos shown in feed: ": "Кількість відео з каналів, на які підписані, у потоці: ",
"Sort videos by: ": "Сортувати відео: ", "Sort videos by: ": "Сортувати відео: ",
@ -118,6 +120,8 @@
"Trending": "У тренді", "Trending": "У тренді",
"Unlisted": "Відсутнє у листі", "Unlisted": "Відсутнє у листі",
"Watch on YouTube": "Дивитися відео на YouTube", "Watch on YouTube": "Дивитися відео на YouTube",
"Hide annotations": "",
"Show annotations": "",
"Genre: ": "Жанр: ", "Genre: ": "Жанр: ",
"License: ": "Ліцензія: ", "License: ": "Ліцензія: ",
"Family friendly? ": "Перегляд із родиною? ", "Family friendly? ": "Перегляд із родиною? ",

@ -338,8 +338,8 @@ get "/watch" do |env|
preferences = env.get("preferences").as(Preferences) preferences = env.get("preferences").as(Preferences)
if env.get? "user" user = env.get?("user").try &.as(User)
user = env.get("user").as(User) if user
subscriptions = user.subscriptions subscriptions = user.subscriptions
watched = user.watched watched = user.watched
end end
@ -347,9 +347,10 @@ get "/watch" do |env|
params = process_video_params(env.params.query, preferences) params = process_video_params(env.params.query, preferences)
env.params.query.delete_all("listen") env.params.query.delete_all("listen")
env.params.query.delete_all("iv_load_policy")
begin begin
video = get_video(id, PG_DB, proxies, region: params[:region]) video = get_video(id, PG_DB, proxies, region: params.region)
rescue ex : VideoRedirect rescue ex : VideoRedirect
next env.redirect "/watch?v=#{ex.message}" next env.redirect "/watch?v=#{ex.message}"
rescue ex rescue ex
@ -358,6 +359,10 @@ get "/watch" do |env|
next templated "error" next templated "error"
end end
if preferences.annotations_subscribed && subscriptions.includes? video.ucid
params.annotations = true
end
if watched && !watched.includes? id if watched && !watched.includes? id
PG_DB.exec("UPDATE users SET watched = watched || $1 WHERE email = $2", [id], user.as(User).email) PG_DB.exec("UPDATE users SET watched = watched || $1 WHERE email = $2", [id], user.as(User).email)
end end
@ -404,7 +409,7 @@ get "/watch" do |env|
fmt_stream = video.fmt_stream(decrypt_function) fmt_stream = video.fmt_stream(decrypt_function)
adaptive_fmts = video.adaptive_fmts(decrypt_function) adaptive_fmts = video.adaptive_fmts(decrypt_function)
if params[:local] if params.local
fmt_stream.each { |fmt| fmt["url"] = URI.parse(fmt["url"]).full_path } fmt_stream.each { |fmt| fmt["url"] = URI.parse(fmt["url"]).full_path }
adaptive_fmts.each { |fmt| fmt["url"] = URI.parse(fmt["url"]).full_path } adaptive_fmts.each { |fmt| fmt["url"] = URI.parse(fmt["url"]).full_path }
end end
@ -415,12 +420,12 @@ get "/watch" do |env|
captions = video.captions captions = video.captions
preferred_captions = captions.select { |caption| preferred_captions = captions.select { |caption|
params[:preferred_captions].includes?(caption.name.simpleText) || params.preferred_captions.includes?(caption.name.simpleText) ||
params[:preferred_captions].includes?(caption.languageCode.split("-")[0]) params.preferred_captions.includes?(caption.languageCode.split("-")[0])
} }
preferred_captions.sort_by! { |caption| preferred_captions.sort_by! { |caption|
(params[:preferred_captions].index(caption.name.simpleText) || (params.preferred_captions.index(caption.name.simpleText) ||
params[:preferred_captions].index(caption.languageCode.split("-")[0])).not_nil! params.preferred_captions.index(caption.languageCode.split("-")[0])).not_nil!
} }
captions = captions - preferred_captions captions = captions - preferred_captions
@ -441,11 +446,11 @@ get "/watch" do |env|
thumbnail = "/vi/#{video.id}/maxres.jpg" thumbnail = "/vi/#{video.id}/maxres.jpg"
if params[:raw] if params.raw
url = fmt_stream[0]["url"] url = fmt_stream[0]["url"]
fmt_stream.each do |fmt| fmt_stream.each do |fmt|
if fmt["label"].split(" - ")[0] == params[:quality] if fmt["label"].split(" - ")[0] == params.quality
url = fmt["url"] url = fmt["url"]
end end
end end
@ -533,8 +538,15 @@ get "/embed/:id" do |env|
params = process_video_params(env.params.query, preferences) params = process_video_params(env.params.query, preferences)
user = env.get?("user").try &.as(User)
if user
subscriptions = user.subscriptions
watched = user.watched
end
subscriptions ||= [] of String
begin begin
video = get_video(id, PG_DB, proxies, region: params[:region]) video = get_video(id, PG_DB, proxies, region: params.region)
rescue ex : VideoRedirect rescue ex : VideoRedirect
next env.redirect "/embed/#{ex.message}" next env.redirect "/embed/#{ex.message}"
rescue ex rescue ex
@ -542,10 +554,18 @@ get "/embed/:id" do |env|
next templated "error" next templated "error"
end end
if preferences.annotations_subscribed && subscriptions.includes? video.ucid
params.annotations = true
end
if watched && !watched.includes? id
PG_DB.exec("UPDATE users SET watched = watched || $1 WHERE email = $2", [id], user.as(User).email)
end
fmt_stream = video.fmt_stream(decrypt_function) fmt_stream = video.fmt_stream(decrypt_function)
adaptive_fmts = video.adaptive_fmts(decrypt_function) adaptive_fmts = video.adaptive_fmts(decrypt_function)
if params[:local] if params.local
fmt_stream.each { |fmt| fmt["url"] = URI.parse(fmt["url"]).full_path } fmt_stream.each { |fmt| fmt["url"] = URI.parse(fmt["url"]).full_path }
adaptive_fmts.each { |fmt| fmt["url"] = URI.parse(fmt["url"]).full_path } adaptive_fmts.each { |fmt| fmt["url"] = URI.parse(fmt["url"]).full_path }
end end
@ -556,12 +576,12 @@ get "/embed/:id" do |env|
captions = video.captions captions = video.captions
preferred_captions = captions.select { |caption| preferred_captions = captions.select { |caption|
params[:preferred_captions].includes?(caption.name.simpleText) || params.preferred_captions.includes?(caption.name.simpleText) ||
params[:preferred_captions].includes?(caption.languageCode.split("-")[0]) params.preferred_captions.includes?(caption.languageCode.split("-")[0])
} }
preferred_captions.sort_by! { |caption| preferred_captions.sort_by! { |caption|
(params[:preferred_captions].index(caption.name.simpleText) || (params.preferred_captions.index(caption.name.simpleText) ||
params[:preferred_captions].index(caption.languageCode.split("-")[0])).not_nil! params.preferred_captions.index(caption.languageCode.split("-")[0])).not_nil!
} }
captions = captions - preferred_captions captions = captions - preferred_captions
@ -582,11 +602,11 @@ get "/embed/:id" do |env|
thumbnail = "/vi/#{video.id}/maxres.jpg" thumbnail = "/vi/#{video.id}/maxres.jpg"
if params[:raw] if params.raw
url = fmt_stream[0]["url"] url = fmt_stream[0]["url"]
fmt_stream.each do |fmt| fmt_stream.each do |fmt|
if fmt["label"].split(" - ")[0] == params[:quality] if fmt["label"].split(" - ")[0] == params.quality
url = fmt["url"] url = fmt["url"]
end end
end end
@ -1236,6 +1256,14 @@ post "/preferences" do |env|
video_loop ||= "off" video_loop ||= "off"
video_loop = video_loop == "on" video_loop = video_loop == "on"
annotations = env.params.body["annotations"]?.try &.as(String)
annotations ||= "off"
annotations = annotations == "on"
annotations_subscribed = env.params.body["annotations_subscribed"]?.try &.as(String)
annotations_subscribed ||= "off"
annotations_subscribed = annotations_subscribed == "on"
autoplay = env.params.body["autoplay"]?.try &.as(String) autoplay = env.params.body["autoplay"]?.try &.as(String)
autoplay ||= "off" autoplay ||= "off"
autoplay = autoplay == "on" autoplay = autoplay == "on"
@ -1313,27 +1341,29 @@ post "/preferences" do |env|
notifications_only = notifications_only == "on" notifications_only = notifications_only == "on"
preferences = { preferences = {
"video_loop" => video_loop, "video_loop" => video_loop,
"autoplay" => autoplay, "annotations" => annotations,
"continue" => continue, "annotations_subscribed" => annotations_subscribed,
"continue_autoplay" => continue_autoplay, "autoplay" => autoplay,
"listen" => listen, "continue" => continue,
"local" => local, "continue_autoplay" => continue_autoplay,
"speed" => speed, "listen" => listen,
"quality" => quality, "local" => local,
"volume" => volume, "speed" => speed,
"comments" => comments, "quality" => quality,
"captions" => captions, "volume" => volume,
"related_videos" => related_videos, "comments" => comments,
"redirect_feed" => redirect_feed, "captions" => captions,
"locale" => locale, "related_videos" => related_videos,
"dark_mode" => dark_mode, "redirect_feed" => redirect_feed,
"thin_mode" => thin_mode, "locale" => locale,
"max_results" => max_results, "dark_mode" => dark_mode,
"sort" => sort, "thin_mode" => thin_mode,
"latest_only" => latest_only, "max_results" => max_results,
"unseen_only" => unseen_only, "sort" => sort,
"notifications_only" => notifications_only, "latest_only" => latest_only,
"unseen_only" => unseen_only,
"notifications_only" => notifications_only,
}.to_json }.to_json
if user = env.get? "user" if user = env.get? "user"

@ -59,27 +59,29 @@ struct ConfigPreferences
end end
yaml_mapping({ yaml_mapping({
autoplay: {type: Bool, default: false}, annotations: {type: Bool, default: false},
captions: {type: Array(String), default: ["", "", ""], converter: StringToArray}, annotations_subscribed: {type: Bool, default: false},
comments: {type: Array(String), default: ["youtube", ""], converter: StringToArray}, autoplay: {type: Bool, default: false},
continue: {type: Bool, default: false}, captions: {type: Array(String), default: ["", "", ""], converter: StringToArray},
continue_autoplay: {type: Bool, default: true}, comments: {type: Array(String), default: ["youtube", ""], converter: StringToArray},
dark_mode: {type: Bool, default: false}, continue: {type: Bool, default: false},
latest_only: {type: Bool, default: false}, continue_autoplay: {type: Bool, default: true},
listen: {type: Bool, default: false}, dark_mode: {type: Bool, default: false},
local: {type: Bool, default: false}, latest_only: {type: Bool, default: false},
locale: {type: String, default: "en-US"}, listen: {type: Bool, default: false},
max_results: {type: Int32, default: 40}, local: {type: Bool, default: false},
notifications_only: {type: Bool, default: false}, locale: {type: String, default: "en-US"},
quality: {type: String, default: "hd720"}, max_results: {type: Int32, default: 40},
redirect_feed: {type: Bool, default: false}, notifications_only: {type: Bool, default: false},
related_videos: {type: Bool, default: true}, quality: {type: String, default: "hd720"},
sort: {type: String, default: "published"}, redirect_feed: {type: Bool, default: false},
speed: {type: Float32, default: 1.0_f32}, related_videos: {type: Bool, default: true},
thin_mode: {type: Bool, default: false}, sort: {type: String, default: "published"},
unseen_only: {type: Bool, default: false}, speed: {type: Float32, default: 1.0_f32},
video_loop: {type: Bool, default: false}, thin_mode: {type: Bool, default: false},
volume: {type: Int32, default: 100}, unseen_only: {type: Bool, default: false},
video_loop: {type: Bool, default: false},
volume: {type: Int32, default: 100},
}) })
end end

@ -84,27 +84,29 @@ struct Preferences
end end
json_mapping({ json_mapping({
autoplay: {type: Bool, default: CONFIG.default_user_preferences.autoplay}, annotations: {type: Bool, default: CONFIG.default_user_preferences.annotations},
captions: {type: Array(String), default: CONFIG.default_user_preferences.captions, converter: StringToArray}, annotations_subscribed: {type: Bool, default: CONFIG.default_user_preferences.annotations_subscribed},
comments: {type: Array(String), default: CONFIG.default_user_preferences.comments, converter: StringToArray}, autoplay: {type: Bool, default: CONFIG.default_user_preferences.autoplay},
continue: {type: Bool, default: CONFIG.default_user_preferences.continue}, captions: {type: Array(String), default: CONFIG.default_user_preferences.captions, converter: StringToArray},
continue_autoplay: {type: Bool, default: CONFIG.default_user_preferences.continue_autoplay}, comments: {type: Array(String), default: CONFIG.default_user_preferences.comments, converter: StringToArray},
dark_mode: {type: Bool, default: CONFIG.default_user_preferences.dark_mode}, continue: {type: Bool, default: CONFIG.default_user_preferences.continue},
latest_only: {type: Bool, default: CONFIG.default_user_preferences.latest_only}, continue_autoplay: {type: Bool, default: CONFIG.default_user_preferences.continue_autoplay},
listen: {type: Bool, default: CONFIG.default_user_preferences.listen}, dark_mode: {type: Bool, default: CONFIG.default_user_preferences.dark_mode},
local: {type: Bool, default: CONFIG.default_user_preferences.local}, latest_only: {type: Bool, default: CONFIG.default_user_preferences.latest_only},
locale: {type: String, default: CONFIG.default_user_preferences.locale}, listen: {type: Bool, default: CONFIG.default_user_preferences.listen},
max_results: {type: Int32, default: CONFIG.default_user_preferences.max_results}, local: {type: Bool, default: CONFIG.default_user_preferences.local},
notifications_only: {type: Bool, default: CONFIG.default_user_preferences.notifications_only}, locale: {type: String, default: CONFIG.default_user_preferences.locale},
quality: {type: String, default: CONFIG.default_user_preferences.quality}, max_results: {type: Int32, default: CONFIG.default_user_preferences.max_results},
redirect_feed: {type: Bool, default: CONFIG.default_user_preferences.redirect_feed}, notifications_only: {type: Bool, default: CONFIG.default_user_preferences.notifications_only},
related_videos: {type: Bool, default: CONFIG.default_user_preferences.related_videos}, quality: {type: String, default: CONFIG.default_user_preferences.quality},
sort: {type: String, default: CONFIG.default_user_preferences.sort}, redirect_feed: {type: Bool, default: CONFIG.default_user_preferences.redirect_feed},
speed: {type: Float32, default: CONFIG.default_user_preferences.speed}, related_videos: {type: Bool, default: CONFIG.default_user_preferences.related_videos},
thin_mode: {type: Bool, default: CONFIG.default_user_preferences.thin_mode}, sort: {type: String, default: CONFIG.default_user_preferences.sort},
unseen_only: {type: Bool, default: CONFIG.default_user_preferences.unseen_only}, speed: {type: Float32, default: CONFIG.default_user_preferences.speed},
video_loop: {type: Bool, default: CONFIG.default_user_preferences.video_loop}, thin_mode: {type: Bool, default: CONFIG.default_user_preferences.thin_mode},
volume: {type: Int32, default: CONFIG.default_user_preferences.volume}, unseen_only: {type: Bool, default: CONFIG.default_user_preferences.unseen_only},
video_loop: {type: Bool, default: CONFIG.default_user_preferences.video_loop},
volume: {type: Int32, default: CONFIG.default_user_preferences.volume},
}) })
end end

@ -241,6 +241,28 @@ VIDEO_FORMATS = {
"251" => {"ext" => "webm", "format" => "DASH audio", "acodec" => "opus", "abr" => 160}, "251" => {"ext" => "webm", "format" => "DASH audio", "acodec" => "opus", "abr" => 160},
} }
struct VideoPreferences
json_mapping({
annotations: Bool,
autoplay: Bool,
continue: Bool,
continue_autoplay: Bool,
controls: Bool,
listen: Bool,
local: Bool,
preferred_captions: Array(String),
quality: String,
raw: Bool,
region: String?,
related_videos: Bool,
speed: (Float32 | Float64),
video_end: (Float64 | Int32),
video_loop: Bool,
video_start: (Float64 | Int32),
volume: Int32,
})
end
struct Video struct Video
property player_json : JSON::Any? property player_json : JSON::Any?
@ -1199,6 +1221,7 @@ def itag_to_metadata?(itag : String)
end end
def process_video_params(query, preferences) def process_video_params(query, preferences)
annotations = query["iv_load_policy"]?.try &.to_i?
autoplay = query["autoplay"]?.try &.to_i? autoplay = query["autoplay"]?.try &.to_i?
continue = query["continue"]?.try &.to_i? continue = query["continue"]?.try &.to_i?
continue_autoplay = query["continue_autoplay"]?.try &.to_i? continue_autoplay = query["continue_autoplay"]?.try &.to_i?
@ -1214,6 +1237,7 @@ def process_video_params(query, preferences)
if preferences if preferences
# region ||= preferences.region # region ||= preferences.region
annotations ||= preferences.annotations.to_unsafe
autoplay ||= preferences.autoplay.to_unsafe autoplay ||= preferences.autoplay.to_unsafe
continue ||= preferences.continue.to_unsafe continue ||= preferences.continue.to_unsafe
continue_autoplay ||= preferences.continue_autoplay.to_unsafe continue_autoplay ||= preferences.continue_autoplay.to_unsafe
@ -1227,6 +1251,7 @@ def process_video_params(query, preferences)
volume ||= preferences.volume volume ||= preferences.volume
end end
annotations ||= CONFIG.default_user_preferences.annotations.to_unsafe
autoplay ||= CONFIG.default_user_preferences.autoplay.to_unsafe autoplay ||= CONFIG.default_user_preferences.autoplay.to_unsafe
continue ||= CONFIG.default_user_preferences.continue.to_unsafe continue ||= CONFIG.default_user_preferences.continue.to_unsafe
continue_autoplay ||= CONFIG.default_user_preferences.continue_autoplay.to_unsafe continue_autoplay ||= CONFIG.default_user_preferences.continue_autoplay.to_unsafe
@ -1239,6 +1264,7 @@ def process_video_params(query, preferences)
video_loop ||= CONFIG.default_user_preferences.video_loop.to_unsafe video_loop ||= CONFIG.default_user_preferences.video_loop.to_unsafe
volume ||= CONFIG.default_user_preferences.volume volume ||= CONFIG.default_user_preferences.volume
annotations = annotations == 1
autoplay = autoplay == 1 autoplay = autoplay == 1
continue = continue == 1 continue = continue == 1
continue_autoplay = continue_autoplay == 1 continue_autoplay = continue_autoplay == 1
@ -1272,24 +1298,25 @@ def process_video_params(query, preferences)
controls ||= 1 controls ||= 1
controls = controls >= 1 controls = controls >= 1
params = { params = VideoPreferences.new(
autoplay: autoplay, annotations: annotations,
continue: continue, autoplay: autoplay,
continue_autoplay: continue_autoplay, continue: continue,
controls: controls, continue_autoplay: continue_autoplay,
listen: listen, controls: controls,
local: local, listen: listen,
local: local,
preferred_captions: preferred_captions, preferred_captions: preferred_captions,
quality: quality, quality: quality,
raw: raw, raw: raw,
region: region, region: region,
related_videos: related_videos, related_videos: related_videos,
speed: speed, speed: speed,
video_end: video_end, video_end: video_end,
video_loop: video_loop, video_loop: video_loop,
video_start: video_start, video_start: video_start,
volume: volume, volume: volume,
} )
return params return params
end end

@ -3,26 +3,26 @@
onmouseenter='this["data-title"]=this["title"];this["title"]=""' onmouseenter='this["data-title"]=this["title"];this["title"]=""'
onmouseleave='this["title"]=this["data-title"];this["data-title"]=""' onmouseleave='this["title"]=this["data-title"];this["data-title"]=""'
oncontextmenu='this["title"]=this["data-title"]' oncontextmenu='this["title"]=this["data-title"]'
<% if params[:autoplay] %>autoplay<% end %> <% if params.autoplay %>autoplay<% end %>
<% if params[:video_loop] %>loop<% end %> <% if params.video_loop %>loop<% end %>
<% if params[:controls] %>controls<% end %>> <% if params.controls %>controls<% end %>>
<% if hlsvp %> <% if hlsvp %>
<source src="<%= hlsvp %>?local=true" type="application/x-mpegURL" label="livestream"> <source src="<%= hlsvp %>?local=true" type="application/x-mpegURL" label="livestream">
<% else %> <% else %>
<% if params[:listen] %> <% if params.listen %>
<% audio_streams.each_with_index do |fmt, i| %> <% audio_streams.each_with_index do |fmt, i| %>
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>"> <source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
<% end %> <% end %>
<% else %> <% else %>
<% if params[:quality] == "dash" %> <% if params.quality == "dash" %>
<source src="/api/manifest/dash/id/<%= video.id %>?local=true" type='application/dash+xml' label="dash"> <source src="/api/manifest/dash/id/<%= video.id %>?local=true" type='application/dash+xml' label="dash">
<% end %> <% end %>
<% fmt_stream.each_with_index do |fmt, i| %> <% fmt_stream.each_with_index do |fmt, i| %>
<% if params[:quality] %> <% if params.quality %>
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params[:quality] == fmt["label"].split(" - ")[0] %>"> <source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params.quality == fmt["label"].split(" - ")[0] %>">
<% else %> <% else %>
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>"> <source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
@ -161,7 +161,7 @@ player.on('error', function(event) {
} }
}); });
<% if params[:video_start] > 0 || params[:video_end] > 0 %> <% if params.video_start > 0 || params.video_end > 0 %>
player.markers({ player.markers({
onMarkerReached: function(marker) { onMarkerReached: function(marker) {
if (marker.text === "End") { if (marker.text === "End") {
@ -173,22 +173,22 @@ player.markers({
} }
}, },
markers: [ markers: [
{ time: <%= params[:video_start] %>, text: "Start" }, { time: <%= params.video_start %>, text: "Start" },
<% if params[:video_end] < 0 %> <% if params.video_end < 0 %>
{ time: <%= video.info["length_seconds"].to_f - 0.5 %>, text: "End" } { time: <%= video.info["length_seconds"].to_f - 0.5 %>, text: "End" }
<% else %> <% else %>
{ time: <%= params[:video_end] %>, text: "End" } { time: <%= params.video_end %>, text: "End" }
<% end %> <% end %>
] ]
}); });
player.currentTime(<%= params[:video_start] %>); player.currentTime(<%= params.video_start %>);
<% end %> <% end %>
player.volume(<%= params[:volume].to_f / 100 %>); player.volume(<%= params.volume.to_f / 100 %>);
player.playbackRate(<%= params[:speed] %>); player.playbackRate(<%= params.speed %>);
<% if params[:autoplay] %> <% if params.autoplay %>
var bpb = player.getChild('bigPlayButton'); var bpb = player.getChild('bigPlayButton');
if (bpb) { if (bpb) {
@ -211,9 +211,11 @@ if (bpb) {
} }
<% end %> <% end %>
<% if !params.listen && params.quality == "dash" %>
player.httpSourceSelector(); player.httpSourceSelector();
<% end %>
<% if !params[:listen] %> <% if !params.listen && params.annotations %>
var video_container = document.getElementById("player"); var video_container = document.getElementById("player");
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.responseType = "text"; xhr.responseType = "text";

@ -10,7 +10,7 @@
<script src="/js/videojs-markers.min.js"></script> <script src="/js/videojs-markers.min.js"></script>
<script src="/js/videojs-share.min.js"></script> <script src="/js/videojs-share.min.js"></script>
<script src="/js/videojs-youtube-annotations.js"></script> <script src="/js/videojs-youtube-annotations.js"></script>
<% if params[:quality] != "dash" %> <% if params.listen || params.quality != "dash" %>
<link rel="stylesheet" href="/css/quality-selector.css"> <link rel="stylesheet" href="/css/quality-selector.css">
<script src="/js/silvermine-videojs-quality-selector.min.js"></script> <script src="/js/silvermine-videojs-quality-selector.min.js"></script>
<% end %> <% end %>

@ -55,14 +55,14 @@ function get_playlist(timeouts = 0) {
location.assign("/embed/" location.assign("/embed/"
+ xhr.response.nextVideo + xhr.response.nextVideo
+ "?list=<%= plid %>" + "?list=<%= plid %>"
<% if params[:listen] != preferences.listen %> <% if params.listen != preferences.listen %>
+ "&listen=<%= params[:listen] %>" + "&listen=<%= params.listen %>"
<% end %> <% end %>
<% if params[:autoplay] || params[:continue_autoplay] %> <% if params.autoplay || params.continue_autoplay %>
+ "&autoplay=1" + "&autoplay=1"
<% end %> <% end %>
<% if params[:speed] != preferences.speed %> <% if params.speed != preferences.speed %>
+ "&speed=<%= params[:speed] %>" + "&speed=<%= params.speed %>"
<% end %> <% end %>
); );
}); });
@ -85,14 +85,14 @@ player.on('ended', function() {
<% if !video_series.empty? %> <% if !video_series.empty? %>
+ "?playlist=<%= video_series.join(",") %>" + "?playlist=<%= video_series.join(",") %>"
<% end %> <% end %>
<% if params[:listen] != preferences.listen %> <% if params.listen != preferences.listen %>
+ "&listen=<%= params[:listen] %>" + "&listen=<%= params.listen %>"
<% end %> <% end %>
<% if params[:autoplay] || params[:continue_autoplay] %> <% if params.autoplay || params.continue_autoplay %>
+ "&autoplay=1" + "&autoplay=1"
<% end %> <% end %>
<% if params[:speed] != preferences.speed %> <% if params.speed != preferences.speed %>
+ "&speed=<%= params[:speed] %>" + "&speed=<%= params.speed %>"
<% end %> <% end %>
); );
}); });

@ -94,6 +94,11 @@ function update_value(element) {
<input name="related_videos" id="related_videos" type="checkbox" <% if preferences.related_videos %>checked<% end %>> <input name="related_videos" id="related_videos" type="checkbox" <% if preferences.related_videos %>checked<% end %>>
</div> </div>
<div class="pure-control-group">
<label for="annotations"><%= translate(locale, "Show annotations by default? ") %></label>
<input name="annotations" id="annotations" type="checkbox" <% if preferences.annotations %>checked<% end %>>
</div>
<legend><%= translate(locale, "Visual preferences") %></legend> <legend><%= translate(locale, "Visual preferences") %></legend>
<div class="pure-control-group"> <div class="pure-control-group">
@ -118,6 +123,11 @@ function update_value(element) {
<% if env.get? "user" %> <% if env.get? "user" %>
<legend><%= translate(locale, "Subscription preferences") %></legend> <legend><%= translate(locale, "Subscription preferences") %></legend>
<div class="pure-control-group">
<label for="annotations_subscribed"><%= translate(locale, "Show annotations by default for subscribed channels? ") %></label>
<input name="annotations_subscribed" id="annotations_subscribed" type="checkbox" <% if preferences.annotations_subscribed %>checked<% end %>>
</div>
<div class="pure-control-group"> <div class="pure-control-group">
<label for="redirect_feed"><%= translate(locale, "Redirect homepage to feed: ") %></label> <label for="redirect_feed"><%= translate(locale, "Redirect homepage to feed: ") %></label>
<input name="redirect_feed" id="redirect_feed" type="checkbox" <% if preferences.redirect_feed %>checked<% end %>> <input name="redirect_feed" id="redirect_feed" type="checkbox" <% if preferences.redirect_feed %>checked<% end %>>

@ -34,7 +34,7 @@
<div class="h-box"> <div class="h-box">
<h1> <h1>
<%= HTML.escape(video.title) %> <%= HTML.escape(video.title) %>
<% if params[:listen] %> <% if params.listen %>
<a title="<%=translate(locale, "Video mode")%>" href="/watch?<%= env.params.query %>&listen=0"> <a title="<%=translate(locale, "Video mode")%>" href="/watch?<%= env.params.query %>&listen=0">
<i class="icon ion-ios-videocam"></i> <i class="icon ion-ios-videocam"></i>
</a> </a>
@ -56,6 +56,17 @@
<div class="pure-u-1 pure-u-lg-1-5"> <div class="pure-u-1 pure-u-lg-1-5">
<div class="h-box"> <div class="h-box">
<p><a href="https://www.youtube.com/watch?v=<%= video.id %>"><%= translate(locale, "Watch on YouTube") %></a></p> <p><a href="https://www.youtube.com/watch?v=<%= video.id %>"><%= translate(locale, "Watch on YouTube") %></a></p>
<p>
<% if params.annotations %>
<a href="/watch?<%= env.params.query %>&iv_load_policy=3">
<%= translate(locale, "Hide annotations") %>
</a>
<% else %>
<a href="/watch?<%= env.params.query %>&iv_load_policy=1">
<%=translate(locale, "Show annotations")%>
</a>
<% end %>
</p>
<% if CONFIG.dmca_content.includes? video.id %> <% if CONFIG.dmca_content.includes? video.id %>
<p>Download is disabled.</p> <p>Download is disabled.</p>
@ -122,7 +133,7 @@
</div> </div>
</div> </div>
<div class="pure-u-1 <% if params[:related_videos] || plid %>pure-u-lg-3-5<% else %>pure-u-md-4-5<% end %>"> <div class="pure-u-1 <% if params.related_videos || plid %>pure-u-lg-3-5<% else %>pure-u-md-4-5<% end %>">
<div class="h-box"> <div class="h-box">
<p> <p>
<a href="/channel/<%= video.ucid %>"> <a href="/channel/<%= video.ucid %>">
@ -153,21 +164,21 @@
</div> </div>
</div> </div>
</div> </div>
<% if params[:related_videos] || plid %> <% if params.related_videos || plid %>
<div class="pure-u-1 pure-u-lg-1-5"> <div class="pure-u-1 pure-u-lg-1-5">
<% if plid %> <% if plid %>
<div id="playlist" class="h-box"> <div id="playlist" class="h-box">
</div> </div>
<% end %> <% end %>
<% if params[:related_videos] %> <% if params.related_videos %>
<div class="h-box"> <div class="h-box">
<% if !rvs.empty? %> <% if !rvs.empty? %>
<div <% if plid %>style="display:none"<% end %>> <div <% if plid %>style="display:none"<% end %>>
<div class="pure-control-group"> <div class="pure-control-group">
<label for="continue"><%= translate(locale, "Autoplay next video: ") %></label> <label for="continue"><%= translate(locale, "Autoplay next video: ") %></label>
<input name="continue" onclick="continue_autoplay(this)" id="continue" type="checkbox" <% if params[:continue] %>checked<% end %>> <input name="continue" onclick="continue_autoplay(this)" id="continue" type="checkbox" <% if params.continue %>checked<% end %>>
</div> </div>
<hr> <hr>
</div> </div>
@ -205,19 +216,19 @@
</div> </div>
<script> <script>
<% if !rvs.empty? && !plid && params[:continue] %> <% if !rvs.empty? && !plid && params.continue %>
player.on('ended', function() { player.on('ended', function() {
location.assign("/watch?v=" location.assign("/watch?v="
+ "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>" + "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>"
+ "&continue=1" + "&continue=1"
<% if params[:listen] != preferences.listen %> <% if params.listen != preferences.listen %>
+ "&listen=<%= params[:listen] %>" + "&listen=<%= params.listen %>"
<% end %> <% end %>
<% if params[:autoplay] || params[:continue_autoplay] %> <% if params.autoplay || params.continue_autoplay %>
+ "&autoplay=1" + "&autoplay=1"
<% end %> <% end %>
<% if params[:speed] != preferences.speed %> <% if params.speed != preferences.speed %>
+ "&speed=<%= params[:speed] %>" + "&speed=<%= params.speed %>"
<% end %> <% end %>
); );
}); });
@ -229,14 +240,14 @@ function continue_autoplay(target) {
location.assign("/watch?v=" location.assign("/watch?v="
+ "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>" + "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>"
+ "&continue=1" + "&continue=1"
<% if params[:listen] != preferences.listen %> <% if params.listen != preferences.listen %>
+ "&listen=<%= params[:listen] %>" + "&listen=<%= params.listen %>"
<% end %> <% end %>
<% if params[:autoplay] || params[:continue_autoplay] %> <% if params.autoplay || params.continue_autoplay %>
+ "&autoplay=1" + "&autoplay=1"
<% end %> <% end %>
<% if params[:speed] != preferences.speed %> <% if params.speed != preferences.speed %>
+ "&speed=<%= params[:speed] %>" + "&speed=<%= params.speed %>"
<% end %> <% end %>
); );
}); });
@ -295,14 +306,14 @@ function get_playlist(timeouts = 0) {
location.assign("/watch?v=" location.assign("/watch?v="
+ xhr.response.nextVideo + xhr.response.nextVideo
+ "&list=<%= plid %>" + "&list=<%= plid %>"
<% if params[:listen] != preferences.listen %> <% if params.listen != preferences.listen %>
+ "&listen=<%= params[:listen] %>" + "&listen=<%= params.listen %>"
<% end %> <% end %>
<% if params[:autoplay] || params[:continue_autoplay] %> <% if params.autoplay || params.continue_autoplay %>
+ "&autoplay=1" + "&autoplay=1"
<% end %> <% end %>
<% if params[:speed] != preferences.speed %> <% if params.speed != preferences.speed %>
+ "&speed=<%= params[:speed] %>" + "&speed=<%= params.speed %>"
<% end %> <% end %>
); );
}); });

Loading…
Cancel
Save