This commit is contained in:
Agustin Ferrari 2019-02-01 20:15:34 -03:00
commit c0e73e71c5
7 changed files with 601 additions and 335 deletions

274
locales/eu.json Normal file
View File

@ -0,0 +1,274 @@
{
"`x` subscribers": "",
"`x` videos": "",
"LIVE": "",
"Shared `x` ago": "",
"Unsubscribe": "",
"Subscribe": "Harpidetu",
"Login to subscribe to `x`": "",
"View channel on YouTube": "Ikusi kanala YouTuben",
"newest": "berrienak",
"oldest": "zaharrenak",
"popular": "ospetsuenak",
"Preview page": "Aurrebista orria",
"Next page": "Hurrengo orria",
"Clear watch history?": "Garbitu ikusitakoen historia?",
"Yes": "Bai",
"No": "Ez",
"Import and Export Data": "Datuak inportatu eta esportatu",
"Import": "Inportatu",
"Import Invidious data": "Invidiouseko datuak inportatu",
"Import YouTube subscriptions": "YouTubeko harpidetzak inportatu",
"Import FreeTube subscriptions (.db)": "FreeTubeko harpidetzak inportatu (.db)",
"Import NewPipe subscriptions (.json)": "NewPipeko harpidetzak inportatu (.json)",
"Import NewPipe data (.zip)": "NewPipeko datuak inportatu (.zip)",
"Export": "Esportatu",
"Export subscriptions as OPML": "Esportatu harpidetzak OPML bezala",
"Export subscriptions as OPML (for NewPipe & FreeTube)": "",
"Export data as JSON": "",
"Delete account?": "Kontua ezabatu?",
"History": "Historia",
"Previous page": "Aurreko orria",
"An alternative front-end to YouTube": "",
"JavaScript license information": "",
"source": "",
"Login": "",
"Login/Register": "",
"Login to Google": "",
"User ID:": "",
"Password:": "",
"Time (h:mm:ss):": "",
"Text CAPTCHA": "",
"Image CAPTCHA": "",
"Sign In": "",
"Register": "",
"Email:": "",
"Google verification code:": "",
"Preferences": "",
"Player preferences": "",
"Always loop: ": "",
"Autoplay: ": "",
"Autoplay next video: ": "",
"Listen by default: ": "",
"Default speed: ": "",
"Preferred video quality: ": "",
"Player volume: ": "",
"Default comments: ": "",
"Default captions: ": "",
"Fallback captions: ": "",
"Show related videos? ": "",
"Visual preferences": "",
"Dark mode: ": "",
"Thin mode: ": "",
"Subscription preferences": "",
"Redirect homepage to feed: ": "",
"Number of videos shown in feed: ": "",
"Sort videos by: ": "",
"published": "",
"published - reverse": "",
"alphabetically": "",
"alphabetically - reverse": "",
"channel name": "",
"channel name - reverse": "",
"Only show latest video from channel: ": "",
"Only show latest unwatched video from channel: ": "",
"Only show unwatched: ": "",
"Only show notifications (if there are any): ": "",
"Data preferences": "",
"Clear watch history": "",
"Import/Export data": "",
"Manage subscriptions": "",
"Watch history": "",
"Delete account": "",
"Save preferences": "",
"Subscription manager": "",
"`x` subscriptions": "",
"Import/Export": "",
"unsubscribe": "",
"Subscriptions": "",
"`x` unseen notifications": "",
"search": "",
"Sign out": "",
"Released under the AGPLv3 by Omar Roth.": "",
"Source available here.": "",
"View JavaScript license information.": "",
"Trending": "",
"Watch video on Youtube": "",
"Genre: ": "",
"License: ": "",
"Family friendly? ": "",
"Wilson score: ": "",
"Engagement: ": "",
"Whitelisted regions: ": "",
"Blacklisted regions: ": "",
"Shared `x`": "",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "",
"View YouTube comments": "",
"View more comments on Reddit": "",
"View `x` comments": "",
"View Reddit comments": "",
"Hide replies": "",
"Show replies": "",
"Incorrect password": "",
"Quota exceeded, try again in a few hours": "",
"Unable to login, make sure two-factor authentication (Authenticator or SMS) is enabled.": "",
"Invalid TFA code": "",
"Login failed. This may be because two-factor authentication is not enabled on your account.": "",
"Invalid answer": "",
"Invalid CAPTCHA": "",
"CAPTCHA is a required field": "",
"User ID is a required field": "",
"Password is a required field": "",
"Invalid username or password": "",
"Please sign in using 'Sign in with Google'": "",
"Password cannot be empty": "",
"Password cannot be longer than 55 characters": "",
"Please sign in": "",
"Invidious Private Feed for `x`": "",
"channel:`x`": "",
"Deleted or invalid channel": "",
"This channel does not exist.": "",
"Could not get channel info.": "",
"Could not fetch comments": "",
"View `x` replies": "",
"`x` ago": "",
"Load more": "",
"`x` points": "",
"Could not create mix.": "",
"Playlist is empty": "",
"Invalid playlist.": "",
"Playlist does not exist.": "",
"Could not pull trending pages.": "",
"Hidden field \"challenge\" is a required field": "",
"Hidden field \"token\" is a required field": "",
"Invalid challenge": "",
"Invalid token": "",
"Invalid user": "",
"Token is expired, please try again": "",
"English": "",
"English (auto-generated)": "",
"Afrikaans": "",
"Albanian": "",
"Amharic": "",
"Arabic": "",
"Armenian": "",
"Azerbaijani": "",
"Bangla": "",
"Basque": "",
"Belarusian": "",
"Bosnian": "",
"Bulgarian": "",
"Burmese": "",
"Catalan": "",
"Cebuano": "",
"Chinese (Simplified)": "",
"Chinese (Traditional)": "",
"Corsican": "",
"Croatian": "",
"Czech": "",
"Danish": "",
"Dutch": "",
"Esperanto": "",
"Estonian": "",
"Filipino": "",
"Finnish": "",
"French": "",
"Galician": "",
"Georgian": "",
"German": "",
"Greek": "",
"Gujarati": "",
"Haitian Creole": "",
"Hausa": "",
"Hawaiian": "",
"Hebrew": "",
"Hindi": "",
"Hmong": "",
"Hungarian": "",
"Icelandic": "",
"Igbo": "",
"Indonesian": "",
"Irish": "",
"Italian": "",
"Japanese": "",
"Javanese": "",
"Kannada": "",
"Kazakh": "",
"Khmer": "",
"Korean": "",
"Kurdish": "",
"Kyrgyz": "",
"Lao": "",
"Latin": "",
"Latvian": "",
"Lithuanian": "",
"Luxembourgish": "",
"Macedonian": "",
"Malagasy": "",
"Malay": "",
"Malayalam": "",
"Maltese": "",
"Maori": "",
"Marathi": "",
"Mongolian": "",
"Nepali": "",
"Norwegian": "",
"Nyanja": "",
"Pashto": "",
"Persian": "",
"Polish": "",
"Portuguese": "",
"Punjabi": "",
"Romanian": "",
"Russian": "",
"Samoan": "",
"Scottish Gaelic": "",
"Serbian": "",
"Shona": "",
"Sindhi": "",
"Sinhala": "",
"Slovak": "",
"Slovenian": "",
"Somali": "",
"Southern Sotho": "",
"Spanish": "",
"Spanish (Latin America)": "",
"Sundanese": "",
"Swahili": "",
"Swedish": "",
"Tajik": "",
"Tamil": "",
"Telugu": "",
"Thai": "",
"Turkish": "",
"Ukrainian": "",
"Urdu": "",
"Uzbek": "",
"Vietnamese": "",
"Welsh": "",
"Western Frisian": "",
"Xhosa": "",
"Yiddish": "",
"Yoruba": "",
"Zulu": "",
"`x` years": "",
"`x` months": "",
"`x` weeks": "",
"`x` days": "",
"`x` hours": "",
"`x` minutes": "",
"`x` seconds": "",
"Fallback comments: ": "",
"Popular": "",
"Top": "",
"About": "",
"Rating: ": "",
"Language: ": "",
"Default": "",
"Music": "",
"Gaming": "",
"News": "",
"Movies": "",
"Download": "",
"Download as: ": ""
}

View File

@ -153,12 +153,12 @@
"Token is expired, please try again": "Срок действия токена истек, попробуйте позже",
"English": "Английский",
"English (auto-generated)": "Английский (созданы автоматически)",
"Afrikaans": "",
"Albanian": "",
"Amharic": "",
"Arabic": "",
"Armenian": "",
"Azerbaijani": "",
"Afrikaans": "Африкаанс",
"Albanian": "Албанский",
"Amharic": "Амхарский",
"Arabic": "Арабский",
"Armenian": "Армянский",
"Azerbaijani": "Азербайджанский",
"Bangla": "",
"Basque": "",
"Belarusian": "",
@ -256,7 +256,7 @@
"Xhosa": "",
"Yiddish": "",
"Yoruba": "",
"Zulu": "",
"Zulu": "Зулусский",
"`x` years": "`x` лет",
"`x` months": "`x` месяцев",
"`x` weeks": "`x` недель",
@ -270,11 +270,11 @@
"About": "О сайте",
"Rating: ": "Рейтинг: ",
"Language: ": "Язык: ",
"Default": "",
"Music": "",
"Gaming": "",
"News": "",
"Movies": "",
"Download": "",
"Download as: ": ""
"Default": "По-умолчанию",
"Music": "Музыка",
"Gaming": "Игры",
"News": "Новости",
"Movies": "Фильмы",
"Download": "Скачать",
"Download as: ": "Скачать как: "
}

View File

@ -1128,21 +1128,21 @@ post "/preferences" do |env|
listen = listen == "on"
speed = env.params.body["speed"]?.try &.as(String).to_f?
speed ||= 1.0
speed ||= DEFAULT_USER_PREFERENCES.speed
quality = env.params.body["quality"]?.try &.as(String)
quality ||= "hd720"
quality ||= DEFAULT_USER_PREFERENCES.quality
volume = env.params.body["volume"]?.try &.as(String).to_i?
volume ||= 100
volume ||= DEFAULT_USER_PREFERENCES.volume
comments_0 = env.params.body["comments_0"]?.try &.as(String) || "youtube"
comments_1 = env.params.body["comments_1"]?.try &.as(String) || ""
comments_0 = env.params.body["comments_0"]?.try &.as(String) || DEFAULT_USER_PREFERENCES.comments[0]
comments_1 = env.params.body["comments_1"]?.try &.as(String) || DEFAULT_USER_PREFERENCES.comments[1]
comments = [comments_0, comments_1]
captions_0 = env.params.body["captions_0"]?.try &.as(String) || ""
captions_1 = env.params.body["captions_1"]?.try &.as(String) || ""
captions_2 = env.params.body["captions_2"]?.try &.as(String) || ""
captions_0 = env.params.body["captions_0"]?.try &.as(String) || DEFAULT_USER_PREFERENCES.captions[0]
captions_1 = env.params.body["captions_1"]?.try &.as(String) || DEFAULT_USER_PREFERENCES.captions[1]
captions_2 = env.params.body["captions_2"]?.try &.as(String) || DEFAULT_USER_PREFERENCES.captions[2]
captions = [captions_0, captions_1, captions_2]
related_videos = env.params.body["related_videos"]?.try &.as(String)
@ -1154,7 +1154,7 @@ post "/preferences" do |env|
redirect_feed = redirect_feed == "on"
locale = env.params.body["locale"]?.try &.as(String)
locale ||= "en-US"
locale ||= DEFAULT_USER_PREFERENCES.locale
dark_mode = env.params.body["dark_mode"]?.try &.as(String)
dark_mode ||= "off"
@ -1165,10 +1165,10 @@ post "/preferences" do |env|
thin_mode = thin_mode == "on"
max_results = env.params.body["max_results"]?.try &.as(String).to_i?
max_results ||= 40
max_results ||= DEFAULT_USER_PREFERENCES.max_results
sort = env.params.body["sort"]?.try &.as(String)
sort ||= "published"
sort ||= DEFAULT_USER_PREFERENCES.sort
latest_only = env.params.body["latest_only"]?.try &.as(String)
latest_only ||= "off"

View File

@ -79,36 +79,36 @@ class Preferences
autoplay: Bool,
continue: {
type: Bool,
default: false,
default: DEFAULT_USER_PREFERENCES.continue,
},
listen: {
type: Bool,
default: false,
default: DEFAULT_USER_PREFERENCES.listen,
},
speed: Float32,
quality: String,
volume: Int32,
comments: {
type: Array(String),
default: ["youtube", ""],
default: DEFAULT_USER_PREFERENCES.comments,
converter: StringToArray,
},
captions: {
type: Array(String),
default: ["", "", ""],
default: DEFAULT_USER_PREFERENCES.captions,
},
redirect_feed: {
type: Bool,
default: false,
default: DEFAULT_USER_PREFERENCES.redirect_feed,
},
related_videos: {
type: Bool,
default: true,
default: DEFAULT_USER_PREFERENCES.related_videos,
},
dark_mode: Bool,
thin_mode: {
type: Bool,
default: false,
default: DEFAULT_USER_PREFERENCES.thin_mode,
},
max_results: Int32,
sort: String,
@ -116,11 +116,11 @@ class Preferences
unseen_only: Bool,
notifications_only: {
type: Bool,
default: false,
default: DEFAULT_USER_PREFERENCES.notifications_only,
},
locale: {
type: String,
default: "en-US",
default: DEFAULT_USER_PREFERENCES.locale,
},
})
end

View File

@ -633,6 +633,10 @@ def fetch_video(id, proxies, region)
end
end
if info["errorcode"]?.try &.== "2"
raise "Video unavailable."
end
title = info["title"]
author = info["author"]
ucid = info["ucid"]
@ -741,14 +745,14 @@ def process_video_params(query, preferences)
volume ||= preferences.volume
end
autoplay ||= 0
continue ||= 0
listen ||= 0
preferred_captions ||= [] of String
quality ||= "hd720"
speed ||= 1
video_loop ||= 0
volume ||= 100
autoplay ||= DEFAULT_USER_PREFERENCES.autoplay.to_unsafe
continue ||= DEFAULT_USER_PREFERENCES.continue.to_unsafe
listen ||= DEFAULT_USER_PREFERENCES.listen.to_unsafe
preferred_captions ||= DEFAULT_USER_PREFERENCES.captions
quality ||= DEFAULT_USER_PREFERENCES.quality
speed ||= DEFAULT_USER_PREFERENCES.speed
video_loop ||= DEFAULT_USER_PREFERENCES.video_loop.to_unsafe
volume ||= DEFAULT_USER_PREFERENCES.volume
autoplay = autoplay == 1
continue = continue == 1

View File

@ -115,38 +115,26 @@ var player = videojs("player", options, function() {
});
player.on('error', function(event) {
if (player.error().code === 2) {
if (player.error().code === 2 || player.error().code === 4) {
setInterval(setTimeout(function (event) {
console.log("An error occured in the player, reloading...");
var currentTime = player.currentTime();
var playbackRate = player.playbackRate();
var paused = player.paused()
player.load();
if (currentTime > 0.5) {
currentTime -= 0.5;
}
player.currentTime(currentTime);
player.playbackRate(playbackRate);
player.play()
} else if (player.error().code === 4) {
console.log("Detected invalid source, removing...");
var currentTime = player.currentTime();
var sources = player.options().sources;
for (var i = 0; i < sources.length; i++) {
if (sources[i].src === player.currentSource().src) {
sources.splice(i, 1);
break
}
};
player.load();
if (currentTime > 0.5) {
currentTime -= 0.5;
}
player.currentTime(currentTime);
player.src(sources);
if (!paused) {
player.play();
}
}, 5000), 5000);
}
});
player.share(shareOptions);

View File

@ -141,7 +141,7 @@
</div>
</div>
</div>
<% if preferences && preferences.related_videos || plid %>
<% if !preferences || preferences && preferences.related_videos || plid %>
<div class="pure-u-1 pure-u-md-1-5">
<% if plid %>
<div id="playlist" class="h-box">