stremiok 2.3.3 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +6 -5
- package/config.xml +1 -1
- package/css/style.css +5 -0
- package/index.html +42 -39
- package/js/app.js +7 -3
- package/js/downloads.js +16 -16
- package/js/epg.js +2 -3
- package/js/hubpreview.js +1 -1
- package/js/i18n.js +108 -0
- package/js/iptv.js +13 -13
- package/js/jellyfin.js +62 -29
- package/js/lang/ar.js +1941 -0
- package/js/lang/de.js +1941 -0
- package/js/lang/es.js +1941 -0
- package/js/lang/fi.js +1941 -0
- package/js/lang/fr.js +1941 -0
- package/js/lang/he.js +1941 -0
- package/js/lang/hi.js +1941 -0
- package/js/lang/it.js +1941 -0
- package/js/lang/ja.js +1941 -0
- package/js/lang/ko.js +1941 -0
- package/js/lang/languages.js +21 -0
- package/js/lang/pl.js +1941 -0
- package/js/lang/pt-BR.js +1941 -0
- package/js/lang/ru.js +1941 -0
- package/js/lang/tr.js +1941 -0
- package/js/lang/zh-CN.js +1941 -0
- package/js/local.js +9 -9
- package/js/netfolders.js +13 -13
- package/js/player-audio.js +17 -17
- package/js/player-controls.js +100 -100
- package/js/player-core.js +60 -57
- package/js/player-lang.js +22 -22
- package/js/player-quality.js +15 -15
- package/js/player-store.js +25 -18
- package/js/player-subs.js +69 -69
- package/js/plex.js +69 -21
- package/js/stremio-account.js +17 -12
- package/js/stremio-sync.js +641 -0
- package/js/stremio.js +79 -76
- package/js/stvod.js +4 -4
- package/js/trakt.js +23 -23
- package/js/tvapps.js +4 -4
- package/js/util.js +39 -27
- package/js/view-core.js +109 -92
- package/js/view-detail.js +135 -126
- package/js/view-discover.js +27 -27
- package/js/view-guide.js +13 -13
- package/js/view-home.js +148 -120
- package/js/view-search.js +25 -25
- package/js/view-settings.js +735 -643
- package/js/xtvod.js +2 -2
- package/js/youtube.js +17 -17
- package/js/ytplay.js +11 -6
- package/package.json +1 -1
- package/tizenbrew.html +1 -1
package/js/player-store.js
CHANGED
|
@@ -11,14 +11,16 @@
|
|
|
11
11
|
var WATCHED_KEY = 'stremiok.watched';
|
|
12
12
|
function watchedAll() { return U.store.get(WATCHED_KEY, {}) || {}; }
|
|
13
13
|
// A mark made here: watched at (ms, > 0), or not watched at (−ms; false: an older "not
|
|
14
|
-
// watched", at 0). Trakt's history (when connected)
|
|
15
|
-
// against it by time: marked watched here: watched; marked not
|
|
16
|
-
//
|
|
14
|
+
// watched", at 0). Trakt's history (when connected), your Stremio account's and your media
|
|
15
|
+
// servers' marks are weighed against it by time: marked watched here: watched; marked not
|
|
16
|
+
// watched here: watched only if one of them has it watched since (on another device); no mark
|
|
17
|
+
// here: as they have it.
|
|
17
18
|
// null: none knows it.
|
|
18
19
|
function traktAt(type, id) {
|
|
19
20
|
var t = (typeof Trakt !== 'undefined' && Trakt.isConnected && Trakt.isConnected() && Trakt.watchedAt) ? Trakt.watchedAt(type, id) : 0;
|
|
20
21
|
var s = (typeof Jellyfin !== 'undefined' && Jellyfin.watchedAt) ? Jellyfin.watchedAt(type, id) : 0; // (Jellyfin, Emby and Plex: js/jellyfin.js)
|
|
21
|
-
|
|
22
|
+
var a = (typeof StremioSync !== 'undefined' && StremioSync.watchedAt) ? StremioSync.watchedAt(type, id) : 0; // (your Stremio account)
|
|
23
|
+
return Math.max(t || 0, s || 0, a || 0);
|
|
22
24
|
}
|
|
23
25
|
function watchedState(type, id) {
|
|
24
26
|
var v = watchedAll()[type + ':' + id], t = traktAt(type, id);
|
|
@@ -43,12 +45,14 @@
|
|
|
43
45
|
});
|
|
44
46
|
return out;
|
|
45
47
|
}
|
|
46
|
-
// quiet: Trakt not told (it's been told another way: a finished scrobble)
|
|
48
|
+
// quiet: Trakt not told (it's been told another way: a finished scrobble); your Stremio
|
|
49
|
+
// account always is
|
|
47
50
|
function setWatched(type, id, on, quiet) {
|
|
48
51
|
var a = watchedAll();
|
|
49
52
|
a[type + ':' + id] = on ? Date.now() : -Date.now();
|
|
50
53
|
U.store.set(WATCHED_KEY, a);
|
|
51
54
|
if (!quiet) { tellTrakt(type, [id], on); }
|
|
55
|
+
tellStremio(type, [id], on);
|
|
52
56
|
}
|
|
53
57
|
function setWatchedMany(type, ids, on) {
|
|
54
58
|
var a = watchedAll();
|
|
@@ -56,7 +60,9 @@
|
|
|
56
60
|
ids.forEach(function (id) { a[type + ':' + id] = value; });
|
|
57
61
|
U.store.set(WATCHED_KEY, a);
|
|
58
62
|
tellTrakt(type, ids, on);
|
|
63
|
+
tellStremio(type, ids, on);
|
|
59
64
|
}
|
|
65
|
+
function tellStremio(type, ids, on) { if (typeof StremioSync !== 'undefined' && StremioSync.onMarked) { StremioSync.onMarked(type, ids, !!on); } }
|
|
60
66
|
// A "not watched" Trakt has confirmed (and its copy shows): dropped here, so Trakt decides.
|
|
61
67
|
function clearUnwatched(type, id) {
|
|
62
68
|
var a = watchedAll(), k = type + ':' + id, v = a[k];
|
|
@@ -75,13 +81,13 @@
|
|
|
75
81
|
|
|
76
82
|
// ---------- subtitle look, audio language ----------
|
|
77
83
|
// Look: color, background, edge and height on screen.
|
|
78
|
-
var SUB_COLORS = [['white', 'White', '#ffffff'], ['yellow', 'Yellow', '#ffe14d'], ['cyan', 'Cyan', '#7fe7ff'], ['green', 'Green', '#9cff8a']];
|
|
79
|
-
var SUB_BGS = [['none', 'None', 'transparent'], ['light', 'See-through box', 'rgba(0,0,0,0.55)'], ['solid', 'Solid box', 'rgba(0,0,0,0.9)']];
|
|
80
|
-
var SUB_EDGES = [['shadow', 'Drop shadow', '0 2px 3px #000'],
|
|
81
|
-
['outline', 'Outline', '-2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 -2px 0 #000, 0 2px 0 #000, -2px 0 0 #000, 2px 0 0 #000'],
|
|
82
|
-
['none', 'None', 'none']];
|
|
84
|
+
var SUB_COLORS = [['white', U.t('White'), '#ffffff'], ['yellow', U.t('Yellow'), '#ffe14d'], ['cyan', U.t('Cyan'), '#7fe7ff'], ['green', U.t('Green'), '#9cff8a']];
|
|
85
|
+
var SUB_BGS = [['none', U.t('None'), 'transparent'], ['light', U.t('See-through box'), 'rgba(0,0,0,0.55)'], ['solid', U.t('Solid box'), 'rgba(0,0,0,0.9)']];
|
|
86
|
+
var SUB_EDGES = [['shadow', U.t('Drop shadow'), '0 2px 3px #000'],
|
|
87
|
+
['outline', U.t('Outline'), '-2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 -2px 0 #000, 0 2px 0 #000, -2px 0 0 #000, 2px 0 0 #000'],
|
|
88
|
+
['none', U.t('None'), 'none']];
|
|
83
89
|
// bottom offset: above the black bars of a widescreen film when raised
|
|
84
|
-
var SUB_POSITIONS = [['lower', 'Lower', 60], ['bottom', 'Bottom', 130], ['raised', 'Raised', 210], ['higher', 'Higher', 290]]; // (Lower: near the screen's edge)
|
|
90
|
+
var SUB_POSITIONS = [['lower', U.t('Lower'), 60], ['bottom', U.t('Bottom'), 130], ['raised', U.t('Raised'), 210], ['higher', U.t('Higher'), 290]]; // (Lower: near the screen's edge)
|
|
85
91
|
function pick3(list, id) { for (var i = 0; i < list.length; i++) { if (list[i][0] === id) { return list[i]; } } return list[0]; }
|
|
86
92
|
function getSubCfg() {
|
|
87
93
|
var d = U.store.get(SUBCFG_KEY, {}) || {};
|
|
@@ -103,11 +109,11 @@
|
|
|
103
109
|
// css/fonts (see style.css); each falls back to a TV font for scripts it lacks.
|
|
104
110
|
// 'default' leaves the subtitle in the app font (Arial / Tizen Sans).
|
|
105
111
|
var SUB_FONTS = [
|
|
106
|
-
['default', 'TV default', ''],
|
|
112
|
+
['default', U.t('TV default'), ''],
|
|
107
113
|
['roboto', 'Roboto', "'SK Roboto', Arial, sans-serif"],
|
|
108
|
-
['atkinson', 'Atkinson Hyperlegible (easy reading)', "'SK Atkinson Hyperlegible', Arial, sans-serif"],
|
|
109
|
-
['nunito', 'Nunito (rounded)', "'SK Nunito', Arial, sans-serif"],
|
|
110
|
-
['cousine', 'Cousine (closed-caption style)', "'SK Cousine', 'Courier New', monospace"]
|
|
114
|
+
['atkinson', U.t('Atkinson Hyperlegible (easy reading)'), "'SK Atkinson Hyperlegible', Arial, sans-serif"],
|
|
115
|
+
['nunito', U.t('Nunito (rounded)'), "'SK Nunito', Arial, sans-serif"],
|
|
116
|
+
['cousine', U.t('Cousine (closed-caption style)'), "'SK Cousine', 'Courier New', monospace"]
|
|
111
117
|
];
|
|
112
118
|
function subFontFamily(id) {
|
|
113
119
|
for (var i = 0; i < SUB_FONTS.length; i++) { if (SUB_FONTS[i][0] === id) { return SUB_FONTS[i][2]; } }
|
|
@@ -158,6 +164,7 @@
|
|
|
158
164
|
if (all[k]) { all[k].added = true; }
|
|
159
165
|
else { all[k] = { id: e.id, type: e.type, name: e.name, poster: e.poster, background: e.background, parent: e.parent, position: 0, duration: 0, updated: Date.now(), added: true }; }
|
|
160
166
|
U.store.set(PROGRESS_KEY, all);
|
|
167
|
+
if (typeof StremioSync !== 'undefined' && StremioSync.onAdded) { StremioSync.onAdded(e); } // (your Stremio account's too, at its start)
|
|
161
168
|
}
|
|
162
169
|
|
|
163
170
|
function progressFor(type, id) { return progressAll()[type + ':' + id] || null; }
|
|
@@ -240,9 +247,9 @@
|
|
|
240
247
|
// [id, label, AVPlay display method, CSS object-fit for the desktop <video>]; remembered.
|
|
241
248
|
var PLAYERCFG_KEY = 'stremiok.playercfg';
|
|
242
249
|
var ASPECTS = [
|
|
243
|
-
['fit', 'Fit (whole picture)', 'PLAYER_DISPLAY_MODE_LETTER_BOX', 'contain'],
|
|
244
|
-
['zoom', 'Zoom (fill the screen, trims edges)', 'PLAYER_DISPLAY_MODE_CROPPED_FULL', 'cover'],
|
|
245
|
-
['stretch', 'Stretch', 'PLAYER_DISPLAY_MODE_FULL_SCREEN', 'fill']
|
|
250
|
+
['fit', U.t('Fit (whole picture)'), 'PLAYER_DISPLAY_MODE_LETTER_BOX', 'contain'],
|
|
251
|
+
['zoom', U.t('Zoom (fill the screen, trims edges)'), 'PLAYER_DISPLAY_MODE_CROPPED_FULL', 'cover'],
|
|
252
|
+
['stretch', U.t('Stretch'), 'PLAYER_DISPLAY_MODE_FULL_SCREEN', 'fill']
|
|
246
253
|
];
|
|
247
254
|
// + seek: how far LEFT / RIGHT jump (s); buffer: 'normal' (the TV's own) | 'more' | 'most';
|
|
248
255
|
// reconnect: a live channel that drops, 'off' | 'few' | 'always' (see player-core's liveDropped)
|
package/js/player-subs.js
CHANGED
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
var list = U.listOf(info && info.captions, 60, function (t) { return typeof t.lang === 'string' && /^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8}){0,2}$/.test(t.lang); });
|
|
159
159
|
list = list.filter(function (t) { return !t.auto; }).concat(list.filter(function (t) { return t.auto; }));
|
|
160
160
|
return list.map(function (t) {
|
|
161
|
-
return { id: 'yt:' + t.lang + (t.auto ? ':auto' : ''), lang: t.lang, url: YTPlay.subsUrl(ctx.yt, t.lang, !!t.auto), _addon: t.auto ? 'YouTube (automatic)' : 'YouTube' };
|
|
161
|
+
return { id: 'yt:' + t.lang + (t.auto ? ':auto' : ''), lang: t.lang, url: YTPlay.subsUrl(ctx.yt, t.lang, !!t.auto), _addon: t.auto ? U.t('YouTube (automatic)') : 'YouTube' };
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
}
|
|
192
192
|
// Stream info's "Subtitles" line.
|
|
193
193
|
function subtitleSummary() {
|
|
194
|
-
return _subOn ? (_subLabel + (_subDelay ? ' (' + fmtDelay(_subDelay) + ')' : '')) : (_embSub != null ? (_embLang || 'on') + ' (built-in)' : 'Off');
|
|
194
|
+
return _subOn ? (_subLabel + (_subDelay ? ' (' + fmtDelay(_subDelay) + ')' : '')) : (_embSub != null ? (_embLang || U.t('on')) + ' ' + U.t('(built-in)') : U.t('Off'));
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
// ---------- subtitles ----------
|
|
@@ -311,11 +311,11 @@
|
|
|
311
311
|
return U.getText(track.url, SUB_FILE_MS, undefined, cancel || null, false, track.headers || null).then(function (text) { keepSubFile(track.url, text); return text; }); // (a USB file's: the service's header where there's no token)
|
|
312
312
|
}
|
|
313
313
|
function loadTrack(track, onDone) {
|
|
314
|
-
if (!U.parseUrl(track.url)) { U.toast('That subtitle track has no usable link'); return; } // (http(s) only)
|
|
314
|
+
if (!U.parseUrl(track.url)) { U.toast(U.t('That subtitle track has no usable link')); return; } // (http(s) only)
|
|
315
315
|
var l = _subLoad;
|
|
316
316
|
if (l && l.url === track.url && l.ctx === S.ctx) { // (still coming: waited for, not asked for again)
|
|
317
317
|
if (onDone) { l.done.push(onDone); }
|
|
318
|
-
U.toast('Still loading subtitles… '
|
|
318
|
+
U.toast(U.t('Still loading subtitles… {n} s', { n: l.secs }), 1500);
|
|
319
319
|
return;
|
|
320
320
|
}
|
|
321
321
|
stopSubLoad();
|
|
@@ -324,8 +324,8 @@
|
|
|
324
324
|
var cancel = U.cancelToken(), mine = { url: track.url, ctx: forCtx, cancel: cancel, secs: 0, done: onDone ? [onDone] : [], timer: null };
|
|
325
325
|
if (subFile(track.url) === null) { // (a download: how long it's been, every second, till it's in)
|
|
326
326
|
_subLoad = mine;
|
|
327
|
-
U.toast('Loading subtitles…', 1500);
|
|
328
|
-
mine.timer = setInterval(function () { mine.secs++; if (_subLoad === mine) { U.toast('Loading subtitles… '
|
|
327
|
+
U.toast(U.t('Loading subtitles…'), 1500);
|
|
328
|
+
mine.timer = setInterval(function () { mine.secs++; if (_subLoad === mine) { U.toast(U.t('Loading subtitles… {n} s', { n: mine.secs }), 1500); } }, 1000);
|
|
329
329
|
}
|
|
330
330
|
function finished() { clearInterval(mine.timer); if (_subLoad === mine) { _subLoad = null; } }
|
|
331
331
|
onDone = function () { mine.done.forEach(function (f) { try { f(); } catch (e) {} }); };
|
|
@@ -333,14 +333,14 @@
|
|
|
333
333
|
finished();
|
|
334
334
|
if (stale()) { return; }
|
|
335
335
|
var cues = parseCues(text);
|
|
336
|
-
if (!cues.length) { U.toast('Could not parse subtitles'); return; }
|
|
336
|
+
if (!cues.length) { U.toast(U.t('Could not parse subtitles')); return; }
|
|
337
337
|
embOff(); // an addon track replaces a built-in one
|
|
338
338
|
_cues = cues; _cueIdx = 0; _cueT = 0; _subOn = true; _subLabel = track.lang || 'on'; _subTrackUrl = track.url;
|
|
339
339
|
_subTrackId = (track.id != null) ? track.id : null; _subDelay = 0;
|
|
340
340
|
renderSubs();
|
|
341
|
-
U.toast('Subtitles: '
|
|
341
|
+
U.toast(U.t('Subtitles: {what}', { what: track.lang || U.t('on') }));
|
|
342
342
|
onDone();
|
|
343
|
-
}, function () { finished(); if (!stale()) { U.toast('Failed to download subtitles'); } });
|
|
343
|
+
}, function () { finished(); if (!stale()) { U.toast(U.t('Failed to download subtitles')); } });
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
// ---------- the second subtitle ----------
|
|
@@ -402,7 +402,7 @@
|
|
|
402
402
|
function secondMenu() {
|
|
403
403
|
var keys = [], cur = getSubCfg().second;
|
|
404
404
|
_subTracks.forEach(function (t) { var k = langKey(t.lang); if (t.url && k && keys.indexOf(k) === -1) { keys.push(k); } });
|
|
405
|
-
var items = [{ label: 'Off', sel: cur === 'off', run: function () { var c = getSubCfg(); c.second = 'off'; setSubCfg(c); secondOff(); popMenu(); } }];
|
|
405
|
+
var items = [{ label: U.t('Off'), sel: cur === 'off', run: function () { var c = getSubCfg(); c.second = 'off'; setSubCfg(c); secondOff(); popMenu(); } }];
|
|
406
406
|
keys.forEach(function (k) {
|
|
407
407
|
items.push({ label: langName(k), sel: langKey(cur) === k, run: function () {
|
|
408
408
|
var c = getSubCfg(); c.second = /^[a-z]{2,3}$/.test(k) ? k : 'off'; setSubCfg(c); secondOff(); startSecond(); popMenu();
|
|
@@ -410,7 +410,7 @@
|
|
|
410
410
|
});
|
|
411
411
|
var idx = 0;
|
|
412
412
|
items.forEach(function (it, i) { if (it.sel) { idx = i; } });
|
|
413
|
-
return { title: 'Second subtitle (at the top)', items: items, idx: idx };
|
|
413
|
+
return { title: U.t('Second subtitle (at the top)'), items: items, idx: idx };
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
function subsOff() {
|
|
@@ -459,7 +459,7 @@
|
|
|
459
459
|
try { avplay.setSelectTrack('TEXT', tr.index); }
|
|
460
460
|
catch (e2) { try { avplay.setSelectTrack('TEXT', '' + tr.index); } catch (e3) {} }
|
|
461
461
|
_embSub = tr.index; _embLang = textLang(tr);
|
|
462
|
-
U.toast('Subtitles: '
|
|
462
|
+
U.toast(U.t('Subtitles: {what}', { what: (_embLang || U.t('on')) + ' ' + (S.ctx && S.ctx._relayCc ? U.t('(closed captions)') : U.t('(built-in)')) }), 1800);
|
|
463
463
|
}
|
|
464
464
|
function embOff() {
|
|
465
465
|
if (_embSub != null) { try { avplay.setSilentSubtitle(true); } catch (e) {} }
|
|
@@ -524,18 +524,18 @@
|
|
|
524
524
|
|
|
525
525
|
function subConfigMenu() {
|
|
526
526
|
var items = [
|
|
527
|
-
{ label: 'Language', run: function () { pushMenu(langMenu()); } },
|
|
528
|
-
{ label: 'Size', run: function () { pushMenu(sizeMenu()); } },
|
|
529
|
-
{ label: 'Color', run: function () { pushMenu(optionMenu('Subtitle color', 'color', P.SUB_COLORS)); } },
|
|
530
|
-
{ label: 'Background', run: function () { pushMenu(optionMenu('Subtitle background', 'bg', P.SUB_BGS)); } },
|
|
531
|
-
{ label: 'Edge', run: function () { pushMenu(optionMenu('Subtitle edge', 'edge', P.SUB_EDGES)); } },
|
|
532
|
-
{ label: 'Position', run: function () { pushMenu(optionMenu('Subtitle position', 'pos', P.SUB_POSITIONS)); } },
|
|
533
|
-
{ label: 'Font', run: function () { pushMenu(fontMenu()); } }
|
|
527
|
+
{ label: U.t('Language'), run: function () { pushMenu(langMenu()); } },
|
|
528
|
+
{ label: U.t('Size'), run: function () { pushMenu(sizeMenu()); } },
|
|
529
|
+
{ label: U.t('Color'), run: function () { pushMenu(optionMenu(U.t('Subtitle color'), 'color', P.SUB_COLORS)); } },
|
|
530
|
+
{ label: U.t('Background'), run: function () { pushMenu(optionMenu(U.t('Subtitle background'), 'bg', P.SUB_BGS)); } },
|
|
531
|
+
{ label: U.t('Edge'), run: function () { pushMenu(optionMenu(U.t('Subtitle edge'), 'edge', P.SUB_EDGES)); } },
|
|
532
|
+
{ label: U.t('Position'), run: function () { pushMenu(optionMenu(U.t('Subtitle position'), 'pos', P.SUB_POSITIONS)); } },
|
|
533
|
+
{ label: U.t('Font'), run: function () { pushMenu(fontMenu()); } }
|
|
534
534
|
];
|
|
535
535
|
// timing applies to addon subtitles (built-in ones are timed by the player)
|
|
536
|
-
if (_subOn) { items.splice(1, 0, { label: 'Timing', detail: fmtDelay(_subDelay), run: function () { pushMenu(timingMenu(5)); } }); } // (opens on the small steps)
|
|
537
|
-
else if (_embSub != null) { items.splice(1, 0, { label: 'Timing', detail: fmtDelay(_embDelay) + ' · built-in: later only', run: function () { pushMenu(embTimingMenu(0)); } }); }
|
|
538
|
-
return { title: 'Subtitles', idx: 0, items: items, rebuild: subConfigMenu };
|
|
536
|
+
if (_subOn) { items.splice(1, 0, { label: U.t('Timing'), detail: fmtDelay(_subDelay), run: function () { pushMenu(timingMenu(5)); } }); } // (opens on the small steps)
|
|
537
|
+
else if (_embSub != null) { items.splice(1, 0, { label: U.t('Timing'), detail: fmtDelay(_embDelay) + ' · ' + U.t('built-in: later only'), run: function () { pushMenu(embTimingMenu(0)); } }); }
|
|
538
|
+
return { title: U.t('Subtitles'), idx: 0, items: items, rebuild: subConfigMenu };
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
function fmtDelay(d) { return (d > 0 ? '+' : d < 0 ? '−' : '') + Math.abs(d).toFixed(1) + ' s'; }
|
|
@@ -547,23 +547,23 @@
|
|
|
547
547
|
rememberSub(S.ctx.id, { lang: _subLabel, url: _subTrackUrl, trackId: _subTrackId, delay: _subDelay });
|
|
548
548
|
renderSubs();
|
|
549
549
|
replaceTop(timingMenu(topMenu().idx));
|
|
550
|
-
U.toast('Subtitles: '
|
|
550
|
+
U.toast(U.t('Subtitles: {what}', { what: fmtDelay(_subDelay) + ' ' + (_subDelay > 0 ? U.t('(later)') : _subDelay < 0 ? U.t('(earlier)') : U.t('(as in the file)')) }), 1500);
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
|
-
return { title: 'Subtitle timing: '
|
|
553
|
+
return { title: U.t('Subtitle timing: {delay}', { delay: fmtDelay(_subDelay) }), idx: idx || 0, items: [
|
|
554
554
|
// by ear: the moment you hear a line sets the timing (then the steps fine-tune it)
|
|
555
|
-
{ label: 'Press when you hear it', detail: 'the next line: OK the moment it’s said', run: function () { pushMenu(earMenu()); } },
|
|
556
|
-
{ label: 'Pick the line being said', detail: 'from the lines around now', run: function () { pushMenu(lineMenu()); } },
|
|
555
|
+
{ label: U.t('Press when you hear it'), detail: U.t('the next line: OK the moment it’s said'), run: function () { pushMenu(earMenu()); } },
|
|
556
|
+
{ label: U.t('Pick the line being said'), detail: U.t('from the lines around now'), run: function () { pushMenu(lineMenu()); } },
|
|
557
557
|
// (a file made for another release can be seconds off: the big steps get there)
|
|
558
|
-
{ label: 'Earlier −5 s', run: to(function () { return _subDelay - 5; }) },
|
|
559
|
-
{ label: 'Earlier −1 s', run: to(function () { return _subDelay - 1; }) },
|
|
560
|
-
{ label: 'Earlier −0.5 s', run: to(function () { return _subDelay - 0.5; }) },
|
|
561
|
-
{ label: 'Earlier −0.1 s', run: to(function () { return _subDelay - 0.1; }) },
|
|
562
|
-
{ label: 'Later +0.1 s', run: to(function () { return _subDelay + 0.1; }) },
|
|
563
|
-
{ label: 'Later +0.5 s', run: to(function () { return _subDelay + 0.5; }) },
|
|
564
|
-
{ label: 'Later +1 s', run: to(function () { return _subDelay + 1; }) },
|
|
565
|
-
{ label: 'Later +5 s', run: to(function () { return _subDelay + 5; }) },
|
|
566
|
-
{ label: 'Reset', run: to(function () { return 0; }) }
|
|
558
|
+
{ label: U.t('Earlier −5 s'), run: to(function () { return _subDelay - 5; }) },
|
|
559
|
+
{ label: U.t('Earlier −1 s'), run: to(function () { return _subDelay - 1; }) },
|
|
560
|
+
{ label: U.t('Earlier −0.5 s'), run: to(function () { return _subDelay - 0.5; }) },
|
|
561
|
+
{ label: U.t('Earlier −0.1 s'), run: to(function () { return _subDelay - 0.1; }) },
|
|
562
|
+
{ label: U.t('Later +0.1 s'), run: to(function () { return _subDelay + 0.1; }) },
|
|
563
|
+
{ label: U.t('Later +0.5 s'), run: to(function () { return _subDelay + 0.5; }) },
|
|
564
|
+
{ label: U.t('Later +1 s'), run: to(function () { return _subDelay + 1; }) },
|
|
565
|
+
{ label: U.t('Later +5 s'), run: to(function () { return _subDelay + 5; }) },
|
|
566
|
+
{ label: U.t('Reset'), run: to(function () { return 0; }) }
|
|
567
567
|
] };
|
|
568
568
|
}
|
|
569
569
|
|
|
@@ -574,24 +574,24 @@
|
|
|
574
574
|
renderSubs();
|
|
575
575
|
popMenu();
|
|
576
576
|
replaceTop(timingMenu(topMenu().idx));
|
|
577
|
-
U.toast('Subtitles: '
|
|
577
|
+
U.toast(U.t('Subtitles: {what}', { what: fmtDelay(_subDelay) + ' ' + (_subDelay > 0 ? U.t('(later)') : _subDelay < 0 ? U.t('(earlier)') : U.t('(as in the file)')) }), 1800);
|
|
578
578
|
}
|
|
579
579
|
function lineText(c) { return '“' + noTags('' + c.text).replace(/\s+/g, ' ').trim().slice(0, 70) + '”'; }
|
|
580
580
|
// The next line coming up (as timed now): OK the moment it's said.
|
|
581
581
|
function earMenu() {
|
|
582
582
|
var t = S.cur - _subDelay, next = null;
|
|
583
583
|
for (var i = 0; _cues && i < _cues.length; i++) { if (_cues[i].start > t + 0.3) { next = _cues[i]; break; } }
|
|
584
|
-
if (!next) { return { title: 'Press when you hear it', idx: 0, items: [{ label: 'No line coming up', run: function () { popMenu(); } }] }; }
|
|
585
|
-
return { title: 'Press OK when you hear it', idx: 0, items: [{ label: lineText(next), detail: 'OK the moment it’s said · BACK: never mind', run: function () { syncTo(next.start); } }] };
|
|
584
|
+
if (!next) { return { title: U.t('Press when you hear it'), idx: 0, items: [{ label: U.t('No line coming up'), run: function () { popMenu(); } }] }; }
|
|
585
|
+
return { title: U.t('Press OK when you hear it'), idx: 0, items: [{ label: lineText(next), detail: U.t('OK the moment it’s said · BACK: never mind'), run: function () { syncTo(next.start); } }] };
|
|
586
586
|
}
|
|
587
587
|
// The lines around now (as timed now): pick the one being said, or just said.
|
|
588
588
|
function lineMenu() {
|
|
589
589
|
var t = S.cur - _subDelay, at = 0;
|
|
590
590
|
for (var i = 0; _cues && i < _cues.length; i++) { if (_cues[i].start <= t) { at = i; } }
|
|
591
591
|
var from = Math.max(0, at - 4), list = (_cues || []).slice(from, at + 4);
|
|
592
|
-
if (!list.length) { return { title: 'Pick the line being said', idx: 0, items: [{ label: 'No lines in this file', run: function () { popMenu(); } }] }; }
|
|
593
|
-
return { title: 'Pick the line being said', idx: at - from, items: list.map(function (c) {
|
|
594
|
-
return { label: lineText(c), detail: 'at '
|
|
592
|
+
if (!list.length) { return { title: U.t('Pick the line being said'), idx: 0, items: [{ label: U.t('No lines in this file'), run: function () { popMenu(); } }] }; }
|
|
593
|
+
return { title: U.t('Pick the line being said'), idx: at - from, items: list.map(function (c) {
|
|
594
|
+
return { label: lineText(c), detail: U.t('at {at} in the file', { at: U.fmtTime(c.start) }), run: function () { syncTo(c.start); } };
|
|
595
595
|
}) };
|
|
596
596
|
}
|
|
597
597
|
|
|
@@ -605,17 +605,17 @@
|
|
|
605
605
|
_embQueue = [];
|
|
606
606
|
rememberSub(S.ctx.id, { embedded: true, index: _embSub, lang: _embLang, delay: _embDelay });
|
|
607
607
|
replaceTop(embTimingMenu(topMenu().idx));
|
|
608
|
-
U.toast(want < 0 ? 'Built-in subtitles can\'t come earlier than the file has them' : 'Subtitles: '
|
|
608
|
+
U.toast(want < 0 ? U.t('Built-in subtitles can\'t come earlier than the file has them') : U.t('Subtitles: {what}', { what: fmtDelay(_embDelay) + ' ' + (_embDelay ? U.t('(later)') : U.t('(as in the file)')) }), 1800);
|
|
609
609
|
};
|
|
610
610
|
}
|
|
611
|
-
return { title: 'Built-in subtitle timing: '
|
|
612
|
-
{ label: 'Later +0.1 s', run: to(function () { return _embDelay + 0.1; }) },
|
|
613
|
-
{ label: 'Later +0.5 s', run: to(function () { return _embDelay + 0.5; }) },
|
|
614
|
-
{ label: 'Later +1 s', run: to(function () { return _embDelay + 1; }) },
|
|
615
|
-
{ label: 'Later +5 s', run: to(function () { return _embDelay + 5; }) },
|
|
616
|
-
{ label: 'Back −0.5 s', run: to(function () { return _embDelay - 0.5; }) },
|
|
617
|
-
{ label: 'Back −1 s', run: to(function () { return _embDelay - 1; }) },
|
|
618
|
-
{ label: 'Reset (as in the file)', run: to(function () { return 0; }) }
|
|
611
|
+
return { title: U.t('Built-in subtitle timing: {delay}', { delay: fmtDelay(_embDelay) }), idx: idx || 0, items: [
|
|
612
|
+
{ label: U.t('Later +0.1 s'), run: to(function () { return _embDelay + 0.1; }) },
|
|
613
|
+
{ label: U.t('Later +0.5 s'), run: to(function () { return _embDelay + 0.5; }) },
|
|
614
|
+
{ label: U.t('Later +1 s'), run: to(function () { return _embDelay + 1; }) },
|
|
615
|
+
{ label: U.t('Later +5 s'), run: to(function () { return _embDelay + 5; }) },
|
|
616
|
+
{ label: U.t('Back −0.5 s'), run: to(function () { return _embDelay - 0.5; }) },
|
|
617
|
+
{ label: U.t('Back −1 s'), run: to(function () { return _embDelay - 1; }) },
|
|
618
|
+
{ label: U.t('Reset (as in the file)'), run: to(function () { return 0; }) }
|
|
619
619
|
] };
|
|
620
620
|
}
|
|
621
621
|
|
|
@@ -655,23 +655,23 @@
|
|
|
655
655
|
var na = langName(a), nb = langName(b);
|
|
656
656
|
return na < nb ? -1 : na > nb ? 1 : 0;
|
|
657
657
|
});
|
|
658
|
-
var items = [{ label: 'Off', sel: !_subOn && _embSub == null, run: function () { subsOff(); secondOff(); rememberSub(S.ctx.id, { off: true }); closeMenu(); } }];
|
|
658
|
+
var items = [{ label: U.t('Off'), sel: !_subOn && _embSub == null, run: function () { subsOff(); secondOff(); rememberSub(S.ctx.id, { off: true }); closeMenu(); } }];
|
|
659
659
|
order.forEach(function (k) {
|
|
660
660
|
var list = groups[k], n = list.length, emb = list.filter(function (x) { return x.emb; }).length;
|
|
661
661
|
items.push({ label: langName(k),
|
|
662
|
-
detail: n
|
|
662
|
+
detail: U.tn(n, '{n} option', '{n} options') + (emb ? ', ' + (emb === n ? inFile() : emb + ' ' + inFile()) : ''),
|
|
663
663
|
sel: (k === curKey),
|
|
664
664
|
run: function () { pushMenu(langTracksMenu(k, list)); } });
|
|
665
665
|
});
|
|
666
|
-
if (hidden) { items.push({ label: 'Other languages', detail:
|
|
666
|
+
if (hidden) { items.push({ label: U.t('Other languages'), detail: U.t('{n} more', { n: hidden }), run: function () { pushMenu(langMenu(true)); } }); }
|
|
667
667
|
var sec = getSubCfg().second;
|
|
668
|
-
if (_subTracks.length) { items.push({ label: 'Second subtitle: ' + (sec === 'off' ? 'Off' : langName(sec)), detail: 'At the top, at the same time', run: function () { pushMenu(secondMenu()); } }); }
|
|
668
|
+
if (_subTracks.length) { items.push({ label: U.t('Second subtitle:') + ' ' + (sec === 'off' ? U.t('Off') : langName(sec)), detail: U.t('At the top, at the same time'), run: function () { pushMenu(secondMenu()); } }); }
|
|
669
669
|
var idx = 0;
|
|
670
670
|
for (var i = 0; i < items.length; i++) { if (items[i].sel) { idx = i; break; } }
|
|
671
|
-
return { title: all ? 'All subtitle languages' : 'Subtitle language', items: items, idx: idx, rebuild: function () { return langMenu(all); } };
|
|
671
|
+
return { title: all ? U.t('All subtitle languages') : U.t('Subtitle language'), items: items, idx: idx, rebuild: function () { return langMenu(all); } };
|
|
672
672
|
}
|
|
673
673
|
|
|
674
|
-
function inFile() { return S.ctx && (S.ctx._relayCc || S.ctx._ccOffer) ? 'closed captions' : 'in the file'; }
|
|
674
|
+
function inFile() { return S.ctx && (S.ctx._relayCc || S.ctx._ccOffer) ? U.t('closed captions') : U.t('in the file'); }
|
|
675
675
|
// Level 2: the tracks in one language: the file's own first, then each addon's.
|
|
676
676
|
// Picking a track keeps the menu open, the checkmark on it (an addon's once it loads), so
|
|
677
677
|
// several can be tried in a row: the file's own the same as an addon's.
|
|
@@ -681,13 +681,13 @@
|
|
|
681
681
|
var items = list.map(function (x, i) {
|
|
682
682
|
if (x.cc) { // (turning a live channel's closed captions on: it restarts with them)
|
|
683
683
|
var c = x.cc;
|
|
684
|
-
return { label: 'Closed captions ('
|
|
684
|
+
return { label: U.t('Closed captions ({ch})', { ch: c.ch }), detail: U.t('The channel restarts with them'),
|
|
685
685
|
run: function () { closeMenu(); rememberSub(S.ctx.id, { embedded: true, nth: x.n, lang: c.lang }); P.ccOn(c); } };
|
|
686
686
|
}
|
|
687
687
|
if (x.emb) {
|
|
688
688
|
var tr = x.emb, l = textLang(tr);
|
|
689
689
|
if (_embSub === tr.index) { idx = i; }
|
|
690
|
-
return { label: (S.ctx && S.ctx._relayCc ? 'Closed captions' : 'Built into the file') + (l ? ' (' + l + ')' : ' · track '
|
|
690
|
+
return { label: (S.ctx && S.ctx._relayCc ? U.t('Closed captions') : U.t('Built into the file')) + (l ? ' (' + l + ')' : ' · ' + U.t('track {n}', { n: x.n + 1 })), sel: _embSub === tr.index,
|
|
691
691
|
run: function () {
|
|
692
692
|
_embDelay = 0; _embQueue = []; _embNudge = null; selectEmbeddedSub(tr); rememberSub(S.ctx.id, { embedded: true, index: tr.index, lang: l });
|
|
693
693
|
if (menuOpen()) { replaceTop(langTracksMenu(key, list)); }
|
|
@@ -696,7 +696,7 @@
|
|
|
696
696
|
var t = x.track;
|
|
697
697
|
nAddon++;
|
|
698
698
|
if (_subTrackUrl === t.url) { idx = i; }
|
|
699
|
-
return { label: t._file ? t._addon + ' · ' + t._file : (t._addon || 'Source') + ' · option '
|
|
699
|
+
return { label: t._file ? t._addon + ' · ' + t._file : (t._addon || U.t('Source')) + ' · ' + U.t('option {n}', { n: nAddon }) +
|
|
700
700
|
(t.lang && langName(t.lang).toLowerCase() !== ('' + t.lang).toLowerCase() ? ' (' + t.lang + ')' : ''),
|
|
701
701
|
sel: (_subTrackUrl === t.url),
|
|
702
702
|
run: function () {
|
|
@@ -706,7 +706,7 @@
|
|
|
706
706
|
rememberSub(S.ctx.id, { lang: t.lang, url: t.url, trackId: t.id });
|
|
707
707
|
} };
|
|
708
708
|
});
|
|
709
|
-
return { title:
|
|
709
|
+
return { title: U.t('{language} subtitles', { language: langName(key) }), items: items, idx: idx };
|
|
710
710
|
}
|
|
711
711
|
|
|
712
712
|
function optionMenu(title, key, opts) {
|
|
@@ -722,17 +722,17 @@
|
|
|
722
722
|
return { title: title, items: items, idx: idx };
|
|
723
723
|
}
|
|
724
724
|
function sizeMenu() {
|
|
725
|
-
return optionMenu('Subtitle size', 'size',
|
|
726
|
-
[['small', 'Small'], ['medium', 'Medium'], ['large', 'Large'], ['xlarge', 'Extra Large']]);
|
|
725
|
+
return optionMenu(U.t('Subtitle size'), 'size',
|
|
726
|
+
[['small', U.t('Small')], ['medium', U.t('Medium')], ['large', U.t('Large')], ['xlarge', U.t('Extra Large')]]);
|
|
727
727
|
}
|
|
728
|
-
function fontMenu() { return optionMenu('Subtitle font', 'font', P.SUB_FONTS); }
|
|
728
|
+
function fontMenu() { return optionMenu(U.t('Subtitle font'), 'font', P.SUB_FONTS); }
|
|
729
729
|
|
|
730
730
|
// ----- for the other parts (and js/player.js) -----
|
|
731
731
|
// The player's number keys (player-controls' numberKey): 1 / 2 / 3 timing (an addon track's
|
|
732
732
|
// earlier / as the file / later, kept for the title as the Timing menu's; a built-in track's
|
|
733
733
|
// later only), 4 / 5 / 6 position, 7 / 8 / 9 size. Each says what it did.
|
|
734
|
-
var KEY_POS = { 4: ['lower', 'Lower'], 5: ['bottom', 'Bottom'], 6: ['raised', 'Raised'] };
|
|
735
|
-
var KEY_SIZE = { 7: ['medium', 'Medium'], 8: ['large', 'Large'], 9: ['xlarge', 'Extra Large'] };
|
|
734
|
+
var KEY_POS = { 4: ['lower', U.t('Lower')], 5: ['bottom', U.t('Bottom')], 6: ['raised', U.t('Raised')] };
|
|
735
|
+
var KEY_SIZE = { 7: ['medium', U.t('Medium')], 8: ['large', U.t('Large')], 9: ['xlarge', U.t('Extra Large')] };
|
|
736
736
|
function subsKey(n) {
|
|
737
737
|
if (n >= 1 && n <= 3) {
|
|
738
738
|
var step = n === 1 ? -0.1 : n === 3 ? 0.1 : 0;
|
|
@@ -740,14 +740,14 @@
|
|
|
740
740
|
_subDelay = step ? Math.round((_subDelay + step) * 10) / 10 : 0;
|
|
741
741
|
rememberSub(S.ctx.id, { lang: _subLabel, url: _subTrackUrl, trackId: _subTrackId, delay: _subDelay });
|
|
742
742
|
renderSubs();
|
|
743
|
-
U.toast('Subtitles: '
|
|
743
|
+
U.toast(U.t('Subtitles: {what}', { what: fmtDelay(_subDelay) + ' ' + (_subDelay > 0 ? U.t('(later)') : _subDelay < 0 ? U.t('(earlier)') : U.t('(as in the file)')) }), 1500);
|
|
744
744
|
} else if (_embSub != null) {
|
|
745
745
|
var was = _embDelay;
|
|
746
746
|
_embDelay = step ? Math.max(0, Math.round((_embDelay + step) * 10) / 10) : 0;
|
|
747
747
|
rememberSub(S.ctx.id, { embedded: true, index: _embSub, lang: _embLang, delay: _embDelay });
|
|
748
|
-
U.toast('Subtitles: '
|
|
748
|
+
U.toast(U.t('Subtitles: {what}', { what: fmtDelay(_embDelay) + (step < 0 && was === 0 ? ' ' + U.t('(built-in: later only)') : '') }), 1500);
|
|
749
749
|
} else {
|
|
750
|
-
U.toast('No subtitles on', 1500);
|
|
750
|
+
U.toast(U.t('No subtitles on'), 1500);
|
|
751
751
|
}
|
|
752
752
|
return;
|
|
753
753
|
}
|
|
@@ -758,7 +758,7 @@
|
|
|
758
758
|
setSubCfg(cfg);
|
|
759
759
|
var span = S.subsEl && S.subsEl.firstChild;
|
|
760
760
|
if (span) { styleSpan(span); }
|
|
761
|
-
U.toast('Subtitles: '
|
|
761
|
+
U.toast(U.t('Subtitles: {what}', { what: look[0] === 'size' ? U.t('{size} size', { size: look[1][1] }) : look[1][1] }), 1500);
|
|
762
762
|
}
|
|
763
763
|
// The subtitle that's on, for a download (player-controls): an addon's file { url, lang },
|
|
764
764
|
// { embedded: true } (built into the video: it comes with it), or null (off).
|