stremiok 2.3.4 → 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.
Files changed (57) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +1 -0
  3. package/config.xml +1 -1
  4. package/css/style.css +5 -0
  5. package/index.html +42 -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 +1941 -0
  14. package/js/lang/de.js +1941 -0
  15. package/js/lang/es.js +1941 -0
  16. package/js/lang/fi.js +1941 -0
  17. package/js/lang/fr.js +1941 -0
  18. package/js/lang/he.js +1941 -0
  19. package/js/lang/hi.js +1941 -0
  20. package/js/lang/it.js +1941 -0
  21. package/js/lang/ja.js +1941 -0
  22. package/js/lang/ko.js +1941 -0
  23. package/js/lang/languages.js +21 -0
  24. package/js/lang/pl.js +1941 -0
  25. package/js/lang/pt-BR.js +1941 -0
  26. package/js/lang/ru.js +1941 -0
  27. package/js/lang/tr.js +1941 -0
  28. package/js/lang/zh-CN.js +1941 -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 +59 -57
  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/stremio-account.js +8 -8
  40. package/js/stremio-sync.js +5 -5
  41. package/js/stremio.js +78 -76
  42. package/js/stvod.js +4 -4
  43. package/js/trakt.js +23 -23
  44. package/js/tvapps.js +4 -4
  45. package/js/util.js +38 -26
  46. package/js/view-core.js +93 -93
  47. package/js/view-detail.js +124 -126
  48. package/js/view-discover.js +27 -27
  49. package/js/view-guide.js +13 -13
  50. package/js/view-home.js +124 -118
  51. package/js/view-search.js +25 -25
  52. package/js/view-settings.js +658 -642
  53. package/js/xtvod.js +2 -2
  54. package/js/youtube.js +17 -17
  55. package/js/ytplay.js +11 -6
  56. package/package.json +1 -1
  57. package/tizenbrew.html +1 -1
package/js/stremio.js CHANGED
@@ -16,7 +16,7 @@ var Stremio = (function () {
16
16
  ];
17
17
  // Addons whose operator limits who may use them: what Settings says about one you add.
18
18
  var RESTRICTED = {
19
- 'org.stremio.watchhub': 'Third-party service: its operator says it’s only for apps Stremio authorizes in writing, and StremioK isn’t one. Use it at your own discretion.'
19
+ 'org.stremio.watchhub': U.t('Third-party service: its operator says it’s only for apps Stremio authorizes in writing, and StremioK isn’t one. Use it at your own discretion.')
20
20
  };
21
21
  var RESTRICTED_HOSTS = { 'watchhub.strem.io': 'org.stremio.watchhub' };
22
22
  // The note for an addon (its manifest id, or its URL before it has loaded), or ''.
@@ -125,7 +125,7 @@ var Stremio = (function () {
125
125
  function refreshAddon(url) {
126
126
  return fetchManifests([url]).then(function (got) {
127
127
  var m = got[url];
128
- if (!m) { throw new Error('Could not refresh ' + U.redactUrl(url)); }
128
+ if (!m) { throw new Error(U.t('Could not refresh {link}', { link: U.redactUrl(url) })); }
129
129
  if (_loaded) { _loaded.forEach(function (a) { if (a.url === url) { a.manifest = m; } }); }
130
130
  var kept = _loaded;
131
131
  configChanged(); // (its sources may differ now; fetched again as titles open)
@@ -161,7 +161,8 @@ var Stremio = (function () {
161
161
  function addonMs(ms) { var w = getPrefs().addonWait * 1000; return w > ms ? w : ms; }
162
162
  function getPrefs() {
163
163
  var p = U.store.get(PREFS_KEY, {}) || {};
164
- return { posterShape: p.posterShape || 'portrait', accent: p.accent || 'indigo', bg: p.bg || 'dark',
164
+ return { lang: typeof p.lang === 'string' && p.lang ? p.lang : 'auto', // Settings > Appearance > Language (js/i18n.js: 'auto', 'en', 'es', 'pt-BR')
165
+ posterShape: p.posterShape || 'portrait', accent: p.accent || 'indigo', bg: p.bg || 'dark',
165
166
  look: p.look === 'modern' ? 'modern' : 'classic', // Settings > Appearance: Classic, or Modern (a backdrop behind Home, the title's logo, rounder posters)
166
167
  effects: p.effects === 'light' || p.effects === 'full' ? p.effects : 'auto', // ...Modern's blur and motion: by the TV (auto), off (light) or on (full)
167
168
  zoom: [110, 120, 130, 140].indexOf(p.zoom) !== -1 ? p.zoom : 100, // Settings > Appearance: everything bigger (percent)
@@ -210,11 +211,11 @@ var Stremio = (function () {
210
211
  var bytes = (info && info.size) || sizeBytes(st);
211
212
  if (!(bytes > 0)) { return ''; }
212
213
  var g = bytes / 1073741824;
213
- if (L.max && g > L.max) { return 'over ' + gbText(L.max); }
214
- if (L.min && g < L.min) { return 'under ' + gbText(L.min); }
214
+ if (L.max && g > L.max) { return U.t('over {size}', { size: gbText(L.max) }); }
215
+ if (L.min && g < L.min) { return U.t('under {size}', { size: gbText(L.min) }); }
215
216
  if (L.perHour && minutes > 0) {
216
217
  var ph = g / (minutes / 60);
217
- if (ph > L.perHour) { return (Math.round(ph * 10) / 10) + ' GB an hour, over ' + gbText(L.perHour); }
218
+ if (ph > L.perHour) { return U.t('{size} GB an hour, over {limit}', { size: Math.round(ph * 10) / 10, limit: gbText(L.perHour) }); }
218
219
  }
219
220
  return '';
220
221
  }
@@ -518,7 +519,7 @@ var Stremio = (function () {
518
519
  function iptvRefreshEvery() { return _hasIptv && IPTV.refreshEvery ? IPTV.refreshEvery() : 0; }
519
520
  function iptvSetRefreshEvery(h) { if (_hasIptv && IPTV.setRefreshEvery) { IPTV.setRefreshEvery(h); } }
520
521
  function iptvReadAt() { return _hasIptv && IPTV.readAt ? IPTV.readAt() : Infinity; }
521
- function iptvStatus(id) { return _hasIptv ? IPTV.status(id) : { error: 'IPTV unavailable' }; }
522
+ function iptvStatus(id) { return _hasIptv ? IPTV.status(id) : { error: U.t('IPTV unavailable') }; }
522
523
  // Force a re-fetch of one playlist (Settings → Reload) and rebuild the addon list.
523
524
  // An Xtream account turned out to have films and series, or none (XtVod.onVodChange): the IPTV
524
525
  // rows made again from the saved copies (its film and episode lines in or out), not downloaded.
@@ -556,7 +557,7 @@ var Stremio = (function () {
556
557
  // A configuration file's lines (Settings › Import configuration file), read but not yet
557
558
  // imported: { items: [{ kind: 'addon' | 'playlist' | 'omdb' | 'tmdb' | 'mdblist', value,
558
559
  // label, have (already yours), note }], ignored }. Blank lines and # comments skipped.
559
- var KEY_NAMES = { omdb: 'OMDb key', tmdb: 'TMDB key', mdblist: 'MDBList key' };
560
+ var KEY_NAMES = { omdb: U.t('OMDb key'), tmdb: U.t('TMDB key'), mdblist: U.t('MDBList key') };
560
561
  function shortLink(u) {
561
562
  var p = U.parseUrl(u);
562
563
  if (!p) { return ('' + u).slice(0, 60); }
@@ -583,11 +584,11 @@ var Stremio = (function () {
583
584
  var lists = iptvLists(), integ = getIntegrations(), out = [], n = getAddonUrls().length;
584
585
  var pl = lists.filter(function (p) { return !p.mac; }).length, st = lists.length - pl;
585
586
  var keys = Object.keys(KEY_NAMES).filter(function (k) { return integ[k]; }).map(function (k) { return KEY_NAMES[k].replace(/ key$/, ''); });
586
- if (n) { out.push({ key: 'addons', label: plural(n, 'addon') + ', in your order' }); }
587
- if (pl) { out.push({ key: 'playlists', label: plural(pl, 'IPTV playlist') + ' (their logins too)' }); }
588
- if (st) { out.push({ key: 'stalker', label: plural(st, 'Stalker portal') + ' (their MAC addresses)' }); }
589
- if (keys.length) { out.push({ key: 'keys', label: 'API keys: ' + keys.join(', ') }); }
590
- out.push({ key: 'settings', label: 'Your settings: look, Home, playback, subtitles, sources, streaming server, YouTube…' });
587
+ if (n) { out.push({ key: 'addons', label: U.tn(n, '{n} addon, in your order', '{n} addons, in your order') }); }
588
+ if (pl) { out.push({ key: 'playlists', label: U.tn(pl, '{n} IPTV playlist (their logins too)', '{n} IPTV playlists (their logins too)') }); }
589
+ if (st) { out.push({ key: 'stalker', label: U.tn(st, '{n} Stalker portal (their MAC addresses)', '{n} Stalker portals (their MAC addresses)') }); }
590
+ if (keys.length) { out.push({ key: 'keys', label: U.t('API keys: {keys}', { keys: keys.join(', ') }) }); }
591
+ out.push({ key: 'settings', label: U.t('Your settings: look, Home, playback, subtitles, sources, streaming server, YouTube…') });
591
592
  return out;
592
593
  }
593
594
  function settingsValue(key) {
@@ -645,7 +646,7 @@ var Stremio = (function () {
645
646
  if (m[1] === 'playlist' && typeof o.url === 'string') { details[o.url] = o; return; }
646
647
  if (m[1] === 'stalker' && typeof o.url === 'string' && _hasIptv && IPTV.macOf && IPTV.macOf(o.mac)) {
647
648
  var mac = IPTV.macOf(o.mac);
648
- push({ kind: 'stalker', value: o.url + '|' + mac, info: o, label: 'Stalker portal · ' + (typeof o.name === 'string' && o.name ? o.name.slice(0, 60) : shortLink(o.url)),
649
+ push({ kind: 'stalker', value: o.url + '|' + mac, info: o, label: U.t('Stalker portal') + ' · ' + (typeof o.name === 'string' && o.name ? o.name.slice(0, 60) : shortLink(o.url)),
649
650
  have: have.some(function (p) { return p.url === o.url && p.mac === mac; }), note: '' });
650
651
  return;
651
652
  }
@@ -661,21 +662,21 @@ var Stremio = (function () {
661
662
  else if (/^[A-Za-z0-9]{25}$/.test(value)) { key = 'mdblist'; }
662
663
  if (key) {
663
664
  push({ kind: key, value: value, label: KEY_NAMES[key] + ' · …' + value.slice(-4), have: integ[key] === value,
664
- note: (integ[key] && integ[key] !== value) ? 'replaces yours' : '' });
665
+ note: (integ[key] && integ[key] !== value) ? U.t('replaces yours') : '' });
665
666
  } else if (U.isPlaylistUrl(U.parseUrl(value))) { // …m3u / .m3u8 (a query after it too), Xtream get.php?…type=m3u_plus
666
- push({ kind: 'playlist', value: value, label: 'IPTV playlist · ' + shortLink(value), have: lists.indexOf(value) !== -1, note: '' });
667
+ push({ kind: 'playlist', value: value, label: U.t('IPTV playlist') + ' · ' + shortLink(value), have: lists.indexOf(value) !== -1, note: '' });
667
668
  } else if (value.indexOf('://') !== -1 && normalizeManifestUrl(value)) {
668
669
  var url = normalizeManifestUrl(value);
669
- push({ kind: 'addon', value: url, label: 'Addon · ' + shortLink(url), have: mine.indexOf(url) !== -1, note: '' });
670
+ push({ kind: 'addon', value: url, label: U.t('Addon') + ' · ' + shortLink(url), have: mine.indexOf(url) !== -1, note: '' });
670
671
  } else {
671
672
  out.ignored++;
672
673
  }
673
674
  });
674
675
  out.items.forEach(function (it) { // (a playlist's name, guide link, off: with it)
675
676
  var d = it.kind === 'playlist' && details[it.value];
676
- if (d) { it.info = d; if (typeof d.name === 'string' && d.name) { it.label = 'IPTV playlist · ' + d.name.slice(0, 60); } }
677
+ if (d) { it.info = d; if (typeof d.name === 'string' && d.name) { it.label = U.t('IPTV playlist') + ' · ' + d.name.slice(0, 60); } }
677
678
  });
678
- if (store.length) { push({ kind: 'settings', value: 'settings', entries: store, label: 'Your settings (' + plural(store.length, 'part') + ')', have: false, note: 'replaces yours' }); }
679
+ if (store.length) { push({ kind: 'settings', value: 'settings', entries: store, label: U.tn(store.length, 'Your settings ({n} part)', 'Your settings ({n} parts)'), have: false, note: U.t('replaces yours') }); }
679
680
  return out;
680
681
  }
681
682
  function playlistDetails(id, d) {
@@ -774,7 +775,8 @@ var Stremio = (function () {
774
775
 
775
776
  // ---- Catalogs ----
776
777
  // Returns list of {addon, type, id, name} across all addons.
777
- var TYPE_LABELS = { movie: 'Movies', series: 'Series', tv: 'IPTV', radio: 'Radio', channel: 'Channels', people: 'People' };
778
+ var TYPE_LABELS = { movie: U.t('Movies'), series: U.t('Series'), tv: 'IPTV', radio: U.t('Radio'), channel: U.t('Channels'), people: U.t('People'), sport: U.t('Sports'), sports: U.t('Sports'),
779
+ anime: U.t('Anime'), events: U.t('Events'), other: U.t('Other'), documentary: U.t('Documentary'), music: U.t('Music') };
778
780
  function prettyType(t) {
779
781
  if (TYPE_LABELS[t]) { return TYPE_LABELS[t]; }
780
782
  return t ? (t.charAt(0).toUpperCase() + t.slice(1)) : '';
@@ -791,7 +793,7 @@ var Stremio = (function () {
791
793
  // Include the type so per-type catalogs sharing a name (e.g. Cinemeta's
792
794
  // "Popular" for both movie & series) don't look like duplicates.
793
795
  cats.push({ addon: addon, type: c.type, id: c.id, def: c, label: label,
794
- name: prettyType(c.type) + ' · ' + label + ' · ' + (addon.manifest.name || 'Addon') });
796
+ name: prettyType(c.type) + ' · ' + label + ' · ' + (addon.manifest.name || U.t('Addon')) });
795
797
  });
796
798
  });
797
799
  return cats;
@@ -933,14 +935,14 @@ var Stremio = (function () {
933
935
  // whether sources played before go first. Stored as { order: [keys], off: [keys], played }.
934
936
  var RANKING_KEY = 'stremiok.ranking';
935
937
  var RANK_CRITERIA = [
936
- ['res', 'Resolution (high to low)', '4K, 1440p, 1080p, 720p, SD, then unknown; at the top, the sources are grouped by resolution'],
937
- ['uncached', 'Not yet cached last', 'sources an addon marks as not cached on your debrid service yet (they can’t start right away)'],
938
- ['kind', 'Release type', 'remux > Blu-ray > web > unknown > TV rip, CAM rips far below'],
939
- ['hdr', 'HDR before SDR', 'HDR10 / HDR10+ / Dolby Vision first'],
940
- ['seeds', 'Seeders (high to low)', 'torrent sources with more people sharing them first, by the count they state (👤 123, or Seeders: 123); the others keep their order'],
941
- ['addon', 'Feed sources order', 'your order of the addons (at the bottom of this page)'],
942
- ['within', 'Each addon\'s own order', 'the order an addon lists its sources in (its first, then its second…); right after Feed sources order: each addon\'s list as it gives it'],
943
- ['cached', 'Cached before unknown', 'sources an addon marks as cached ahead of ones with no mark']
938
+ ['res', U.t('Resolution (high to low)'), U.t('4K, 1440p, 1080p, 720p, SD, then unknown; at the top, the sources are grouped by resolution')],
939
+ ['uncached', U.t('Not yet cached last'), U.t('sources an addon marks as not cached on your debrid service yet (they can’t start right away)')],
940
+ ['kind', U.t('Release type'), U.t('remux > Blu-ray > web > unknown > TV rip, CAM rips far below')],
941
+ ['hdr', U.t('HDR before SDR'), U.t('HDR10 / HDR10+ / Dolby Vision first')],
942
+ ['seeds', U.t('Seeders (high to low)'), U.t('torrent sources with more people sharing them first, by the count they state (👤 123, or Seeders: 123); the others keep their order')],
943
+ ['addon', U.t('Feed sources order'), U.t('your order of the addons (at the bottom of this page)')],
944
+ ['within', U.t('Each addon\'s own order'), U.t('the order an addon lists its sources in (its first, then its second…); right after Feed sources order: each addon\'s list as it gives it')],
945
+ ['cached', U.t('Cached before unknown'), U.t('sources an addon marks as cached ahead of ones with no mark')]
944
946
  ];
945
947
  var RANK_OFF_DEFAULT = ['cached'];
946
948
  var RANK_AFTER = { seeds: 'hdr' }; // (added in 2.2.1.13)
@@ -1026,23 +1028,23 @@ var Stremio = (function () {
1026
1028
  function isErrorMeta(m) { return /^(aiostreamserror\.|aiom\.error\.)/.test('' + (m && m.id)); }
1027
1029
  function getMeta(type, id, cancel) {
1028
1030
  if (/^ytk:/.test(id) && typeof YouTube !== 'undefined') {
1029
- return YouTube.meta(id).then(function (m) { if (!m) { throw new Error('Not found on YouTube'); } return m; });
1031
+ return YouTube.meta(id).then(function (m) { if (!m) { throw new Error(U.t('Not found on YouTube')); } return m; });
1030
1032
  }
1031
1033
  if (/^xv[ms]\./.test(id) && typeof XtVod !== 'undefined') {
1032
- return XtVod.meta(type, id).then(function (m) { if (!m) { throw new Error('Not found on the Xtream server'); } return m; });
1034
+ return XtVod.meta(type, id).then(function (m) { if (!m) { throw new Error(U.t('Not found on the Xtream server')); } return m; });
1033
1035
  }
1034
1036
  if (/^sv[ms]\./.test(id) && typeof StVod !== 'undefined') {
1035
- return StVod.meta(type, id).then(function (m) { if (!m) { throw new Error('Not found on the Stalker portal'); } return m; });
1037
+ return StVod.meta(type, id).then(function (m) { if (!m) { throw new Error(U.t('Not found on the Stalker portal')); } return m; });
1036
1038
  }
1037
1039
  if (/^jf[ms]\./.test(id) && typeof Jellyfin !== 'undefined') {
1038
- return Jellyfin.meta(type, id).then(function (m) { if (!m) { throw new Error('Not found on the ' + Jellyfin.nameOfId(id) + ' server'); } return m; });
1040
+ return Jellyfin.meta(type, id).then(function (m) { if (!m) { throw new Error(U.t('Not found on the {server} server', { server: Jellyfin.nameOfId(id) })); } return m; });
1039
1041
  }
1040
1042
  if (/^px[ms]\./.test(id) && typeof Plex !== 'undefined') {
1041
- return Plex.meta(type, id).then(function (m) { if (!m) { throw new Error('Not found on the Plex server'); } return m; });
1043
+ return Plex.meta(type, id).then(function (m) { if (!m) { throw new Error(U.t('Not found on the Plex server')); } return m; });
1042
1044
  }
1043
1045
  if (/^iptv:/.test(id)) {
1044
1046
  return IPTV.meta(id).then(function (m) {
1045
- if (!m) { throw new Error('IPTV channel not found'); }
1047
+ if (!m) { throw new Error(U.t('IPTV channel not found')); }
1046
1048
  return m;
1047
1049
  });
1048
1050
  }
@@ -1058,10 +1060,10 @@ var Stremio = (function () {
1058
1060
  providers = addons.filter(function (a) { return !a.__local && ownsId(a, 'meta', id); });
1059
1061
  providers.forEach(function (a) { asType[a.url] = ownType(a, 'meta'); });
1060
1062
  }
1061
- if (!providers.length) { return Promise.reject(new Error('No meta addon for ' + type)); }
1063
+ if (!providers.length) { return Promise.reject(new Error(U.t('No meta addon for {type}', { type: type }))); }
1062
1064
  var i = 0;
1063
1065
  function tryNext() {
1064
- if (i >= providers.length) { return Promise.reject(new Error('Meta not found')); }
1066
+ if (i >= providers.length) { return Promise.reject(new Error(U.t('Meta not found'))); }
1065
1067
  var a = providers[i++];
1066
1068
  var url = a.base + '/meta/' + encodeURIComponent(asType[a.url] || type) + '/' + encodeURIComponent(id) + '.json';
1067
1069
  return U.getJSON(url, addonMs(12000), META_MAX, cancel).then(function (res) {
@@ -1158,18 +1160,18 @@ var Stremio = (function () {
1158
1160
  var arr = U.listOf(a.__impl ? res.streams : fromAddon(a, res, 'sources').streams, MAX_STREAMS).map(youTubeSource).map(torrentSource), said = notes.length;
1159
1161
  arr = arr.filter(function (s) { // (an addon's notices: what it removed and why, its errors; not sources)
1160
1162
  if (!isNotice(s)) { return true; }
1161
- notes.push({ addon: a.manifest.name || 'Addon', title: ('' + (s.name || '')).replace(/\s+/g, ' ').trim().slice(0, 120),
1163
+ notes.push({ addon: a.manifest.name || U.t('Addon'), title: ('' + (s.name || '')).replace(/\s+/g, ' ').trim().slice(0, 120),
1162
1164
  text: ('' + (s.description || s.title || '')).split('\n').map(function (l) { return l.trim(); }).filter(Boolean).join(' · ').slice(0, 400) });
1163
1165
  return false;
1164
1166
  });
1165
1167
  arr.forEach(function (s, n) {
1166
- s._addon = a.manifest.name || 'Addon'; s._addonRank = i; s._addonPos = n;
1168
+ s._addon = a.manifest.name || U.t('Addon'); s._addonRank = i; s._addonPos = n;
1167
1169
  // (a source that needs its own player settings: its User-Agent and Referer, as an IPTV channel's)
1168
1170
  var ph = s.behaviorHints && s.behaviorHints.proxyHeaders, h = ph && ph.request ? U.sanitizeHeaders(ph.request) : null;
1169
1171
  if (h) { s._headers = h; }
1170
1172
  });
1171
1173
  slots[i] = arr; okCount++;
1172
- if (!arr.length && notes.length === said) { note(a, i, 'no sources for this'); } // (its notices say why, when it sent any)
1174
+ if (!arr.length && notes.length === said) { note(a, i, U.t('no sources for this')); } // (its notices say why, when it sent any)
1173
1175
  }).then(function () { done(); }, function (err) {
1174
1176
  // (no answer in time: what you played from it before, marked so — see keptSources)
1175
1177
  if (isTimeout(err) && !slots[i].length) { slots[i] = keptSources(type, id, a, i); }
@@ -1180,7 +1182,7 @@ var Stremio = (function () {
1180
1182
  }), 4);
1181
1183
  }
1182
1184
  // Why an addon gave nothing ("No sources found" shows it), in your addon order
1183
- function note(a, i, why) { notes.push({ addon: a.manifest.name || 'Addon', title: why, text: '', rank: i }); }
1185
+ function note(a, i, why) { notes.push({ addon: a.manifest.name || U.t('Addon'), title: why, text: '', rank: i }); }
1184
1186
  function done() {
1185
1187
  e.pending--;
1186
1188
  e.list = local.concat([].concat.apply([], slots));
@@ -1226,11 +1228,11 @@ var Stremio = (function () {
1226
1228
  // "refused (HTTP 429 · rate_limited)", "didn't answer in time", "couldn't be reached"…
1227
1229
  function whyNone(err) {
1228
1230
  var m = String((err && err.message) || ''), h = /^HTTP (\d{3}) for \S+(?::\s+(.+))?$/.exec(m); // (its message after ": ", not the link's "://")
1229
- if (h) { return 'refused (HTTP ' + h[1] + (h[2] ? ' · ' + h[2].replace(/https?:\/\/\S+/g, '…').slice(0, 80) : '') + ')'; }
1230
- if (isTimeout(err)) { return 'didn’t answer in time'; }
1231
- if (/^(No answer|Network error)/.test(m)) { return 'couldn’t be reached'; }
1232
- if (/^Too large/.test(m)) { return 'sent too much (' + (/\(([^)]+)\)/.exec(m) || ['', 'too large'])[1] + ')'; }
1233
- return 'failed (' + m.replace(/https?:\/\/\S+/g, '…').slice(0, 80) + ')';
1231
+ if (h) { return U.t('refused ({why})', { why: 'HTTP ' + h[1] + (h[2] ? ' · ' + h[2].replace(/https?:\/\/\S+/g, '…').slice(0, 80) : '') }); }
1232
+ if (isTimeout(err)) { return U.t('didn’t answer in time'); }
1233
+ if (/^(No answer|Network error)/.test(m)) { return U.t('couldn’t be reached'); }
1234
+ if (/^Too large/.test(m)) { return U.t('sent too much ({why})', { why: (/\(([^)]+)\)/.exec(m) || ['', U.t('too large')])[1] }); }
1235
+ return U.t('failed ({why})', { why: m.replace(/https?:\/\/\S+/g, '…').slice(0, 80) });
1234
1236
  }
1235
1237
 
1236
1238
  // The debrid service a source comes through, from its tag ("[TB⚡]", "[RD+]"): { tag, name } or null.
@@ -1289,7 +1291,7 @@ var Stremio = (function () {
1289
1291
  U.store.set(KEPT_KEY, all);
1290
1292
  }
1291
1293
  function keptSources(type, id, addon, rank) {
1292
- var name = (addon && addon.manifest && addon.manifest.name) || 'Addon', list = keptAll()[type + ':' + id];
1294
+ var name = (addon && addon.manifest && addon.manifest.name) || U.t('Addon'), list = keptAll()[type + ':' + id];
1293
1295
  return (Array.isArray(list) ? list : []).filter(function (x) { return x && x.st && x.st._addon === name; }).map(function (x, n) {
1294
1296
  var s = {};
1295
1297
  Object.keys(x.st).forEach(function (k) { s[k] = x.st[k]; });
@@ -1350,7 +1352,7 @@ var Stremio = (function () {
1350
1352
  var url = a.base + '/subtitles/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + (args.length ? '/' + args.join('&') : '') + '.json';
1351
1353
  return U.getJSON(url, addonMs(15000)).then(function (res) { // (15 s: a subtitle addon may fetch them from elsewhere first)
1352
1354
  var arr = U.listOf(fromAddon(a, res, 'subtitles').subtitles, MAX_SUBTITLES);
1353
- arr.forEach(function (s) { s._addon = a.manifest.name || 'Addon'; });
1355
+ arr.forEach(function (s) { s._addon = a.manifest.name || U.t('Addon'); });
1354
1356
  return arr;
1355
1357
  });
1356
1358
  };
@@ -1397,7 +1399,7 @@ var Stremio = (function () {
1397
1399
  // Cached TMDB GET.
1398
1400
  function tmdbGet(path, extra, cancel) {
1399
1401
  var key = tmdbKey();
1400
- if (!key) { return Promise.reject(new Error('no TMDB key')); }
1402
+ if (!key) { return Promise.reject(new Error(U.t('no TMDB key'))); }
1401
1403
  return U.cachedJSON(_tmdbCache, 'https://api.themoviedb.org/3' + path + '?api_key=' + encodeURIComponent(key) + (extra || ''), 12000, cancel);
1402
1404
  }
1403
1405
 
@@ -1477,12 +1479,12 @@ var Stremio = (function () {
1477
1479
  out.push({ id: p.id, name: p.name || '', character: role || '', photo: photo !== undefined ? photo : tmdbImg(p.profile_path, 'w185') });
1478
1480
  }
1479
1481
  var crew = (ep && ep.crew) || [];
1480
- crew.filter(function (c) { return c.job === 'Director'; }).forEach(function (c) { add(c, 'Director'); });
1482
+ crew.filter(function (c) { return c.job === 'Director'; }).forEach(function (c) { add(c, U.t('Director')); });
1481
1483
  crew.filter(function (c) { return EP_CREW.test(c.job || ''); }).forEach(function (c) { add(c, c.job); });
1482
1484
  ((ep && ep.cast) || []).forEach(function (c) { add(c, c.character); });
1483
1485
  ((ep && ep.guest_stars) || []).forEach(function (c) { add(c, (c.character ? c.character + ' · ' : '') + 'guest'); });
1484
1486
  if (out.length) {
1485
- ((sh && sh.cast) || []).forEach(function (c) { if (c.character === 'Creator') { add(c, 'Creator', c.photo); } });
1487
+ ((sh && sh.cast) || []).forEach(function (c) { if (c.character === 'Creator') { add(c, U.t('Creator'), c.photo); } });
1486
1488
  return out;
1487
1489
  }
1488
1490
  return (sh && sh.cast) || []; // (nothing for the episode: the show's)
@@ -1495,7 +1497,7 @@ var Stremio = (function () {
1495
1497
  // official ones first, a trailer before a teaser; never a clip (a scene from the episode),
1496
1498
  // bloopers or behind the scenes. imdbId: the show's (tt…).
1497
1499
  // -> { ytId, season: true when it's the season's } or null (none, no TMDB key, no answer).
1498
- var TRAILER_TYPES = ['Trailer', 'Teaser'];
1500
+ var TRAILER_TYPES = ['Trailer', 'Teaser']; // (TMDB's video types: not words shown)
1499
1501
  function bestTrailer(r) {
1500
1502
  var vids = U.listOf(r && r.results, 100, function (v) {
1501
1503
  return v.site === 'YouTube' && typeof v.key === 'string' && /^[A-Za-z0-9_-]{11}$/.test(v.key) && TRAILER_TYPES.indexOf(v.type) !== -1;
@@ -1536,7 +1538,7 @@ var Stremio = (function () {
1536
1538
  var here = r && r.results && r.results[watchRegion()];
1537
1539
  if (!here) { return []; }
1538
1540
  var out = [], seen = {};
1539
- [['flatrate', 'Subscription'], ['free', 'Free'], ['ads', 'Free with ads']].forEach(function (k) {
1541
+ [['flatrate', U.t('Subscription')], ['free', U.t('Free')], ['ads', U.t('Free with ads')]].forEach(function (k) {
1540
1542
  U.listOf(here[k[0]], 30).forEach(function (p) {
1541
1543
  if (!p || !p.provider_name || seen[p.provider_name]) { return; }
1542
1544
  seen[p.provider_name] = true;
@@ -1571,7 +1573,7 @@ var Stremio = (function () {
1571
1573
  });
1572
1574
  var bits = [];
1573
1575
  if (p.known_for_department) { bits.push(p.known_for_department); }
1574
- if (p.birthday) { bits.push('Born ' + p.birthday.slice(0, 4) + (p.deathday ? ' – ' + p.deathday.slice(0, 4) : '')); }
1576
+ if (p.birthday) { bits.push(U.t('Born {years}', { years: p.birthday.slice(0, 4) + (p.deathday ? ' – ' + p.deathday.slice(0, 4) : '') })); }
1575
1577
  if (p.place_of_birth) { bits.push(p.place_of_birth); }
1576
1578
  return { name: p.name || '', photo: tmdbImg(p.profile_path, 'w342'), bio: p.biography || '', meta: bits.join(' · '),
1577
1579
  movies: credits.filter(function (c) { return c.kind === 'movie'; }).sort(byVotes).slice(0, PERSON_MAX),
@@ -1603,10 +1605,10 @@ var Stremio = (function () {
1603
1605
  // ---- Browse (Discover, with a TMDB key): Trending, Popular, and each streaming service in
1604
1606
  // your country, TMDB's, with its genres. ----
1605
1607
  var TMDB_GENRES = {
1606
- movie: [['Action', 28], ['Adventure', 12], ['Animation', 16], ['Comedy', 35], ['Crime', 80], ['Documentary', 99], ['Drama', 18], ['Family', 10751],
1607
- ['Fantasy', 14], ['History', 36], ['Horror', 27], ['Music', 10402], ['Mystery', 9648], ['Romance', 10749], ['Science Fiction', 878], ['Thriller', 53], ['War', 10752], ['Western', 37]],
1608
- tv: [['Action & Adventure', 10759], ['Animation', 16], ['Comedy', 35], ['Crime', 80], ['Documentary', 99], ['Drama', 18], ['Family', 10751], ['Kids', 10762],
1609
- ['Mystery', 9648], ['Reality', 10764], ['Sci-Fi & Fantasy', 10765], ['Soap', 10766], ['Talk', 10767], ['War & Politics', 10768], ['Western', 37]]
1608
+ movie: [[U.t('Action'), 28], [U.t('Adventure'), 12], [U.t('Animation'), 16], [U.t('Comedy'), 35], [U.t('Crime'), 80], [U.t('Documentary'), 99], [U.t('Drama'), 18], [U.t('Family'), 10751],
1609
+ [U.t('Fantasy'), 14], [U.t('History'), 36], [U.t('Horror'), 27], [U.t('Music'), 10402], [U.t('Mystery'), 9648], [U.t('Romance'), 10749], [U.t('Science Fiction'), 878], [U.t('Thriller'), 53], [U.t('War'), 10752], [U.t('Western'), 37]],
1610
+ tv: [[U.t('Action & Adventure'), 10759], [U.t('Animation'), 16], [U.t('Comedy'), 35], [U.t('Crime'), 80], [U.t('Documentary'), 99], [U.t('Drama'), 18], [U.t('Family'), 10751], [U.t('Kids'), 10762],
1611
+ [U.t('Mystery'), 9648], [U.t('Reality'), 10764], [U.t('Sci-Fi & Fantasy'), 10765], [U.t('Soap'), 10766], [U.t('Talk'), 10767], [U.t('War & Politics'), 10768], [U.t('Western'), 37]]
1610
1612
  };
1611
1613
  function tmdbGenres(kind) { return (TMDB_GENRES[kind] || []).map(function (g) { return g[0]; }); }
1612
1614
  // The streaming services in your country (the biggest first, PROVIDERS_MAX), kept a week:
@@ -1728,7 +1730,7 @@ var Stremio = (function () {
1728
1730
 
1729
1731
  // ---- MDBList ratings (Settings > Integrations > MDBList) ----
1730
1732
  // -> [{ key, label, text }] in a fixed order, only the ones the title has.
1731
- var MDB_SOURCES = [['imdb', 'IMDb'], ['tomatoes', 'Rotten Tomatoes'], ['popcorn', 'Audience'],
1733
+ var MDB_SOURCES = [['imdb', 'IMDb'], ['tomatoes', 'Rotten Tomatoes'], ['popcorn', U.t('Audience')],
1732
1734
  ['metacritic', 'Metacritic'], ['letterboxd', 'Letterboxd'], ['tmdb', 'TMDB']];
1733
1735
  function mdblistRatings(type, imdbId, cancel) {
1734
1736
  var key = getIntegrations().mdblist;
@@ -2033,13 +2035,13 @@ var Stremio = (function () {
2033
2035
  if (c.addon && c.addon.__local) {
2034
2036
  if (!local[c.type]) {
2035
2037
  local[c.type] = { key: 'iptv-search|' + c.type, cats: [], title: prettyType(c.type),
2036
- name: prettyType(c.type) + ' · every group · your playlists', pages: false };
2038
+ name: prettyType(c.type) + ' · ' + U.t('every group · your playlists'), pages: false };
2037
2039
  out.push(local[c.type]);
2038
2040
  }
2039
2041
  local[c.type].cats.push(c);
2040
2042
  return;
2041
2043
  }
2042
- var def = c.def || {}, label = def.name || c.id, addonName = (c.addon.manifest && c.addon.manifest.name) || 'Addon';
2044
+ var def = c.def || {}, label = def.name || c.id, addonName = (c.addon.manifest && c.addon.manifest.name) || U.t('Addon');
2043
2045
  var title = prettyType(c.type) + ' · ' + (/^search$/i.test(('' + label).trim()) ? '' : label + ' · ') + addonName;
2044
2046
  out.push({ key: catalogKey(c), cats: [c], title: title, name: title.replace(/ · /g, ' · '),
2045
2047
  pages: (def.extra || []).some(function (e) { return e && e.name === 'skip'; }) || (def.extraSupported || []).indexOf('skip') !== -1 });
@@ -2095,16 +2097,16 @@ var Stremio = (function () {
2095
2097
  // Does it answer? { ok, text } — Stremio's /settings (its version in it), TorrServer's /echo.
2096
2098
  function testServer() {
2097
2099
  var sv = server();
2098
- if (!sv.kind || !sv.url) { return Promise.resolve({ ok: false, text: 'No server set' }); }
2100
+ if (!sv.kind || !sv.url) { return Promise.resolve({ ok: false, text: U.t('No server set') }); }
2099
2101
  var p = sv.kind === 'stremio'
2100
2102
  ? U.getJSON(sv.url + '/settings', 8000).then(function (r) {
2101
- if (!r || typeof r !== 'object') { throw new Error('Not a Stremio streaming server'); }
2103
+ if (!r || typeof r !== 'object') { throw new Error(U.t('Not a Stremio streaming server')); }
2102
2104
  var v = r.values && r.values.serverVersion;
2103
- return 'Stremio server answers' + (v ? ' (' + ('' + v).slice(0, 20) + ')' : '');
2105
+ return v ? U.t('Stremio server answers ({v})', { v: ('' + v).slice(0, 20) }) : U.t('Stremio server answers');
2104
2106
  })
2105
- : U.getText(sv.url + '/echo', 8000).then(function (t) { return 'TorrServer answers (' + ('' + t).trim().slice(0, 30) + ')'; });
2107
+ : U.getText(sv.url + '/echo', 8000).then(function (t) { return U.t('TorrServer answers ({v})', { v: ('' + t).trim().slice(0, 30) }); });
2106
2108
  return p.then(function (text) { return { ok: true, text: text }; },
2107
- function (e) { return { ok: false, text: 'The server didn’t answer: ' + U.problem(e) }; });
2109
+ function (e) { return { ok: false, text: U.t('The server didn’t answer: {why}', { why: U.problem(e) }) }; });
2108
2110
  }
2109
2111
  // Made again each time it's asked (a page kept from before, just before playing): from the
2110
2112
  // server set now, or no link when there's none.
@@ -2168,13 +2170,13 @@ var Stremio = (function () {
2168
2170
  }
2169
2171
 
2170
2172
  function streamLabel(stream) {
2171
- var t = stream.title || stream.name || stream.description || 'Stream';
2173
+ var t = stream.title || stream.name || stream.description || U.t('Stream');
2172
2174
  return ('' + t).replace(/\n/g, ' ');
2173
2175
  }
2174
2176
 
2175
2177
  // Short first-line label (quality / addon tag), e.g. "MediaFusion 2160p".
2176
2178
  function streamName(stream) {
2177
- var t = stream.name || stream.title || stream.description || 'Source';
2179
+ var t = stream.name || stream.title || stream.description || U.t('Source');
2178
2180
  return U.drawable(('' + t).split('\n')[0]).trim(); // (without characters the TV can't draw)
2179
2181
  }
2180
2182
 
@@ -2273,15 +2275,15 @@ var Stremio = (function () {
2273
2275
  // different files, at least once as the only suspect. You can set any either way.
2274
2276
  var FORMATS_KEY = 'stremiok.formats';
2275
2277
  var FORMAT_LABELS = {
2276
- 'v:h264': ['Video', 'H.264 (AVC)'], 'v:hevc': ['Video', 'HEVC (H.265)'], 'v:av1': ['Video', 'AV1'], 'v:10bit': ['Video', '10-bit color'],
2277
- 'h:hdr': ['HDR', 'HDR10 / HLG'], 'h:hdr10p': ['HDR', 'HDR10+'], 'h:dv': ['HDR', 'Dolby Vision (with HDR fallback)'], 'h:dv-only': ['HDR', 'Dolby Vision only'],
2278
+ 'v:h264': ['Video', 'H.264 (AVC)'], 'v:hevc': ['Video', 'HEVC (H.265)'], 'v:av1': ['Video', 'AV1'], 'v:10bit': ['Video', U.t('10-bit color')],
2279
+ 'h:hdr': ['HDR', 'HDR10 / HLG'], 'h:hdr10p': ['HDR', 'HDR10+'], 'h:dv': ['HDR', U.t('Dolby Vision (with HDR fallback)')], 'h:dv-only': ['HDR', U.t('Dolby Vision only')],
2278
2280
  'a:atmos': ['Audio', 'Dolby Atmos'], 'a:truehd': ['Audio', 'Dolby TrueHD'], 'a:dtshd': ['Audio', 'DTS-HD / DTS:X'], 'a:dts': ['Audio', 'DTS'],
2279
2281
  'a:eac3': ['Audio', 'Dolby Digital Plus (EAC3)'], 'a:ac3': ['Audio', 'Dolby Digital (AC3)'], 'a:aac': ['Audio', 'AAC'], 'a:opus': ['Audio', 'Opus'], 'a:flac': ['Audio', 'FLAC'],
2280
- 'c:mkv': ['File', 'MKV'], 'c:mp4': ['File', 'MP4'], 'c:avi': ['File', 'AVI'], 'c:webm': ['File', 'WebM'], 'c:ts': ['File', 'MPEG-TS'], 'c:hls': ['File', 'HLS stream']
2282
+ 'c:mkv': ['File', 'MKV'], 'c:mp4': ['File', 'MP4'], 'c:avi': ['File', 'AVI'], 'c:webm': ['File', 'WebM'], 'c:ts': ['File', 'MPEG-TS'], 'c:hls': ['File', U.t('HLS stream')]
2281
2283
  };
2282
- var PROFILE_RES = { 2160: '4K', 1440: '1440p', 1080: '1080p', 720: '720p', 480: 'SD', 0: 'Unknown resolution' };
2283
- var PROFILE_CODEC = { h264: 'H.264', hevc: 'HEVC', av1: 'AV1', '?': 'unknown codec' };
2284
- var PROFILE_HDR = { hdr: 'HDR10', hdr10p: 'HDR10+', dv: 'Dolby Vision + HDR', 'dv-only': 'Dolby Vision only', sdr: 'SDR' };
2284
+ var PROFILE_RES = { 2160: '4K', 1440: '1440p', 1080: '1080p', 720: '720p', 480: 'SD', 0: U.t('Unknown resolution') };
2285
+ var PROFILE_CODEC = { h264: 'H.264', hevc: 'HEVC', av1: 'AV1', '?': U.t('unknown codec') };
2286
+ var PROFILE_HDR = { hdr: 'HDR10', hdr10p: 'HDR10+', dv: 'Dolby Vision + HDR', 'dv-only': U.t('Dolby Vision only'), sdr: 'SDR' };
2285
2287
  // "p:<res>|<codec>|<bits>|<hdr>", or null when neither resolution nor codec is known.
2286
2288
  // HDR is 10-bit even when the name doesn't say so.
2287
2289
  function profileKey(info) {
@@ -2314,7 +2316,7 @@ var Stremio = (function () {
2314
2316
  if (heard && aud.indexOf(heard) === -1) { aud = aud.filter(function (x) { return x === 'atmos'; }).concat([heard]); }
2315
2317
  aud.slice(0, 2).forEach(function (x) { out.push(SHORT_AUDIO[x] || x); });
2316
2318
  var ch = +actual.channels || 0;
2317
- if (ch) { out.push(ch === 6 ? '5.1' : ch === 8 ? '7.1' : ch === 2 ? 'Stereo' : ch === 1 ? 'Mono' : ch + 'ch'); }
2319
+ if (ch) { out.push(ch === 6 ? '5.1' : ch === 8 ? '7.1' : ch === 2 ? U.t('Stereo') : ch === 1 ? U.t('Mono') : ch + 'ch'); }
2318
2320
  if (info.container && info.container !== 'hls') { out.push(info.container.toUpperCase()); }
2319
2321
  return out.join(' · ');
2320
2322
  }
@@ -2369,7 +2371,7 @@ var Stremio = (function () {
2369
2371
  // Allowed resolutions: yours to set (all allowed to begin with). A source at one that
2370
2372
  // isn't goes with the "Not working" ones: bottom of the list, never Play best / Next.
2371
2373
  var RES_KEY = 'stremiok.resblock';
2372
- var RES_CHOICES = [[2160, '4K'], [1440, '1440p'], [1080, '1080p'], [720, '720p'], [480, 'SD'], [0, 'Unknown']];
2374
+ var RES_CHOICES = [[2160, '4K'], [1440, '1440p'], [1080, '1080p'], [720, '720p'], [480, 'SD'], [0, U.t('Unknown')]];
2373
2375
  function resBucket(res) { return res >= 2160 ? 2160 : res >= 1440 ? 1440 : res >= 1080 ? 1080 : res >= 720 ? 720 : res > 0 ? 480 : 0; }
2374
2376
  function resList() {
2375
2377
  var off = U.store.get(RES_KEY, {}) || {};
package/js/stvod.js CHANGED
@@ -34,7 +34,7 @@ var StVod = (function () {
34
34
  function setKeepMinutes(m) { U.store.set(KEEP_KEY, KEEPS.indexOf(+m) !== -1 ? +m : 10); }
35
35
  // The service's answer ({ why }: an error).
36
36
  function ask(acc, more) {
37
- if (typeof YTPlay === 'undefined' || !YTPlay.stalkerVod) { return Promise.reject(new Error('Stalker portals are read by StremioK’s service (not in a desktop browser)')); }
37
+ if (typeof YTPlay === 'undefined' || !YTPlay.stalkerVod) { return Promise.reject(new Error(U.t('Stalker portals are read by StremioK’s service (not in a desktop browser)'))); }
38
38
  return YTPlay.stalkerVod(acc.url, acc.mac, more + '&keep=' + keepMinutes()).then(function (r) {
39
39
  if (!r || r.why) { throw new Error((r && r.why) || 'no answer'); }
40
40
  return r;
@@ -205,7 +205,7 @@ var StVod = (function () {
205
205
  if (list(it.cast).length) { m.cast = list(it.cast); }
206
206
  if (list(it.director).length) { m.director = list(it.director); }
207
207
  if (it.rating > 0) { m.imdbRating = (+it.rating).toFixed(1); }
208
- if (it.mins > 0) { m.runtime = it.mins + ' min'; }
208
+ if (it.mins > 0) { m.runtime = U.t('{n} min', { n: it.mins }); }
209
209
  if (it.year) { m.releaseInfo = '' + it.year; m.year = '' + it.year; }
210
210
  return m;
211
211
  }
@@ -221,10 +221,10 @@ var StVod = (function () {
221
221
  return seasons(x.acc, x).then(function (l) {
222
222
  if (!it && !l.length) { return null; }
223
223
  if (it) { remember(x.base, it); }
224
- var m = details({ id: x.base, type: 'series', name: it ? it.name : 'Series', _from: x.acc.label }, it || {});
224
+ var m = details({ id: x.base, type: 'series', name: it ? it.name : U.t('Series'), _from: x.acc.label }, it || {});
225
225
  m.videos = [];
226
226
  l.forEach(function (se) {
227
- (se.eps || []).forEach(function (ep) { m.videos.push({ id: x.base + ':' + se.season + ':' + ep.n, season: se.season, episode: ep.n, title: ep.name || 'Episode ' + ep.n }); });
227
+ (se.eps || []).forEach(function (ep) { m.videos.push({ id: x.base + ':' + se.season + ':' + ep.n, season: se.season, episode: ep.n, title: ep.name || U.t('Episode {n}', { n: ep.n }) }); });
228
228
  });
229
229
  return m;
230
230
  });