stremiok 2.3.4 → 2.3.6

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +14 -13
  3. package/config.xml +1 -1
  4. package/css/style.css +5 -0
  5. package/index.html +43 -40
  6. package/js/app.js +3 -3
  7. package/js/downloads.js +16 -16
  8. package/js/epg.js +2 -3
  9. package/js/hubpreview.js +1 -1
  10. package/js/i18n.js +108 -0
  11. package/js/iptv.js +13 -13
  12. package/js/jellyfin.js +19 -19
  13. package/js/lang/ar.js +1972 -0
  14. package/js/lang/de.js +1972 -0
  15. package/js/lang/es.js +1972 -0
  16. package/js/lang/fi.js +1972 -0
  17. package/js/lang/fr.js +1972 -0
  18. package/js/lang/he.js +1972 -0
  19. package/js/lang/hi.js +1972 -0
  20. package/js/lang/it.js +1972 -0
  21. package/js/lang/ja.js +1972 -0
  22. package/js/lang/ko.js +1972 -0
  23. package/js/lang/languages.js +21 -0
  24. package/js/lang/pl.js +1972 -0
  25. package/js/lang/pt-BR.js +1972 -0
  26. package/js/lang/ru.js +1972 -0
  27. package/js/lang/tr.js +1972 -0
  28. package/js/lang/zh-CN.js +1972 -0
  29. package/js/local.js +9 -9
  30. package/js/netfolders.js +13 -13
  31. package/js/player-audio.js +17 -17
  32. package/js/player-controls.js +100 -100
  33. package/js/player-core.js +90 -58
  34. package/js/player-lang.js +22 -22
  35. package/js/player-quality.js +15 -15
  36. package/js/player-store.js +13 -13
  37. package/js/player-subs.js +69 -69
  38. package/js/plex.js +11 -11
  39. package/js/plugins.js +270 -0
  40. package/js/stremio-account.js +8 -8
  41. package/js/stremio-sync.js +5 -5
  42. package/js/stremio.js +81 -78
  43. package/js/stvod.js +4 -4
  44. package/js/trakt.js +23 -23
  45. package/js/tvapps.js +4 -4
  46. package/js/util.js +48 -27
  47. package/js/vendor/quickjs/LICENSES.md +412 -0
  48. package/js/vendor/quickjs/crypto-js.js +6659 -0
  49. package/js/vendor/quickjs/plugin-worker-legacy.js +1364 -0
  50. package/js/vendor/quickjs/plugin-worker.js +8774 -0
  51. package/js/vendor/quickjs/quickjs.wasm +0 -0
  52. package/js/view-core.js +93 -93
  53. package/js/view-detail.js +132 -130
  54. package/js/view-discover.js +27 -27
  55. package/js/view-guide.js +13 -13
  56. package/js/view-home.js +124 -118
  57. package/js/view-search.js +25 -25
  58. package/js/view-settings.js +743 -643
  59. package/js/xtvod.js +2 -2
  60. package/js/youtube.js +17 -17
  61. package/js/ytplay.js +39 -9
  62. package/package.json +1 -1
  63. package/service/index.js +227 -13
  64. package/tizenbrew.html +1 -1
@@ -84,14 +84,14 @@
84
84
  if (type === 'sb') { // (SponsorBlock: "Skip Sponsor")
85
85
  buttons.push({ label: seg.label + ' ▸', run: function () { seekTo(seg.end); hideSkip(); } });
86
86
  } else if (type === 'intro' || type === 'recap' || type === 'preview') {
87
- var base = type === 'intro' ? 'Skip Intro' : type === 'recap' ? 'Skip Recap' : 'Skip Preview';
87
+ var base = type === 'intro' ? U.t('Skip Intro') : type === 'recap' ? U.t('Skip Recap') : U.t('Skip Preview');
88
88
  buttons.push({ label: base, run: function () { if (seg.end != null) { seekTo(seg.end); } hideSkip(); } });
89
89
  // Skipping on its own (Settings › Playback › Skipping): a countdown in video time (it
90
90
  // waits while paused), and Cancel; see skipTick.
91
91
  var auto = autoSkipSecs();
92
92
  if (auto && seg.end != null) {
93
93
  buttons[0].label = base + ' · ' + auto;
94
- buttons.push({ label: 'Cancel', run: function () { hideSkip(); } });
94
+ buttons.push({ label: U.t('Cancel'), run: function () { hideSkip(); } });
95
95
  _skip = { type: type, buttons: buttons, idx: 0, timer: null, countdown: { secs: auto, from: S.cur, seg: seg, base: base } };
96
96
  renderSkip();
97
97
  return;
@@ -102,14 +102,14 @@
102
102
  hideSkip();
103
103
  if (S.ctx.nextEpisode && S.ctx.playNext) { S.ctx.playNext(); } else { exit(); }
104
104
  };
105
- buttons.push({ label: S.ctx.nextEpisode ? 'Skip Credits → Next' : 'Skip Credits', run: goOn });
106
- buttons.push({ label: 'Watch Credits', run: function () { hideSkip(); } });
105
+ buttons.push({ label: S.ctx.nextEpisode ? U.t('Skip Credits → Next') : U.t('Skip Credits'), run: goOn });
106
+ buttons.push({ label: U.t('Watch Credits'), run: function () { hideSkip(); } });
107
107
  // The next episode on its own (Settings › Playback › Skipping): a countdown in video
108
108
  // time, as the intro's; Watch Credits stays. Without a next episode: the prompt.
109
109
  var next = autoNextSecs();
110
110
  if (next && S.ctx.nextEpisode && S.ctx.playNext) {
111
- buttons[0].label = 'Next episode · ' + next;
112
- _skip = { type: type, buttons: buttons, idx: 0, timer: null, countdown: { secs: next, from: S.cur, base: 'Next episode', run: goOn } };
111
+ buttons[0].label = U.t('Next episode') + ' · ' + next;
112
+ _skip = { type: type, buttons: buttons, idx: 0, timer: null, countdown: { secs: next, from: S.cur, base: U.t('Next episode'), run: goOn } };
113
113
  renderSkip();
114
114
  return;
115
115
  }
@@ -183,7 +183,7 @@
183
183
  var _scrub = null; // { target, from, dir, presses, timer }
184
184
 
185
185
  function scrub(delta) {
186
- if (S.isLive) { showOSD(false); U.toast('Live — seeking unavailable', 1500); return; }
186
+ if (S.isLive) { showOSD(false); U.toast(U.t('Live — seeking unavailable'), 1500); return; }
187
187
  if (!_scrub) { _scrub = { target: S.cur, from: S.cur, dir: 0, presses: 0, timer: null }; }
188
188
  var dir = delta > 0 ? 1 : -1;
189
189
  if (dir !== _scrub.dir) { _scrub.dir = dir; _scrub.presses = 0; }
@@ -322,26 +322,26 @@
322
322
  function barButtons() {
323
323
  // Glyphs kept to the old Geometric-Shapes/Arrows blocks — the media-control
324
324
  // symbols (⏵ ⏸ ⏮ ⏭ ⤶) don't render on Tizen 3.0's fonts.
325
- var b = [{ label: isPaused() ? '▶ Play' : '‖ Pause', run: togglePlay }];
326
- if (!S.isLive) { b.push({ label: '↺ Restart', run: function () { seekTo(0); closeBar(); } }); }
327
- if (chapters().length) { b.push({ label: '≡ Chapters', run: function () { closeBar(); openMenu(chaptersMenu()); } }); }
325
+ var b = [{ label: isPaused() ? U.t('▶ Play') : U.t('‖ Pause'), run: togglePlay }];
326
+ if (!S.isLive) { b.push({ label: U.t('↺ Restart'), run: function () { seekTo(0); closeBar(); } }); }
327
+ if (chapters().length) { b.push({ label: U.t('≡ Chapters'), run: function () { closeBar(); openMenu(chaptersMenu()); } }); }
328
328
  var hl = sponsorHighlight();
329
- if (hl !== null && !S.isLive) { b.push({ label: '◆ Highlight', run: function () { closeBar(); seekTo(hl); } }); }
330
- if (S.ctx.hasPrev) { b.push({ label: '◀◀ Previous', run: function () { closeBar(); S.ctx.playPrev(); } }); }
331
- if (S.ctx.hasNext) { b.push({ label: '▶▶ Next', run: function () { closeBar(); S.ctx.playNext(); } }); }
332
- if (castTitle()) { b.push({ label: 'ⓘ Cast & more', run: function () { closeBar(); openCast(); } }); }
329
+ if (hl !== null && !S.isLive) { b.push({ label: U.t('◆ Highlight'), run: function () { closeBar(); seekTo(hl); } }); }
330
+ if (S.ctx.hasPrev) { b.push({ label: U.t('◀◀ Previous'), run: function () { closeBar(); S.ctx.playPrev(); } }); }
331
+ if (S.ctx.hasNext) { b.push({ label: U.t('▶▶ Next'), run: function () { closeBar(); S.ctx.playNext(); } }); }
332
+ if (castTitle()) { b.push({ label: U.t('ⓘ Cast & more'), run: function () { closeBar(); openCast(); } }); }
333
333
  // continue on phone (its QR, in the menu's panel), and private viewing from now on
334
- if (phoneLink()) { b.push({ label: '▣ Phone', run: function () { closeBar(); openMenu(phoneMenu()); } }); }
335
- if (canDownload()) { b.push({ label: '⬇ Download', run: function () { closeBar(); downloadPlaying(); } }); }
334
+ if (phoneLink()) { b.push({ label: U.t('▣ Phone'), run: function () { closeBar(); openMenu(phoneMenu()); } }); }
335
+ if (canDownload()) { b.push({ label: U.t('⬇ Download'), run: function () { closeBar(); downloadPlaying(); } }); }
336
336
  if (!S.ctx.trailer && !S.isLive) {
337
337
  var priv = !!S.ctx.private;
338
- b.push({ label: '◐ Private: ' + (priv ? 'On' : 'Off'), run: function () {
338
+ b.push({ label: '◐ ' + U.t('Private:') + ' ' + (priv ? U.t('On') : U.t('Off')), run: function () {
339
339
  P.setPrivate(!priv);
340
- U.toast(!priv ? 'Private viewing: not tracked from now on' : 'Private viewing off: tracked again', 2500);
340
+ U.toast(!priv ? U.t('Private viewing: not tracked from now on') : U.t('Private viewing off: tracked again'), 2500);
341
341
  closeBar();
342
342
  } });
343
343
  }
344
- b.push({ label: '← Back', run: function () { exit(); } }); // stop playback, return to the previous page
344
+ b.push({ label: U.t('← Back'), run: function () { exit(); } }); // stop playback, return to the previous page
345
345
  return b;
346
346
  }
347
347
  // The bar closes by itself after BAR_IDLE_MS without a key on it (Cast & more doesn't).
@@ -433,10 +433,10 @@
433
433
  drawCast();
434
434
  level.load().then(function (items) {
435
435
  level.items = items || [];
436
- if (!level.items.length) { level.note = level.kind === 'cast' ? 'TMDB has no cast for this title.' : 'TMDB has no movies or series for them.'; }
436
+ if (!level.items.length) { level.note = level.kind === 'cast' ? U.t('TMDB has no cast for this title.') : U.t('TMDB has no movies or series for them.'); }
437
437
  if (_cast === me && topCast() === level) { drawCast(); }
438
438
  }, function () {
439
- level.items = []; level.note = 'Couldn\'t reach TMDB.';
439
+ level.items = []; level.note = U.t('Couldn\'t reach TMDB.');
440
440
  if (_cast === me && topCast() === level) { drawCast(); }
441
441
  });
442
442
  }
@@ -453,7 +453,7 @@
453
453
  card.appendChild(U.el('div', 'cs-photo cs-none', (it.name || '?').charAt(0)));
454
454
  }
455
455
  card.appendChild(U.el('div', 'cs-name', it.name || ''));
456
- var sub = level.kind === 'cast' ? (it.character || '') : [it.kind === 'tv' ? 'Series' : 'Movie', it.year].filter(Boolean).join(' · ');
456
+ var sub = level.kind === 'cast' ? (it.character || '') : [it.kind === 'tv' ? U.t('Series') : U.t('Movie'), it.year].filter(Boolean).join(' · ');
457
457
  if (sub) { card.appendChild(U.el('div', 'cs-role', sub)); }
458
458
  return card;
459
459
  }
@@ -462,13 +462,13 @@
462
462
  var lv = topCast();
463
463
  if (!lv) { return; }
464
464
  U.clear(_cast.head);
465
- var path = _cast.levels.map(function (l) { return l.name + (l.kind === 'cast' ? ' · cast & more' : ' · movies & series'); });
465
+ var path = _cast.levels.map(function (l) { return l.name + ' · ' + (l.kind === 'cast' ? U.t('cast & more') : U.t('movies & series')); });
466
466
  _cast.head.appendChild(U.el('div', 'cs-title', (path.length > 3 ? '… › ' : '') + path.slice(-3).join(' › ')));
467
- var deeper = lv.kind === 'cast' ? 'OK: their movies & series' : 'OK: its cast & more Hold OK: more';
468
- _cast.head.appendChild(U.el('div', 'cs-hint', deeper + ' BACK: ' + (_cast.levels.length > 1 ? 'up a level' : 'close')));
467
+ var deeper = lv.kind === 'cast' ? U.t('OK: their movies & series') : U.t('OK: its cast & more Hold OK: more');
468
+ _cast.head.appendChild(U.el('div', 'cs-hint', deeper + ' ' + (_cast.levels.length > 1 ? U.t('BACK: up a level') : U.t('BACK: close'))));
469
469
  U.clear(_cast.strip);
470
470
  _cast.strip.style.marginLeft = '0px';
471
- if (!lv.items) { _cast.strip.appendChild(U.el('div', 'cs-note', 'Loading…')); return; }
471
+ if (!lv.items) { _cast.strip.appendChild(U.el('div', 'cs-note', U.t('Loading…'))); return; }
472
472
  if (!lv.items.length) { _cast.strip.appendChild(U.el('div', 'cs-note', lv.note)); return; }
473
473
  lv.items.forEach(function (it) { _cast.strip.appendChild(castCard(lv, it)); });
474
474
  renderCast();
@@ -491,21 +491,21 @@
491
491
  if (!V || !V.titleActions || !Stremio.tmdbImdbId) { return; }
492
492
  var type = it.kind === 'tv' ? 'series' : 'movie', name = it.name || '', me = _cast;
493
493
  Stremio.tmdbImdbId(it.kind, it.tmdbId).then(function (imdb) {
494
- if (!imdb) { U.toast('“' + name + '” has no IMDb id, so the addons can\'t open it.', 3500); return null; }
494
+ if (!imdb) { U.toast(U.t('“{name}” has no IMDb id, so the addons can\'t open it.', { name: name }), 3500); return null; }
495
495
  var meta = { id: imdb, type: type, name: name, poster: it.poster };
496
496
  return V.titleActions(meta, type).then(function (act) {
497
497
  if (_cast !== me || !S.active) { return; } // (the strip closed, or playback ended, meanwhile)
498
498
  // (Details last: the one that stops what's playing)
499
499
  var opts = act.items.filter(function (o) { return o[0] !== 'details'; }).concat(act.items.filter(function (o) { return o[0] === 'details'; }));
500
500
  openMenu({ title: name, idx: 0, items: opts.map(function (o) {
501
- return { label: o[0] === 'details' ? 'Details (stops playing)' : o[1], run: function () {
501
+ return { label: o[0] === 'details' ? U.t('Details (stops playing)') : o[1], run: function () {
502
502
  closeMenu();
503
503
  if (o[0] === 'details') { exit(); App.openDetail(type, imdb, meta); return; }
504
504
  act.run(o[0]);
505
505
  } };
506
506
  }) });
507
507
  });
508
- }, function () { U.toast('Couldn\'t reach TMDB.'); });
508
+ }, function () { U.toast(U.t('Couldn\'t reach TMDB.')); });
509
509
  }
510
510
  function closeCast(quiet) { // quiet: playback is stopping (the progress bar stays down)
511
511
  if (!_cast) { return; }
@@ -580,7 +580,7 @@
580
580
  img.onerror = function () { img.style.visibility = 'hidden'; };
581
581
  card.appendChild(img);
582
582
  U.deferImage(img, 'https://i.ytimg.com/vi/' + l.id + '/mqdefault.jpg');
583
- card.appendChild(U.el('div', 'yl-title', l.title || 'YouTube video'));
583
+ card.appendChild(U.el('div', 'yl-title', l.title || U.t('YouTube video')));
584
584
  return card;
585
585
  }
586
586
  function showEnd(items) {
@@ -588,8 +588,8 @@
588
588
  if (!el) { el = U.el('div', 'hidden'); el.id = 'yt-links'; document.body.appendChild(el); }
589
589
  U.clear(el);
590
590
  var head = U.el('div', 'yl-head');
591
- head.appendChild(U.el('div', 'yl-heading', 'Up next on YouTube'));
592
- head.appendChild(U.el('div', 'yl-hint', 'UP: choose BACK: hide'));
591
+ head.appendChild(U.el('div', 'yl-heading', U.t('Up next on YouTube')));
592
+ head.appendChild(U.el('div', 'yl-hint', U.t('UP: choose BACK: hide')));
593
593
  el.appendChild(head);
594
594
  var row = U.el('div', 'yl-row');
595
595
  items.forEach(function (l) { row.appendChild(linkCard(l)); });
@@ -601,7 +601,7 @@
601
601
  if (!_yl) { return; }
602
602
  var cards = _yl.row.children;
603
603
  for (var i = 0; i < cards.length; i++) { cards[i].className = 'yl-card' + (_yl.active && i === _yl.idx ? ' sel' : ''); }
604
- _yl.head.children[1].textContent = _yl.active ? 'OK: play BACK: back' : 'UP: choose BACK: hide';
604
+ _yl.head.children[1].textContent = _yl.active ? U.t('OK: play BACK: back') : U.t('UP: choose BACK: hide');
605
605
  }
606
606
  function hideEnd() {
607
607
  if (!_yl) { return; }
@@ -614,9 +614,9 @@
614
614
  var el = U.byId('yt-card');
615
615
  if (!el) { el = U.el('div', 'hidden'); el.id = 'yt-card'; document.body.appendChild(el); }
616
616
  U.clear(el);
617
- el.appendChild(U.el('div', 'yc-teaser', 'ⓘ ' + (l.teaser || 'Watch')));
617
+ el.appendChild(U.el('div', 'yc-teaser', 'ⓘ ' + (l.teaser || U.t('Watch'))));
618
618
  el.appendChild(U.el('div', 'yc-title', l.title || ''));
619
- el.appendChild(U.el('div', 'yc-hint', 'UP: watch'));
619
+ el.appendChild(U.el('div', 'yc-hint', U.t('UP: watch')));
620
620
  el.className = '';
621
621
  var me = _card = { el: el, link: l, timer: setTimeout(function () { if (_card === me) { hideCard(); } }, 8000) };
622
622
  }
@@ -644,42 +644,42 @@
644
644
  function rootMenu() {
645
645
  // Order per spec: Subtitles, Audio Track, Select Source, Playback
646
646
  var items = [];
647
- items.push({ label: 'Subtitles', run: function () { pushMenu(subConfigMenu()); } });
647
+ items.push({ label: U.t('Subtitles'), run: function () { pushMenu(subConfigMenu()); } });
648
648
  if (getAudioTracks().length > 1 || (P.liveSound && P.liveSound())) { // (a live channel: its sound's choice too)
649
- items.push({ label: 'Audio track', run: function () { pushMenu(audioMenu()); } });
649
+ items.push({ label: U.t('Audio track'), run: function () { pushMenu(audioMenu()); } });
650
650
  }
651
651
  if (hasYtLanguages()) { // (a YouTube video with dubs: each is a stream of its own)
652
- items.push({ label: 'Audio language', detail: ytLanguageLabel(), run: function () { pushMenu(ytLanguageMenu()); } });
652
+ items.push({ label: U.t('Audio language'), detail: ytLanguageLabel(), run: function () { pushMenu(ytLanguageMenu()); } });
653
653
  }
654
654
  if (S.ctx.streams && S.ctx.streams.length) {
655
- items.push({ label: 'Select source', run: function () { pushMenu(sourceMenu()); } });
655
+ items.push({ label: U.t('Select source'), run: function () { pushMenu(sourceMenu()); } });
656
656
  }
657
657
  if (hasQualities()) {
658
- items.push({ label: 'Video quality', detail: qualityLabel(), run: function () { pushMenu(qualityMenu()); } });
658
+ items.push({ label: U.t('Video quality'), detail: qualityLabel(), run: function () { pushMenu(qualityMenu()); } });
659
659
  } else if (qualityUnread()) {
660
- items.push({ label: 'Video quality', detail: 'Auto: this stream’s qualities couldn’t be read', run: function () { U.toast('This stream’s qualities couldn’t be read: it plays on Auto', 4000); } });
660
+ items.push({ label: U.t('Video quality'), detail: U.t('Auto: this stream’s qualities couldn’t be read'), run: function () { U.toast(U.t('This stream’s qualities couldn’t be read: it plays on Auto'), 4000); } });
661
661
  }
662
662
  if (chapters().length) {
663
663
  var ci = chapterAt(S.cur);
664
- items.push({ label: 'Chapters', detail: ci >= 0 ? chapters()[ci].title : '', run: function () { pushMenu(chaptersMenu()); } });
664
+ items.push({ label: U.t('Chapters'), detail: ci >= 0 ? chapters()[ci].title : '', run: function () { pushMenu(chaptersMenu()); } });
665
665
  }
666
666
  if (!S.isLive) {
667
- items.push({ label: 'Playback', run: function () { pushMenu(playbackMenu()); } });
667
+ items.push({ label: U.t('Playback'), run: function () { pushMenu(playbackMenu()); } });
668
668
  }
669
- items.push({ label: 'Picture', detail: aspectDef(P.aspectNow())[1].split(' (')[0], run: function () { pushMenu(pictureMenu()); } });
670
- if (P.liveFormat()) { items.push({ label: 'Format', detail: P.liveFormat() === 'hls' ? 'HLS' : 'MPEG-TS', run: function () { pushMenu(formatMenu()); } }); }
671
- items.push({ label: streamInfoOn() ? 'Hide stream info' : 'Stream info', run: function () { toggleStreamInfo(); closeMenu(); } });
672
- items.push({ label: 'Reload', detail: S.isLive ? 'Open the channel again' : 'Open it again, where it is', run: function () { closeMenu(); P.reload(); } });
673
- items.push({ label: 'Sleep timer', detail: sleepLeft(), run: function () { pushMenu(sleepMenu()); } });
674
- return { title: 'Menu', items: items, idx: 0 };
669
+ items.push({ label: U.t('Picture'), detail: aspectDef(P.aspectNow())[1].split(' (')[0], run: function () { pushMenu(pictureMenu()); } });
670
+ if (P.liveFormat()) { items.push({ label: U.t('Format'), detail: P.liveFormat() === 'hls' ? 'HLS' : 'MPEG-TS', run: function () { pushMenu(formatMenu()); } }); }
671
+ items.push({ label: streamInfoOn() ? U.t('Hide stream info') : U.t('Stream info'), run: function () { toggleStreamInfo(); closeMenu(); } });
672
+ items.push({ label: U.t('Reload'), detail: S.isLive ? U.t('Open the channel again') : U.t('Open it again, where it is'), run: function () { closeMenu(); P.reload(); } });
673
+ items.push({ label: U.t('Sleep timer'), detail: sleepLeft(), run: function () { pushMenu(sleepMenu()); } });
674
+ return { title: U.t('Menu'), items: items, idx: 0 };
675
675
  }
676
676
 
677
677
  // ---- Sleep timer: playback stops after 30, 60 or 90 minutes (said, then the player closes);
678
678
  // for this playback session, cleared when the player closes ----
679
679
  var SLEEP_MINUTES = [30, 60, 90], _sleep = null; // { at, timer }
680
680
  function sleepLeft() {
681
- if (!_sleep) { return 'Off'; }
682
- return Math.max(1, Math.ceil((_sleep.at - Date.now()) / 60000)) + ' min left';
681
+ if (!_sleep) { return U.t('Off'); }
682
+ return U.t('{n} min left', { n: Math.max(1, Math.ceil((_sleep.at - Date.now()) / 60000)) });
683
683
  }
684
684
  function sleepClear() { if (_sleep) { clearTimeout(_sleep.timer); _sleep = null; } }
685
685
  function sleepSet(min) {
@@ -689,16 +689,16 @@
689
689
  _sleep = { at: at, timer: setTimeout(function () {
690
690
  _sleep = null;
691
691
  if (!S.active) { return; }
692
- U.toast('Sleep timer: playback stopped', 5000);
692
+ U.toast(U.t('Sleep timer: playback stopped'), 5000);
693
693
  exit();
694
694
  }, min * 60000) };
695
695
  }
696
696
  function sleepMenu() {
697
- var items = [{ label: 'Off', sel: !_sleep, run: function () { sleepSet(0); closeMenu(); U.toast('Sleep timer off', 2000); } }];
697
+ var items = [{ label: U.t('Off'), sel: !_sleep, run: function () { sleepSet(0); closeMenu(); U.toast(U.t('Sleep timer off'), 2000); } }];
698
698
  SLEEP_MINUTES.forEach(function (m) {
699
- items.push({ label: m + ' minutes', run: function () { sleepSet(m); closeMenu(); U.toast('Sleep timer: playback stops in ' + m + ' minutes', 3000); } });
699
+ items.push({ label: U.t('{n} minutes', { n: m }), run: function () { sleepSet(m); closeMenu(); U.toast(U.t('Sleep timer: playback stops in {n} minutes', { n: m }), 3000); } });
700
700
  });
701
- return { title: 'Sleep timer', items: items, idx: 0 };
701
+ return { title: U.t('Sleep timer'), items: items, idx: 0 };
702
702
  }
703
703
  P.sleepClear = sleepClear;
704
704
 
@@ -713,7 +713,7 @@
713
713
  // …as the QR opens it: in VLC or Infuse (a phone's browser downloads a file it can't play,
714
714
  // an MKV, HEVC, surround sound), or the direct link; a YouTube video's page as it is (the
715
715
  // YouTube app opens it).
716
- var PHONE_APPS = [['vlc', 'VLC'], ['infuse', 'Infuse'], ['link', 'Direct link']];
716
+ var PHONE_APPS = [['vlc', 'VLC'], ['infuse', 'Infuse'], ['link', U.t('Direct link')]];
717
717
  function phoneLink() {
718
718
  var u = streamLink(), app = playerCfg().phone;
719
719
  if (!u || S.ctx.yt || app === 'link') { return u; }
@@ -725,8 +725,8 @@
725
725
  var link = phoneLink(), box = U.el('div', 'phone-qr'), spot = U.el('div', 'phone-qr-spot');
726
726
  box.appendChild(spot);
727
727
  var host = (streamLink().match(/^https?:\/\/([^\/?#]+)/i) || [])[1] || '';
728
- box.appendChild(U.el('div', 'sm-detail', 'Scan it with your phone to open the link there (' + host + ')' + (S.ctx.yt || S.isLive ? '.' : ': it starts from the beginning; you\'re at ' + U.fmtTime(S.cur) + '.')));
729
- box.appendChild(U.el('div', 'sm-detail', 'Anyone who scans it can play it; a debrid link carries your account’s access.' + (S.ctx._headers ? ' This channel needs its own player settings, so it may not open elsewhere.' : '')));
728
+ box.appendChild(U.el('div', 'sm-detail', S.ctx.yt || S.isLive ? U.t('Scan it with your phone to open the link there ({host}).', { host: host }) : U.t('Scan it with your phone to open the link there ({host}): it starts from the beginning; you\'re at {at}.', { host: host, at: U.fmtTime(S.cur) })));
729
+ box.appendChild(U.el('div', 'sm-detail', U.t('Anyone who scans it can play it; a debrid link carries your account’s access.') + (S.ctx._headers ? U.t(' This channel needs its own player settings, so it may not open elsewhere.') : '')));
730
730
  (typeof qrcode !== 'undefined' ? Promise.resolve() : U.loadScript('js/qrcode.js')).then(function () {
731
731
  var cv = U.qrCanvas(link, 0, { level: 'L', quiet: 2, fit: 200 }); // (small: about 200 px)
732
732
  if (cv) { spot.appendChild(cv); } else { spot.appendChild(U.el('div', 'sm-detail', link)); }
@@ -734,10 +734,10 @@
734
734
  var items = S.ctx.yt ? [] : PHONE_APPS.map(function (a) {
735
735
  return { label: a[1], sel: playerCfg().phone === a[0], run: function () { setPlayerCfg({ phone: a[0] }); replaceTop(phoneMenu()); } };
736
736
  });
737
- items.push({ label: 'Close', run: function () { closeMenu(); } });
737
+ items.push({ label: U.t('Close'), run: function () { closeMenu(); } });
738
738
  var at = 0;
739
739
  items.forEach(function (it, i) { if (it.sel) { at = i; } });
740
- return { title: 'Continue on phone', idx: at, wide: true, node: box, items: items };
740
+ return { title: U.t('Continue on phone'), idx: at, wide: true, node: box, items: items };
741
741
  }
742
742
 
743
743
  // ⬇ Download: the source playing to a USB drive (js/downloads.js), with the subtitle that's
@@ -756,11 +756,11 @@
756
756
  Downloads.start(S.ctx.stream, t, {
757
757
  pick: function (title, options, fn) {
758
758
  show({ title: title, idx: 0, items: options.map(function (o) { return { label: o[1], run: function () { fn(o[0]); } }; })
759
- .concat([{ label: 'Cancel', run: function () { closeMenu(); } }]) });
759
+ .concat([{ label: U.t('Cancel'), run: function () { closeMenu(); } }]) });
760
760
  },
761
761
  confirm: function (msg, ok, fn) {
762
- show({ title: 'Download to USB drive', idx: 0, wide: true, node: U.el('div', 'sm-detail', msg),
763
- items: [{ label: ok, run: function () { closeMenu(); fn(); } }, { label: 'Cancel', run: function () { closeMenu(); } }] });
762
+ show({ title: U.t('Download to USB drive'), idx: 0, wide: true, node: U.el('div', 'sm-detail', msg),
763
+ items: [{ label: ok, run: function () { closeMenu(); fn(); } }, { label: U.t('Cancel'), run: function () { closeMenu(); } }] });
764
764
  }
765
765
  });
766
766
  }
@@ -769,10 +769,10 @@
769
769
  function chaptersMenu() {
770
770
  var cur = chapterAt(S.cur);
771
771
  var items = chapters().map(function (c, i) {
772
- return { label: c.title || 'Chapter ' + (i + 1), detail: U.fmtTime(c.t), sel: i === cur,
772
+ return { label: c.title || U.t('Chapter {n}', { n: i + 1 }), detail: U.fmtTime(c.t), sel: i === cur,
773
773
  run: function () { closeMenu(); seekTo(c.t); } };
774
774
  });
775
- return { title: 'Chapters', items: items, idx: Math.max(0, cur) };
775
+ return { title: U.t('Chapters'), items: items, idx: Math.max(0, cur) };
776
776
  }
777
777
 
778
778
  // ---------- picture mode ----------
@@ -783,7 +783,7 @@
783
783
  if (!P.useAV) { if (S.videoEl) { S.videoEl.style.objectFit = a[3]; } return true; }
784
784
  try { avplay.setDisplayMethod(a[2]); return true; } catch (e) {
785
785
  try { avplay.setDisplayMethod(aspectDef('fit')[2]); } catch (e2) {}
786
- if (!quiet) { U.toast(a[1].split(' (')[0] + ' isn\'t available on this TV', 2500); }
786
+ if (!quiet) { U.toast(U.t('{mode} isn\'t available on this TV', { mode: a[1].split(' (')[0] }), 2500); }
787
787
  return false;
788
788
  }
789
789
  }
@@ -798,7 +798,7 @@
798
798
  replaceTop(pictureMenu());
799
799
  } };
800
800
  });
801
- return { title: S.isLive && S.ctx && S.ctx.id ? 'Picture (this channel)' : 'Picture', items: items, idx: idx };
801
+ return { title: S.isLive && S.ctx && S.ctx.id ? U.t('Picture (this channel)') : U.t('Picture'), items: items, idx: idx };
802
802
  }
803
803
 
804
804
  // An Xtream channel's format (player-core's setLiveFormat): it opens again the other way.
@@ -807,7 +807,7 @@
807
807
  var items = [['ts', 'MPEG-TS'], ['hls', 'HLS']].map(function (f) {
808
808
  return { label: f[1], sel: f[0] === now, run: function () { closeMenu(); if (f[0] !== now) { P.setLiveFormat(f[0]); } } };
809
809
  });
810
- return { title: 'Format (this channel)', items: items, idx: now === 'hls' ? 1 : 0 };
810
+ return { title: U.t('Format (this channel)'), items: items, idx: now === 'hls' ? 1 : 0 };
811
811
  }
812
812
 
813
813
  // ---------- stream info overlay ----------
@@ -835,25 +835,25 @@
835
835
  var bh = st.behaviorHints || {}, path = ('' + (st.url || '')).split(/[?#]/)[0], file = bh.filename || '';
836
836
  if (!file && /\.(mkv|mp4|m4v|avi|ts|webm|mov)$/i.test(path)) { try { file = decodeURIComponent(path.split('/').pop()); } catch (e) { file = path.split('/').pop(); } }
837
837
  var name = (Stremio.streamName ? Stremio.streamName(st) : st.name || '').replace(/\s+/g, ' ').trim();
838
- lines.push(['Source', [st._addon, name].filter(Boolean).join(' · ') || '—']);
839
- if (file) { lines.push(['File', file]); }
838
+ lines.push([U.t('Source'), [st._addon, name].filter(Boolean).join(' · ') || '—']);
839
+ if (file) { lines.push([U.t('File'), file]); }
840
840
  var size = Stremio.streamSize ? Stremio.streamSize(st) : '';
841
- if (size) { lines.push(['Size', size]); }
841
+ if (size) { lines.push([U.t('Size'), size]); }
842
842
  var desc = (Stremio.streamDescription ? Stremio.streamDescription(st) : '').replace(/\s*\n\s*/g, ' · ').replace(/\s+/g, ' ').trim();
843
- if (desc) { lines.push(['Details', desc.length > 170 ? desc.slice(0, 167) + '…' : desc]); }
843
+ if (desc) { lines.push([U.t('Details'), desc.length > 170 ? desc.slice(0, 167) + '…' : desc]); }
844
844
  }
845
845
  var info = S.ctx.formatInfo || (typeof Stremio !== 'undefined' && Stremio.streamInfo ? Stremio.streamInfo({ url: S.ctx.url, name: S.ctx.name }) : null);
846
846
  var tags = (info && Stremio.formatTags) ? Stremio.formatTags(info, S.actual) : '';
847
- if (tags) { lines.push(['Format', tags]); }
847
+ if (tags) { lines.push([U.t('Format'), tags]); }
848
848
  }
849
849
  // How it reaches the player (no link): straight from its server, or through StremioK's service.
850
850
  function howItPlays() {
851
851
  var c = S.ctx;
852
- if (c.yt) { return 'Through YouTube’s service (on the TV)'; }
853
- if (c._relay) { return 'Through StremioK’s service: the sound repacked'; }
854
- if (c.localFile && c.localFile.dav) { return 'From your network folder'; }
855
- if (c.localFile) { return /^http:\/\/localhost/.test(typeof LocalMedia !== 'undefined' && LocalMedia.openUrl ? LocalMedia.openUrl(c.url, c.localFile.size) : '') ? 'From the USB drive, through StremioK’s service (over 2 GB)' : 'From the USB drive'; }
856
- return 'Straight from the server';
852
+ if (c.yt) { return U.t('Through YouTube’s service (on the TV)'); }
853
+ if (c._relay) { return U.t('Through StremioK’s service: the sound repacked'); }
854
+ if (c.localFile && c.localFile.dav) { return U.t('From your network folder'); }
855
+ if (c.localFile) { return /^http:\/\/localhost/.test(typeof LocalMedia !== 'undefined' && LocalMedia.openUrl ? LocalMedia.openUrl(c.url, c.localFile.size) : '') ? U.t('From the USB drive, through StremioK’s service (over 2 GB)') : U.t('From the USB drive'); }
856
+ return U.t('Straight from the server');
857
857
  }
858
858
  function renderStreamInfo() {
859
859
  var el = U.byId('stream-info');
@@ -873,27 +873,27 @@
873
873
  }
874
874
  if (video) {
875
875
  var w = video.Width || video.width, h = video.Height || video.height;
876
- lines.push(['Video', [w && h ? w + '×' + h : '', video.fourCC || video.codec || ''].filter(Boolean).join(' · ') || '—']);
876
+ lines.push([U.t('Video'), [w && h ? w + '×' + h : '', video.fourCC || video.codec || ''].filter(Boolean).join(' · ') || '—']);
877
877
  }
878
878
  if (audio) {
879
- lines.push(['Audio', [infoLang(audio), audio.channels ? audio.channels + 'ch' : '', audio.fourCC || audio.codec || '']
879
+ lines.push([U.t('Audio'), [infoLang(audio), audio.channels ? audio.channels + 'ch' : '', audio.fourCC || audio.codec || '']
880
880
  .filter(function (x) { return x && x !== 'und'; }).join(' · ') || '—']);
881
881
  }
882
- lines.push(['Subtitles', subtitleSummary()]);
883
- if (hasQualities()) { lines.push(['Quality', qualityLabel() + ' (' + qualityCount() + ' available)']); }
884
- else if (qualityUnread()) { lines.push(['Quality', 'Auto (this stream’s qualities couldn’t be read)']); }
882
+ lines.push([U.t('Subtitles'), subtitleSummary()]);
883
+ if (hasQualities()) { lines.push([U.t('Quality'), qualityLabel() + ' ' + U.t('({n} available)', { n: qualityCount() })]); }
884
+ else if (qualityUnread()) { lines.push([U.t('Quality'), U.t('Auto (this stream’s qualities couldn’t be read)')]); }
885
885
  if (P.useAV) {
886
886
  try {
887
887
  var bw = +avplay.getStreamingProperty('CURRENT_BANDWIDTH');
888
- if (bw > 0) { lines.push(['Bandwidth', (bw / 1e6).toFixed(1) + ' Mbps']); }
888
+ if (bw > 0) { lines.push([U.t('Bandwidth'), (bw / 1e6).toFixed(1) + ' Mbps']); }
889
889
  } catch (e2) {}
890
890
  }
891
891
  var host = (('' + (S.ctx.url || '')).match(/^https?:\/\/([^\/:?#]+)/) || [])[1];
892
- if (host) { lines.push(['Server', host === 'localhost' ? 'YouTube (built-in service)' : host]); }
893
- lines.push(['Plays', howItPlays()]);
892
+ if (host) { lines.push([U.t('Server'), host === 'localhost' ? U.t('YouTube (built-in service)') : host]); }
893
+ lines.push([U.t('Plays'), howItPlays()]);
894
894
  var buf = playerCfg().buffer;
895
- if (buf && buf !== 'normal') { lines.push(['Buffer', buf === 'most' ? 'Most' : 'More']); }
896
- lines.push(['Position', S.isLive ? 'Live' : U.fmtTime(S.cur) + ' / ' + U.fmtTime(S.dur)]);
895
+ if (buf && buf !== 'normal') { lines.push([U.t('Buffer'), buf === 'most' ? U.t('Most') : U.t('More')]); }
896
+ lines.push([U.t('Position'), S.isLive ? U.t('Live') : U.fmtTime(S.cur) + ' / ' + U.fmtTime(S.dur)]);
897
897
  U.clear(el);
898
898
  lines.forEach(function (l) {
899
899
  var row = U.el('div', 'si-row');
@@ -904,12 +904,12 @@
904
904
  }
905
905
 
906
906
  function playbackMenu() {
907
- return { title: 'Playback', idx: 0, items: [
908
- { label: 'Restart', run: function () { seekTo(0); closeMenu(); } },
909
- { label: 'Rewind 10′', run: function () { seekBy(-600); closeMenu(); } },
910
- { label: 'Rewind 5′', run: function () { seekBy(-300); closeMenu(); } },
911
- { label: 'Forward 5′', run: function () { seekBy(300); closeMenu(); } },
912
- { label: 'Forward 10′', run: function () { seekBy(600); closeMenu(); } }
907
+ return { title: U.t('Playback'), idx: 0, items: [
908
+ { label: U.t('Restart'), run: function () { seekTo(0); closeMenu(); } },
909
+ { label: U.t('Rewind 10′'), run: function () { seekBy(-600); closeMenu(); } },
910
+ { label: U.t('Rewind 5′'), run: function () { seekBy(-300); closeMenu(); } },
911
+ { label: U.t('Forward 5′'), run: function () { seekBy(300); closeMenu(); } },
912
+ { label: U.t('Forward 10′'), run: function () { seekBy(600); closeMenu(); } }
913
913
  ] };
914
914
  }
915
915
 
@@ -919,10 +919,10 @@
919
919
  var items = S.ctx.streams.map(function (s, i) {
920
920
  var sel = s.url === S.ctx.url && JSON.stringify(U.sanitizeHeaders(s.headers)) === now;
921
921
  if (sel) { idx = i; }
922
- return { label: s.label || 'Source', detail: s.detail || '', sel: sel,
922
+ return { label: s.label || U.t('Source'), detail: s.detail || '', sel: sel,
923
923
  run: function () { switchSource(s); closeMenu(); } };
924
924
  });
925
- return { title: 'Select source', items: items, idx: idx, wide: true };
925
+ return { title: U.t('Select source'), items: items, idx: idx, wide: true };
926
926
  }
927
927
 
928
928
  // ---------- the colored keys ----------
@@ -935,11 +935,11 @@
935
935
  if (key === 'RED') {
936
936
  if (getAudioTracks().length > 1 || (P.liveSound && P.liveSound())) { m = audioMenu(); }
937
937
  else if (hasYtLanguages()) { m = ytLanguageMenu(); }
938
- else { U.toast('Only one audio track', 1800); return; }
938
+ else { U.toast(U.t('Only one audio track'), 1800); return; }
939
939
  } else if (key === 'GREEN') {
940
940
  m = langMenu();
941
941
  } else {
942
- if (!(S.ctx && S.ctx.streams && S.ctx.streams.length)) { U.toast('No other source for this', 1800); return; }
942
+ if (!(S.ctx && S.ctx.streams && S.ctx.streams.length)) { U.toast(U.t('No other source for this'), 1800); return; }
943
943
  m = sourceMenu();
944
944
  }
945
945
  if (_barOpen) { closeBar(); }
@@ -967,7 +967,7 @@
967
967
  if (_chTimer) { clearTimeout(_chTimer); _chTimer = null; }
968
968
  function go() { var k = +_chDigits; _chDigits = ''; if (_chTimer) { clearTimeout(_chTimer); _chTimer = null; } if (k > 0 && S.ctx && S.ctx.zapTo) { S.ctx.zapTo(k); } }
969
969
  if (_chDigits.length >= 2) { go(); return; }
970
- U.toast('Channel ' + _chDigits + '_', CH_WAIT_MS);
970
+ U.toast(U.t('Channel {n}', { n: _chDigits + '_' }), CH_WAIT_MS);
971
971
  _chTimer = setTimeout(go, CH_WAIT_MS);
972
972
  return;
973
973
  }
@@ -995,7 +995,7 @@
995
995
  var fwd = action === 'NEXT';
996
996
  if (S.ctx && S.ctx.zap) { S.ctx.zap(fwd ? 1 : -1); return true; }
997
997
  if (S.ctx && (fwd ? S.ctx.hasNext : S.ctx.hasPrev)) { closeControls(); if (fwd) { S.ctx.playNext(); } else { S.ctx.playPrev(); } return true; }
998
- if (S.ctx && S.ctx.type === 'series') { U.toast(fwd ? 'No next episode' : 'No previous episode', 1800); }
998
+ if (S.ctx && S.ctx.type === 'series') { U.toast(fwd ? U.t('No next episode') : U.t('No previous episode'), 1800); }
999
999
  return true;
1000
1000
  }
1001
1001
  // A held OK: a title's menu in Cast & more; anywhere else, OK.