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.
Files changed (57) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +6 -5
  3. package/config.xml +1 -1
  4. package/css/style.css +5 -0
  5. package/index.html +42 -39
  6. package/js/app.js +7 -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 +62 -29
  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 +60 -57
  34. package/js/player-lang.js +22 -22
  35. package/js/player-quality.js +15 -15
  36. package/js/player-store.js +25 -18
  37. package/js/player-subs.js +69 -69
  38. package/js/plex.js +69 -21
  39. package/js/stremio-account.js +17 -12
  40. package/js/stremio-sync.js +641 -0
  41. package/js/stremio.js +79 -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 +39 -27
  46. package/js/view-core.js +109 -92
  47. package/js/view-detail.js +135 -126
  48. package/js/view-discover.js +27 -27
  49. package/js/view-guide.js +13 -13
  50. package/js/view-home.js +148 -120
  51. package/js/view-search.js +25 -25
  52. package/js/view-settings.js +735 -643
  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
  }
@@ -446,6 +447,7 @@ var Stremio = (function () {
446
447
  if (typeof Plex !== 'undefined') { Plex.synthAddons().forEach(function (a) { addons.push(a); }); } // (your Plex servers')
447
448
  if (hasYouTube()) { addons.push(YouTube.synthAddon()); } // (after your addons: its rows last on Home)
448
449
  if (typeof Trakt !== 'undefined' && Trakt.isConnected()) { addons.push(Trakt.synthAddon()); } // (your Watchlist and Up next)
450
+ if (typeof StremioSync !== 'undefined' && StremioSync.isConnected()) { addons.push(StremioSync.synthAddon()); } // (your Stremio account's Library)
449
451
  _loaded = addons;
450
452
  U.mark('addons');
451
453
  var stale = urls.filter(function (u) { return !_refreshedUrls[u] && saved[u]; });
@@ -517,7 +519,7 @@ var Stremio = (function () {
517
519
  function iptvRefreshEvery() { return _hasIptv && IPTV.refreshEvery ? IPTV.refreshEvery() : 0; }
518
520
  function iptvSetRefreshEvery(h) { if (_hasIptv && IPTV.setRefreshEvery) { IPTV.setRefreshEvery(h); } }
519
521
  function iptvReadAt() { return _hasIptv && IPTV.readAt ? IPTV.readAt() : Infinity; }
520
- 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') }; }
521
523
  // Force a re-fetch of one playlist (Settings → Reload) and rebuild the addon list.
522
524
  // An Xtream account turned out to have films and series, or none (XtVod.onVodChange): the IPTV
523
525
  // rows made again from the saved copies (its film and episode lines in or out), not downloaded.
@@ -555,7 +557,7 @@ var Stremio = (function () {
555
557
  // A configuration file's lines (Settings › Import configuration file), read but not yet
556
558
  // imported: { items: [{ kind: 'addon' | 'playlist' | 'omdb' | 'tmdb' | 'mdblist', value,
557
559
  // label, have (already yours), note }], ignored }. Blank lines and # comments skipped.
558
- 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') };
559
561
  function shortLink(u) {
560
562
  var p = U.parseUrl(u);
561
563
  if (!p) { return ('' + u).slice(0, 60); }
@@ -582,11 +584,11 @@ var Stremio = (function () {
582
584
  var lists = iptvLists(), integ = getIntegrations(), out = [], n = getAddonUrls().length;
583
585
  var pl = lists.filter(function (p) { return !p.mac; }).length, st = lists.length - pl;
584
586
  var keys = Object.keys(KEY_NAMES).filter(function (k) { return integ[k]; }).map(function (k) { return KEY_NAMES[k].replace(/ key$/, ''); });
585
- if (n) { out.push({ key: 'addons', label: plural(n, 'addon') + ', in your order' }); }
586
- if (pl) { out.push({ key: 'playlists', label: plural(pl, 'IPTV playlist') + ' (their logins too)' }); }
587
- if (st) { out.push({ key: 'stalker', label: plural(st, 'Stalker portal') + ' (their MAC addresses)' }); }
588
- if (keys.length) { out.push({ key: 'keys', label: 'API keys: ' + keys.join(', ') }); }
589
- 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…') });
590
592
  return out;
591
593
  }
592
594
  function settingsValue(key) {
@@ -644,7 +646,7 @@ var Stremio = (function () {
644
646
  if (m[1] === 'playlist' && typeof o.url === 'string') { details[o.url] = o; return; }
645
647
  if (m[1] === 'stalker' && typeof o.url === 'string' && _hasIptv && IPTV.macOf && IPTV.macOf(o.mac)) {
646
648
  var mac = IPTV.macOf(o.mac);
647
- 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)),
648
650
  have: have.some(function (p) { return p.url === o.url && p.mac === mac; }), note: '' });
649
651
  return;
650
652
  }
@@ -660,21 +662,21 @@ var Stremio = (function () {
660
662
  else if (/^[A-Za-z0-9]{25}$/.test(value)) { key = 'mdblist'; }
661
663
  if (key) {
662
664
  push({ kind: key, value: value, label: KEY_NAMES[key] + ' · …' + value.slice(-4), have: integ[key] === value,
663
- note: (integ[key] && integ[key] !== value) ? 'replaces yours' : '' });
665
+ note: (integ[key] && integ[key] !== value) ? U.t('replaces yours') : '' });
664
666
  } else if (U.isPlaylistUrl(U.parseUrl(value))) { // …m3u / .m3u8 (a query after it too), Xtream get.php?…type=m3u_plus
665
- 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: '' });
666
668
  } else if (value.indexOf('://') !== -1 && normalizeManifestUrl(value)) {
667
669
  var url = normalizeManifestUrl(value);
668
- 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: '' });
669
671
  } else {
670
672
  out.ignored++;
671
673
  }
672
674
  });
673
675
  out.items.forEach(function (it) { // (a playlist's name, guide link, off: with it)
674
676
  var d = it.kind === 'playlist' && details[it.value];
675
- 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); } }
676
678
  });
677
- 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') }); }
678
680
  return out;
679
681
  }
680
682
  function playlistDetails(id, d) {
@@ -773,7 +775,8 @@ var Stremio = (function () {
773
775
 
774
776
  // ---- Catalogs ----
775
777
  // Returns list of {addon, type, id, name} across all addons.
776
- 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') };
777
780
  function prettyType(t) {
778
781
  if (TYPE_LABELS[t]) { return TYPE_LABELS[t]; }
779
782
  return t ? (t.charAt(0).toUpperCase() + t.slice(1)) : '';
@@ -790,7 +793,7 @@ var Stremio = (function () {
790
793
  // Include the type so per-type catalogs sharing a name (e.g. Cinemeta's
791
794
  // "Popular" for both movie & series) don't look like duplicates.
792
795
  cats.push({ addon: addon, type: c.type, id: c.id, def: c, label: label,
793
- name: prettyType(c.type) + ' · ' + label + ' · ' + (addon.manifest.name || 'Addon') });
796
+ name: prettyType(c.type) + ' · ' + label + ' · ' + (addon.manifest.name || U.t('Addon')) });
794
797
  });
795
798
  });
796
799
  return cats;
@@ -932,14 +935,14 @@ var Stremio = (function () {
932
935
  // whether sources played before go first. Stored as { order: [keys], off: [keys], played }.
933
936
  var RANKING_KEY = 'stremiok.ranking';
934
937
  var RANK_CRITERIA = [
935
- ['res', 'Resolution (high to low)', '4K, 1440p, 1080p, 720p, SD, then unknown; at the top, the sources are grouped by resolution'],
936
- ['uncached', 'Not yet cached last', 'sources an addon marks as not cached on your debrid service yet (they can’t start right away)'],
937
- ['kind', 'Release type', 'remux > Blu-ray > web > unknown > TV rip, CAM rips far below'],
938
- ['hdr', 'HDR before SDR', 'HDR10 / HDR10+ / Dolby Vision first'],
939
- ['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'],
940
- ['addon', 'Feed sources order', 'your order of the addons (at the bottom of this page)'],
941
- ['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'],
942
- ['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')]
943
946
  ];
944
947
  var RANK_OFF_DEFAULT = ['cached'];
945
948
  var RANK_AFTER = { seeds: 'hdr' }; // (added in 2.2.1.13)
@@ -1025,23 +1028,23 @@ var Stremio = (function () {
1025
1028
  function isErrorMeta(m) { return /^(aiostreamserror\.|aiom\.error\.)/.test('' + (m && m.id)); }
1026
1029
  function getMeta(type, id, cancel) {
1027
1030
  if (/^ytk:/.test(id) && typeof YouTube !== 'undefined') {
1028
- 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; });
1029
1032
  }
1030
1033
  if (/^xv[ms]\./.test(id) && typeof XtVod !== 'undefined') {
1031
- 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; });
1032
1035
  }
1033
1036
  if (/^sv[ms]\./.test(id) && typeof StVod !== 'undefined') {
1034
- 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; });
1035
1038
  }
1036
1039
  if (/^jf[ms]\./.test(id) && typeof Jellyfin !== 'undefined') {
1037
- 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; });
1038
1041
  }
1039
1042
  if (/^px[ms]\./.test(id) && typeof Plex !== 'undefined') {
1040
- 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; });
1041
1044
  }
1042
1045
  if (/^iptv:/.test(id)) {
1043
1046
  return IPTV.meta(id).then(function (m) {
1044
- if (!m) { throw new Error('IPTV channel not found'); }
1047
+ if (!m) { throw new Error(U.t('IPTV channel not found')); }
1045
1048
  return m;
1046
1049
  });
1047
1050
  }
@@ -1057,10 +1060,10 @@ var Stremio = (function () {
1057
1060
  providers = addons.filter(function (a) { return !a.__local && ownsId(a, 'meta', id); });
1058
1061
  providers.forEach(function (a) { asType[a.url] = ownType(a, 'meta'); });
1059
1062
  }
1060
- 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 }))); }
1061
1064
  var i = 0;
1062
1065
  function tryNext() {
1063
- 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'))); }
1064
1067
  var a = providers[i++];
1065
1068
  var url = a.base + '/meta/' + encodeURIComponent(asType[a.url] || type) + '/' + encodeURIComponent(id) + '.json';
1066
1069
  return U.getJSON(url, addonMs(12000), META_MAX, cancel).then(function (res) {
@@ -1157,18 +1160,18 @@ var Stremio = (function () {
1157
1160
  var arr = U.listOf(a.__impl ? res.streams : fromAddon(a, res, 'sources').streams, MAX_STREAMS).map(youTubeSource).map(torrentSource), said = notes.length;
1158
1161
  arr = arr.filter(function (s) { // (an addon's notices: what it removed and why, its errors; not sources)
1159
1162
  if (!isNotice(s)) { return true; }
1160
- 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),
1161
1164
  text: ('' + (s.description || s.title || '')).split('\n').map(function (l) { return l.trim(); }).filter(Boolean).join(' · ').slice(0, 400) });
1162
1165
  return false;
1163
1166
  });
1164
1167
  arr.forEach(function (s, n) {
1165
- 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;
1166
1169
  // (a source that needs its own player settings: its User-Agent and Referer, as an IPTV channel's)
1167
1170
  var ph = s.behaviorHints && s.behaviorHints.proxyHeaders, h = ph && ph.request ? U.sanitizeHeaders(ph.request) : null;
1168
1171
  if (h) { s._headers = h; }
1169
1172
  });
1170
1173
  slots[i] = arr; okCount++;
1171
- 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)
1172
1175
  }).then(function () { done(); }, function (err) {
1173
1176
  // (no answer in time: what you played from it before, marked so — see keptSources)
1174
1177
  if (isTimeout(err) && !slots[i].length) { slots[i] = keptSources(type, id, a, i); }
@@ -1179,7 +1182,7 @@ var Stremio = (function () {
1179
1182
  }), 4);
1180
1183
  }
1181
1184
  // Why an addon gave nothing ("No sources found" shows it), in your addon order
1182
- 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 }); }
1183
1186
  function done() {
1184
1187
  e.pending--;
1185
1188
  e.list = local.concat([].concat.apply([], slots));
@@ -1225,11 +1228,11 @@ var Stremio = (function () {
1225
1228
  // "refused (HTTP 429 · rate_limited)", "didn't answer in time", "couldn't be reached"…
1226
1229
  function whyNone(err) {
1227
1230
  var m = String((err && err.message) || ''), h = /^HTTP (\d{3}) for \S+(?::\s+(.+))?$/.exec(m); // (its message after ": ", not the link's "://")
1228
- if (h) { return 'refused (HTTP ' + h[1] + (h[2] ? ' · ' + h[2].replace(/https?:\/\/\S+/g, '…').slice(0, 80) : '') + ')'; }
1229
- if (isTimeout(err)) { return 'didn’t answer in time'; }
1230
- if (/^(No answer|Network error)/.test(m)) { return 'couldn’t be reached'; }
1231
- if (/^Too large/.test(m)) { return 'sent too much (' + (/\(([^)]+)\)/.exec(m) || ['', 'too large'])[1] + ')'; }
1232
- 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) });
1233
1236
  }
1234
1237
 
1235
1238
  // The debrid service a source comes through, from its tag ("[TB⚡]", "[RD+]"): { tag, name } or null.
@@ -1288,7 +1291,7 @@ var Stremio = (function () {
1288
1291
  U.store.set(KEPT_KEY, all);
1289
1292
  }
1290
1293
  function keptSources(type, id, addon, rank) {
1291
- 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];
1292
1295
  return (Array.isArray(list) ? list : []).filter(function (x) { return x && x.st && x.st._addon === name; }).map(function (x, n) {
1293
1296
  var s = {};
1294
1297
  Object.keys(x.st).forEach(function (k) { s[k] = x.st[k]; });
@@ -1349,7 +1352,7 @@ var Stremio = (function () {
1349
1352
  var url = a.base + '/subtitles/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + (args.length ? '/' + args.join('&') : '') + '.json';
1350
1353
  return U.getJSON(url, addonMs(15000)).then(function (res) { // (15 s: a subtitle addon may fetch them from elsewhere first)
1351
1354
  var arr = U.listOf(fromAddon(a, res, 'subtitles').subtitles, MAX_SUBTITLES);
1352
- arr.forEach(function (s) { s._addon = a.manifest.name || 'Addon'; });
1355
+ arr.forEach(function (s) { s._addon = a.manifest.name || U.t('Addon'); });
1353
1356
  return arr;
1354
1357
  });
1355
1358
  };
@@ -1396,7 +1399,7 @@ var Stremio = (function () {
1396
1399
  // Cached TMDB GET.
1397
1400
  function tmdbGet(path, extra, cancel) {
1398
1401
  var key = tmdbKey();
1399
- if (!key) { return Promise.reject(new Error('no TMDB key')); }
1402
+ if (!key) { return Promise.reject(new Error(U.t('no TMDB key'))); }
1400
1403
  return U.cachedJSON(_tmdbCache, 'https://api.themoviedb.org/3' + path + '?api_key=' + encodeURIComponent(key) + (extra || ''), 12000, cancel);
1401
1404
  }
1402
1405
 
@@ -1476,12 +1479,12 @@ var Stremio = (function () {
1476
1479
  out.push({ id: p.id, name: p.name || '', character: role || '', photo: photo !== undefined ? photo : tmdbImg(p.profile_path, 'w185') });
1477
1480
  }
1478
1481
  var crew = (ep && ep.crew) || [];
1479
- 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')); });
1480
1483
  crew.filter(function (c) { return EP_CREW.test(c.job || ''); }).forEach(function (c) { add(c, c.job); });
1481
1484
  ((ep && ep.cast) || []).forEach(function (c) { add(c, c.character); });
1482
1485
  ((ep && ep.guest_stars) || []).forEach(function (c) { add(c, (c.character ? c.character + ' · ' : '') + 'guest'); });
1483
1486
  if (out.length) {
1484
- ((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); } });
1485
1488
  return out;
1486
1489
  }
1487
1490
  return (sh && sh.cast) || []; // (nothing for the episode: the show's)
@@ -1494,7 +1497,7 @@ var Stremio = (function () {
1494
1497
  // official ones first, a trailer before a teaser; never a clip (a scene from the episode),
1495
1498
  // bloopers or behind the scenes. imdbId: the show's (tt…).
1496
1499
  // -> { ytId, season: true when it's the season's } or null (none, no TMDB key, no answer).
1497
- var TRAILER_TYPES = ['Trailer', 'Teaser'];
1500
+ var TRAILER_TYPES = ['Trailer', 'Teaser']; // (TMDB's video types: not words shown)
1498
1501
  function bestTrailer(r) {
1499
1502
  var vids = U.listOf(r && r.results, 100, function (v) {
1500
1503
  return v.site === 'YouTube' && typeof v.key === 'string' && /^[A-Za-z0-9_-]{11}$/.test(v.key) && TRAILER_TYPES.indexOf(v.type) !== -1;
@@ -1535,7 +1538,7 @@ var Stremio = (function () {
1535
1538
  var here = r && r.results && r.results[watchRegion()];
1536
1539
  if (!here) { return []; }
1537
1540
  var out = [], seen = {};
1538
- [['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) {
1539
1542
  U.listOf(here[k[0]], 30).forEach(function (p) {
1540
1543
  if (!p || !p.provider_name || seen[p.provider_name]) { return; }
1541
1544
  seen[p.provider_name] = true;
@@ -1570,7 +1573,7 @@ var Stremio = (function () {
1570
1573
  });
1571
1574
  var bits = [];
1572
1575
  if (p.known_for_department) { bits.push(p.known_for_department); }
1573
- 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) : '') })); }
1574
1577
  if (p.place_of_birth) { bits.push(p.place_of_birth); }
1575
1578
  return { name: p.name || '', photo: tmdbImg(p.profile_path, 'w342'), bio: p.biography || '', meta: bits.join(' · '),
1576
1579
  movies: credits.filter(function (c) { return c.kind === 'movie'; }).sort(byVotes).slice(0, PERSON_MAX),
@@ -1602,10 +1605,10 @@ var Stremio = (function () {
1602
1605
  // ---- Browse (Discover, with a TMDB key): Trending, Popular, and each streaming service in
1603
1606
  // your country, TMDB's, with its genres. ----
1604
1607
  var TMDB_GENRES = {
1605
- movie: [['Action', 28], ['Adventure', 12], ['Animation', 16], ['Comedy', 35], ['Crime', 80], ['Documentary', 99], ['Drama', 18], ['Family', 10751],
1606
- ['Fantasy', 14], ['History', 36], ['Horror', 27], ['Music', 10402], ['Mystery', 9648], ['Romance', 10749], ['Science Fiction', 878], ['Thriller', 53], ['War', 10752], ['Western', 37]],
1607
- tv: [['Action & Adventure', 10759], ['Animation', 16], ['Comedy', 35], ['Crime', 80], ['Documentary', 99], ['Drama', 18], ['Family', 10751], ['Kids', 10762],
1608
- ['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]]
1609
1612
  };
1610
1613
  function tmdbGenres(kind) { return (TMDB_GENRES[kind] || []).map(function (g) { return g[0]; }); }
1611
1614
  // The streaming services in your country (the biggest first, PROVIDERS_MAX), kept a week:
@@ -1727,7 +1730,7 @@ var Stremio = (function () {
1727
1730
 
1728
1731
  // ---- MDBList ratings (Settings > Integrations > MDBList) ----
1729
1732
  // -> [{ key, label, text }] in a fixed order, only the ones the title has.
1730
- var MDB_SOURCES = [['imdb', 'IMDb'], ['tomatoes', 'Rotten Tomatoes'], ['popcorn', 'Audience'],
1733
+ var MDB_SOURCES = [['imdb', 'IMDb'], ['tomatoes', 'Rotten Tomatoes'], ['popcorn', U.t('Audience')],
1731
1734
  ['metacritic', 'Metacritic'], ['letterboxd', 'Letterboxd'], ['tmdb', 'TMDB']];
1732
1735
  function mdblistRatings(type, imdbId, cancel) {
1733
1736
  var key = getIntegrations().mdblist;
@@ -2032,13 +2035,13 @@ var Stremio = (function () {
2032
2035
  if (c.addon && c.addon.__local) {
2033
2036
  if (!local[c.type]) {
2034
2037
  local[c.type] = { key: 'iptv-search|' + c.type, cats: [], title: prettyType(c.type),
2035
- name: prettyType(c.type) + ' · every group · your playlists', pages: false };
2038
+ name: prettyType(c.type) + ' · ' + U.t('every group · your playlists'), pages: false };
2036
2039
  out.push(local[c.type]);
2037
2040
  }
2038
2041
  local[c.type].cats.push(c);
2039
2042
  return;
2040
2043
  }
2041
- 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');
2042
2045
  var title = prettyType(c.type) + ' · ' + (/^search$/i.test(('' + label).trim()) ? '' : label + ' · ') + addonName;
2043
2046
  out.push({ key: catalogKey(c), cats: [c], title: title, name: title.replace(/ · /g, ' · '),
2044
2047
  pages: (def.extra || []).some(function (e) { return e && e.name === 'skip'; }) || (def.extraSupported || []).indexOf('skip') !== -1 });
@@ -2094,16 +2097,16 @@ var Stremio = (function () {
2094
2097
  // Does it answer? { ok, text } — Stremio's /settings (its version in it), TorrServer's /echo.
2095
2098
  function testServer() {
2096
2099
  var sv = server();
2097
- 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') }); }
2098
2101
  var p = sv.kind === 'stremio'
2099
2102
  ? U.getJSON(sv.url + '/settings', 8000).then(function (r) {
2100
- 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')); }
2101
2104
  var v = r.values && r.values.serverVersion;
2102
- 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');
2103
2106
  })
2104
- : 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) }); });
2105
2108
  return p.then(function (text) { return { ok: true, text: text }; },
2106
- 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) }) }; });
2107
2110
  }
2108
2111
  // Made again each time it's asked (a page kept from before, just before playing): from the
2109
2112
  // server set now, or no link when there's none.
@@ -2167,13 +2170,13 @@ var Stremio = (function () {
2167
2170
  }
2168
2171
 
2169
2172
  function streamLabel(stream) {
2170
- var t = stream.title || stream.name || stream.description || 'Stream';
2173
+ var t = stream.title || stream.name || stream.description || U.t('Stream');
2171
2174
  return ('' + t).replace(/\n/g, ' ');
2172
2175
  }
2173
2176
 
2174
2177
  // Short first-line label (quality / addon tag), e.g. "MediaFusion 2160p".
2175
2178
  function streamName(stream) {
2176
- var t = stream.name || stream.title || stream.description || 'Source';
2179
+ var t = stream.name || stream.title || stream.description || U.t('Source');
2177
2180
  return U.drawable(('' + t).split('\n')[0]).trim(); // (without characters the TV can't draw)
2178
2181
  }
2179
2182
 
@@ -2272,15 +2275,15 @@ var Stremio = (function () {
2272
2275
  // different files, at least once as the only suspect. You can set any either way.
2273
2276
  var FORMATS_KEY = 'stremiok.formats';
2274
2277
  var FORMAT_LABELS = {
2275
- 'v:h264': ['Video', 'H.264 (AVC)'], 'v:hevc': ['Video', 'HEVC (H.265)'], 'v:av1': ['Video', 'AV1'], 'v:10bit': ['Video', '10-bit color'],
2276
- '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')],
2277
2280
  'a:atmos': ['Audio', 'Dolby Atmos'], 'a:truehd': ['Audio', 'Dolby TrueHD'], 'a:dtshd': ['Audio', 'DTS-HD / DTS:X'], 'a:dts': ['Audio', 'DTS'],
2278
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'],
2279
- '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')]
2280
2283
  };
2281
- var PROFILE_RES = { 2160: '4K', 1440: '1440p', 1080: '1080p', 720: '720p', 480: 'SD', 0: 'Unknown resolution' };
2282
- var PROFILE_CODEC = { h264: 'H.264', hevc: 'HEVC', av1: 'AV1', '?': 'unknown codec' };
2283
- 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' };
2284
2287
  // "p:<res>|<codec>|<bits>|<hdr>", or null when neither resolution nor codec is known.
2285
2288
  // HDR is 10-bit even when the name doesn't say so.
2286
2289
  function profileKey(info) {
@@ -2313,7 +2316,7 @@ var Stremio = (function () {
2313
2316
  if (heard && aud.indexOf(heard) === -1) { aud = aud.filter(function (x) { return x === 'atmos'; }).concat([heard]); }
2314
2317
  aud.slice(0, 2).forEach(function (x) { out.push(SHORT_AUDIO[x] || x); });
2315
2318
  var ch = +actual.channels || 0;
2316
- 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'); }
2317
2320
  if (info.container && info.container !== 'hls') { out.push(info.container.toUpperCase()); }
2318
2321
  return out.join(' · ');
2319
2322
  }
@@ -2368,7 +2371,7 @@ var Stremio = (function () {
2368
2371
  // Allowed resolutions: yours to set (all allowed to begin with). A source at one that
2369
2372
  // isn't goes with the "Not working" ones: bottom of the list, never Play best / Next.
2370
2373
  var RES_KEY = 'stremiok.resblock';
2371
- 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')]];
2372
2375
  function resBucket(res) { return res >= 2160 ? 2160 : res >= 1440 ? 1440 : res >= 1080 ? 1080 : res >= 720 ? 720 : res > 0 ? 480 : 0; }
2373
2376
  function resList() {
2374
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
  });