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
package/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  What changed in each version of StremioK, newest first. How everything works is in the
4
4
  [user guide](docs/USER-GUIDE.md).
5
5
 
6
+ ## 2.3.6 — 2026-11-11
7
+ - **Nuvio plugins** (Settings › Content › Nuvio plugins; 2017 and newer TVs, sideloaded
8
+ app): add a repository made for the Nuvio apps and turn on its plugins; their sources show on
9
+ title pages with your addons'. Off by default, with a warning first: a plugin is someone
10
+ else's code, kept apart from your settings and files ([Nuvio plugins](docs/PLUGINS.md)) (#21).
11
+ - **Sources that need their own headers play:** a file whose host wants headers the TV's player
12
+ can't send (Origin, Accept, Accept-Language; under TizenBrew, any) plays through StremioK's
13
+ service, seeking included. Hold OK on a source › *Play through StremioK's service* works for
14
+ files too.
15
+
16
+ ## 2.3.5 — 2026-11-11
17
+ - **StremioK in 16 languages** (Settings › Appearance › *Language*): English, Spanish,
18
+ Portuguese (Brazil), French, German, Italian, Polish, Russian, Hindi, Japanese, Korean, Hebrew,
19
+ Arabic, Chinese (Simplified), Turkish and Finnish. Automatic follows the TV's language, and
20
+ StremioK restarts in the one picked. Titles and synopses still come from your addons.
21
+ - **Translations anyone can edit:** each language is a plain file in `translations/`, corrected
22
+ or added from GitHub ([Translating StremioK](docs/TRANSLATING.md)); one at least 90% translated
23
+ appears in Settings by itself.
24
+
6
25
  ## 2.3.4 — 2026-11-09
7
26
  - **Your Stremio account, kept in step** (Settings › Content › Integrations › *Stremio account*):
8
27
  Continue Watching, watched marks and your Library sync with it, both ways; the latest change to
package/README.md CHANGED
@@ -37,10 +37,13 @@ video through Samsung's AVPlay API.
37
37
  with SponsorBlock, DeArrow, chapters and captions.
38
38
  - **Local:** the videos on a USB drive or a network folder (WebDAV), matched to their titles.
39
39
  - **Jellyfin, Emby and Plex:** your server's libraries on Home, its files as sources.
40
+ - **16 languages** ([translating](docs/TRANSLATING.md)).
41
+ - **Nuvio plugins** (2017+ TVs): plugins made for the Nuvio apps as sources
42
+ ([what they are, and the risks](docs/PLUGINS.md)).
40
43
  - **Torrents**, through Stremio's streaming server or a TorrServer you run on your network.
41
44
  - **Made for the remote:** D-pad navigation throughout; ▶ Play on a movie, episode or channel plays
42
- its top source at once; hold OK where an item has more to
43
- offer (*Hold OK for more* says so); zoom up to 140% for reading from further away.
45
+ its top source at once; hold OK for more where offered; zoom up to 140% for reading from
46
+ further away.
44
47
 
45
48
  ## Install
46
49
 
@@ -67,7 +70,7 @@ Three ways, all covered step by step in the **[installation guide](docs/INSTALL.
67
70
  5. **A USB drive or network folder**, optional: plug a drive in, or add a WebDAV folder; the
68
71
  Local tab appears.
69
72
 
70
- [Getting started](docs/USER-GUIDE.md#getting-started) in the user guide walks through each.
73
+ The user guide's [Getting started](docs/USER-GUIDE.md#getting-started) covers each.
71
74
 
72
75
  ## Content / legal note
73
76
 
@@ -75,16 +78,16 @@ This app hosts **no** media. It is a client for the open Stremio addon protocol:
75
78
  metadata come from the addons you install (**Cinemeta**, the official one, by default), and
76
79
  playable sources come from whatever **stream addons you add yourself** in Settings. Streams
77
80
  that only expose a torrent `infoHash` play only through a streaming server you run (Stremio's
78
- or TorrServer): this app embeds no torrent or debrid engine.
81
+ or TorrServer): this app embeds no torrent or debrid engine. Nuvio plugins are third-party code
82
+ you add; StremioK neither hosts nor checks what they find.
79
83
  > **Note on WatchHub:** StremioK doesn't install it: its answers say it's only for clients
80
84
  > Stremio authorizes in writing. "Where to watch" comes from TMDB instead (with a TMDB key).
81
85
 
82
86
  The **IPTV** feature likewise hosts no content: you supply your own M3U playlist URLs, Xtream
83
87
  accounts or Stalker portals. For YouTube entries, the bundled service finds the video's stream; the video itself
84
88
  comes straight from YouTube. No video or audio is kept: everything plays straight from its
85
- source, unless you download it to your own USB drive. What StremioK does keep, on the TV, is
86
- your progress, settings and copies that let it start faster (see
87
- [Privacy and data](docs/PRIVACY.md#what-stays-on-the-tv)).
89
+ source, unless you download it to your own USB drive. StremioK keeps only your progress, settings
90
+ and caches, on the TV ([Privacy and data](docs/PRIVACY.md#what-stays-on-the-tv)).
88
91
 
89
92
  **DRM:** StremioK doesn't break or bypass copy protection. A protected channel plays only with
90
93
  the license server or keys its playlist gives (Widevine and PlayReady through the TV's player,
@@ -94,8 +97,6 @@ responsibility.
94
97
 
95
98
  ## Known limitations
96
99
 
97
- - AVPlay behavior varies by TV generation, codec and HLS provider.
98
- - Torrents play only through a streaming server you run on your network.
99
100
  - Under TizenBrew there's no TV player (only the `.wgt` has it): one audio track per file, no
100
101
  built-in subtitle tracks, no PlayReady or Widevine channels; opening apps depends on TizenBrew.
101
102
  - No StremioK account and no profiles: settings, addons and progress stay on the TV. The
@@ -103,9 +104,8 @@ responsibility.
103
104
  - Subtitles use an HTML overlay; gzipped (`.gz`) subtitle files aren't decoded.
104
105
  - No playback speed control (the TV's player mutes audio at other speeds), and no
105
106
  HDR / frame-rate mode switching (not available to web apps on Tizen 3).
106
- - Search and text fields use the TV's own on-screen keyboard, or **your phone**: a QR code
107
- opens a one-time page StremioK serves on your home network. It's plain HTTP (unencrypted),
108
- so use it only on a network you trust, since addon and playlist links often carry tokens.
107
+ - Text fields use the TV's keyboard, or **your phone**: a QR code opens a one-time page on your
108
+ home network, over plain HTTP, so use it only on a network you trust (links carry tokens).
109
109
  - "Where to watch" sources open the app on its home screen, or on the title only where an
110
110
  addon you added gives the app's own link and the app takes it.
111
111
  - YouTube channels and trailers depend on the bundled service and on YouTube's
@@ -117,7 +117,8 @@ MIT: see [LICENSE](LICENSE).
117
117
 
118
118
  It includes [Shaka Player](https://github.com/shaka-project/shaka-player) 5.3.3 (© Google LLC,
119
119
  Apache License 2.0: [js/vendor/SHAKA-LICENSE](js/vendor/SHAKA-LICENSE)), loaded only to play
120
- ClearKey channels.
120
+ ClearKey channels. Nuvio plugins' runtime (`js/vendor/quickjs/`: quickjs-emscripten, cheerio,
121
+ crypto-js; MIT, with BSD and ISC parts, licenses there) loads only when a plugin runs.
121
122
 
122
123
  Skip timestamps come partly from [SkipDB](https://skipdb.tv), whose data is published under
123
124
  the [ODbL 1.0](https://opendatacommons.org/licenses/odbl/1-0/) (see its
package/config.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"
3
- id="http://stremiok.tizen/StremioKTizen" version="2.3.4" viewmodes="maximized">
3
+ id="http://stremiok.tizen/StremioKTizen" version="2.3.6" viewmodes="maximized">
4
4
  <tizen:application id="StremioK01.StremioK" package="StremioK01" required_version="3.0"/>
5
5
  <content src="index.html"/>
6
6
  <feature name="http://tizen.org/feature/screen.size.all"/>
package/css/style.css CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  * { box-sizing: border-box; margin: 0; padding: 0; }
6
6
 
7
+ /* A language written right to left (js/i18n.js): each piece of text runs by its own first letters,
8
+ so translated text runs right to left (and aligns right), a title in English left to right;
9
+ pieces laid out as text (the header's tabs) follow it. The remote moves by position, so it still fits. */
10
+ html.rtl-text body, html.rtl-text body * { unicode-bidi: -webkit-plaintext; unicode-bidi: plaintext; }
11
+
7
12
  html, body {
8
13
  width: 1920px;
9
14
  height: 1080px;
package/index.html CHANGED
@@ -4,8 +4,8 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=1920, height=1080, user-scalable=no">
6
6
  <title>StremioK</title>
7
- <link rel="stylesheet" href="css/style.css?v=2.3.4">
8
- <link rel="stylesheet" href="css/modern.css?v=2.3.4">
7
+ <link rel="stylesheet" href="css/style.css?v=2.3.6">
8
+ <link rel="stylesheet" href="css/modern.css?v=2.3.6">
9
9
  </head>
10
10
  <body>
11
11
  <!-- CSS-applied sentinel (kept off-screen); app.js waits for its width before rendering -->
@@ -54,43 +54,46 @@
54
54
 
55
55
  <!-- Load order matters: polyfills -> util -> iptv -> data -> input -> tvapps -> player parts -> player -> ytplay -> view parts -> views -> app -->
56
56
  <!-- ?v= busts the TV webview cache on every release (keep in sync with package.json) -->
57
- <script src="js/polyfills.js?v=2.3.4"></script>
58
- <script src="js/util.js?v=2.3.4"></script>
59
- <script src="js/iptv.js?v=2.3.4"></script>
60
- <script src="js/xtvod.js?v=2.3.4"></script>
61
- <script src="js/stvod.js?v=2.3.4"></script>
62
- <script src="js/jellyfin.js?v=2.3.4"></script>
63
- <script src="js/plex.js?v=2.3.4"></script>
64
- <script src="js/epg.js?v=2.3.4"></script>
65
- <script src="js/youtube.js?v=2.3.4"></script>
66
- <script src="js/stremio.js?v=2.3.4"></script>
67
- <script src="js/trakt.js?v=2.3.4"></script>
68
- <script src="js/keys.js?v=2.3.4"></script>
69
- <script src="js/focus.js?v=2.3.4"></script>
70
- <script src="js/tvapps.js?v=2.3.4"></script>
71
- <script src="js/player-core.js?v=2.3.4"></script>
72
- <script src="js/player-store.js?v=2.3.4"></script>
73
- <script src="js/player-lang.js?v=2.3.4"></script>
74
- <script src="js/player-quality.js?v=2.3.4"></script>
75
- <script src="js/player-subs.js?v=2.3.4"></script>
76
- <script src="js/player-audio.js?v=2.3.4"></script>
77
- <script src="js/player-controls.js?v=2.3.4"></script>
78
- <script src="js/player.js?v=2.3.4"></script>
79
- <script src="js/ytplay.js?v=2.3.4"></script>
80
- <script src="js/netfolders.js?v=2.3.4"></script>
81
- <script src="js/local.js?v=2.3.4"></script>
82
- <script src="js/downloads.js?v=2.3.4"></script>
83
- <script src="js/stremio-account.js?v=2.3.4"></script>
84
- <script src="js/stremio-sync.js?v=2.3.4"></script>
85
- <script src="js/view-core.js?v=2.3.4"></script>
86
- <script src="js/view-home.js?v=2.3.4"></script>
87
- <script src="js/view-guide.js?v=2.3.4"></script>
88
- <script src="js/view-detail.js?v=2.3.4"></script>
89
- <script src="js/view-search.js?v=2.3.4"></script>
90
- <script src="js/view-settings.js?v=2.3.4"></script>
91
- <script src="js/view-discover.js?v=2.3.4"></script>
92
- <script src="js/views.js?v=2.3.4"></script>
93
- <script src="js/app.js?v=2.3.4"></script>
94
- <script src="js/hubpreview.js?v=2.3.4"></script>
57
+ <script src="js/polyfills.js?v=2.3.6"></script>
58
+ <script src="js/lang/languages.js?v=2.3.6"></script>
59
+ <script src="js/i18n.js?v=2.3.6"></script>
60
+ <script src="js/util.js?v=2.3.6"></script>
61
+ <script src="js/iptv.js?v=2.3.6"></script>
62
+ <script src="js/xtvod.js?v=2.3.6"></script>
63
+ <script src="js/stvod.js?v=2.3.6"></script>
64
+ <script src="js/plugins.js?v=2.3.6"></script>
65
+ <script src="js/jellyfin.js?v=2.3.6"></script>
66
+ <script src="js/plex.js?v=2.3.6"></script>
67
+ <script src="js/epg.js?v=2.3.6"></script>
68
+ <script src="js/youtube.js?v=2.3.6"></script>
69
+ <script src="js/stremio.js?v=2.3.6"></script>
70
+ <script src="js/trakt.js?v=2.3.6"></script>
71
+ <script src="js/keys.js?v=2.3.6"></script>
72
+ <script src="js/focus.js?v=2.3.6"></script>
73
+ <script src="js/tvapps.js?v=2.3.6"></script>
74
+ <script src="js/player-core.js?v=2.3.6"></script>
75
+ <script src="js/player-store.js?v=2.3.6"></script>
76
+ <script src="js/player-lang.js?v=2.3.6"></script>
77
+ <script src="js/player-quality.js?v=2.3.6"></script>
78
+ <script src="js/player-subs.js?v=2.3.6"></script>
79
+ <script src="js/player-audio.js?v=2.3.6"></script>
80
+ <script src="js/player-controls.js?v=2.3.6"></script>
81
+ <script src="js/player.js?v=2.3.6"></script>
82
+ <script src="js/ytplay.js?v=2.3.6"></script>
83
+ <script src="js/netfolders.js?v=2.3.6"></script>
84
+ <script src="js/local.js?v=2.3.6"></script>
85
+ <script src="js/downloads.js?v=2.3.6"></script>
86
+ <script src="js/stremio-account.js?v=2.3.6"></script>
87
+ <script src="js/stremio-sync.js?v=2.3.6"></script>
88
+ <script src="js/view-core.js?v=2.3.6"></script>
89
+ <script src="js/view-home.js?v=2.3.6"></script>
90
+ <script src="js/view-guide.js?v=2.3.6"></script>
91
+ <script src="js/view-detail.js?v=2.3.6"></script>
92
+ <script src="js/view-search.js?v=2.3.6"></script>
93
+ <script src="js/view-settings.js?v=2.3.6"></script>
94
+ <script src="js/view-discover.js?v=2.3.6"></script>
95
+ <script src="js/views.js?v=2.3.6"></script>
96
+ <script src="js/app.js?v=2.3.6"></script>
97
+ <script src="js/hubpreview.js?v=2.3.6"></script>
95
98
  </body>
96
99
  </html>
package/js/app.js CHANGED
@@ -159,7 +159,7 @@ var App = (function () {
159
159
 
160
160
  // Asked, so a stray BACK (one left over from closing the player) never closes the app; focus
161
161
  // starts on Exit, so BACK, OK leaves.
162
- function askExit() { Views.confirm('Exit StremioK?', 'Exit', exitApp, { plain: true, focusYes: true }); }
162
+ function askExit() { Views.confirm(U.t('Exit StremioK?'), U.t('Exit'), exitApp, { plain: true, focusYes: true }); }
163
163
  // The TV's own exit where StremioK has it (the sideloaded app). A TizenBrew module's page
164
164
  // doesn't get it: the window closed instead, and if it's still open, the TV's way said.
165
165
  function exitApp() {
@@ -170,7 +170,7 @@ var App = (function () {
170
170
  try { window.close(); } catch (e2) {}
171
171
  setTimeout(function () {
172
172
  U.log('app', 'Exit: still open after closing the window (' + (typeof YTPlay !== 'undefined' && YTPlay.installMode ? YTPlay.installMode() : '?') + ')');
173
- U.toast('Hold BACK to close StremioK', 4000);
173
+ U.toast(U.t('Hold BACK to close StremioK'), 4000);
174
174
  }, 500);
175
175
  }
176
176
 
@@ -227,7 +227,7 @@ var App = (function () {
227
227
  // player closed first. Not over a popup, nor while an addon's link is typed.
228
228
  function guideKey() {
229
229
  var on = (Views.menuItems ? Views.menuItems() : []).some(function (m) { return m.key === 'guide'; });
230
- if (!on) { U.toast('No TV guide yet (Settings › Content › IPTV › Guide link)', 3000); return; }
230
+ if (!on) { U.toast(U.t('No TV guide yet (Settings › Content › IPTV › Guide link)'), 3000); return; }
231
231
  if (Player.isActive()) { Player.exit(); }
232
232
  else if (Views.isModalOpen() || _current === 'addaddon') { return; }
233
233
  goHome('guide');
package/js/downloads.js CHANGED
@@ -147,7 +147,7 @@ var Downloads = (function () {
147
147
  return clean(named || (label + ext));
148
148
  }
149
149
  function clean(n) { return ('' + n).replace(/[\/\\:*?"<>|\x00-\x1f]+/g, ' ').replace(/\s+/g, ' ').trim().replace(/^\.+/, '').slice(0, 180); }
150
- function size(n) { return LocalMedia.humanSize(n) || 'size unknown'; }
150
+ function size(n) { return LocalMedia.humanSize(n) || U.t('size unknown'); }
151
151
  // The drives with their free space: [{ drive, free, fs }]
152
152
  function spaces() {
153
153
  return LocalMedia.drives().then(function (ds) {
@@ -160,44 +160,44 @@ var Downloads = (function () {
160
160
  // stream: the source; t: { type, videoId, label (the title, episode code), titleId };
161
161
  // ui: { pick(title, options, onPick), confirm(msg, ok, fn) } (the views' popups)
162
162
  function start(stream, t, ui) {
163
- if (!available()) { U.toast('Plug a USB drive into the TV first'); return; }
164
- if (!isFileLink(stream)) { U.toast('This source is a streamed playlist (HLS or DASH), not a file: it can’t be downloaded. Pick another source.', 6000); return; }
163
+ if (!available()) { U.toast(U.t('Plug a USB drive into the TV first')); return; }
164
+ if (!isFileLink(stream)) { U.toast(U.t('This source is a streamed playlist (HLS or DASH), not a file: it can’t be downloaded. Pick another source.'), 6000); return; }
165
165
  var name = fileNameFor(stream, t.label), bytes = +((stream.behaviorHints || {}).videoSize) || 0;
166
166
  spaces().then(function (list) {
167
- if (!list.length) { U.toast('No USB drive'); return; }
167
+ if (!list.length) { U.toast(U.t('No USB drive')); return; }
168
168
  function go(sp) {
169
- if (bytes && sp.free != null && sp.free < bytes) { U.toast('Not enough space on ' + driveName(sp.drive) + ': it needs ' + size(bytes) + ', ' + size(sp.free) + ' free', 6000); return; }
170
- if (bytes > 4294967295 && /^(vfat|msdos|fat)/.test(sp.fs || '')) { U.toast(driveName(sp.drive) + ' is FAT32, which can’t hold a file over 4 GB', 6000); return; }
169
+ if (bytes && sp.free != null && sp.free < bytes) { U.toast(U.t('Not enough space on {drive}: it needs {size}, {free} free', { drive: driveName(sp.drive), size: size(bytes), free: size(sp.free) }), 6000); return; }
170
+ if (bytes > 4294967295 && /^(vfat|msdos|fat)/.test(sp.fs || '')) { U.toast(U.t('{drive} is FAT32, which can’t hold a file over 4 GB', { drive: driveName(sp.drive) }), 6000); return; }
171
171
  var dir = sp.drive.root + '/' + FOLDER;
172
- ui.confirm('Download “' + name + '” (' + size(bytes) + ') to ' + driveName(sp.drive) + (sp.free != null ? ' (' + size(sp.free) + ' free)' : '') +
173
- '? It goes into its ' + FOLDER + ' folder; Home › Local shows how it’s going.' + subNote(t.sub), 'Download', function () {
172
+ ui.confirm((sp.free != null ? U.t('Download “{name}” ({size}) to {drive} ({free} free)? It goes into its {folder} folder; Home › Local shows how it’s going.', { name: name, size: size(bytes), drive: driveName(sp.drive), free: size(sp.free), folder: FOLDER })
173
+ : U.t('Download “{name}” ({size}) to {drive}? It goes into its {folder} folder; Home › Local shows how it’s going.', { name: name, size: size(bytes), drive: driveName(sp.drive), folder: FOLDER })) + subNote(t.sub), U.t('Download'), function () {
174
174
  var h = stream._headers || {};
175
175
  add({ kind: 'video', title: t.label, name: name, dir: dir, url: stream.url, ua: h.ua || '', ref: h.ref || '', size: bytes || 0,
176
176
  type: t.type, vid: t.videoId, sid: Stremio.sourceId ? Stremio.sourceId(stream) : '',
177
177
  tid: t.titleId, ttype: t.type === 'series' ? 'series' : 'movie', tname: t.name || '', tposter: t.poster || '', tyear: t.year || '' }).then(function () {
178
- U.toast('Downloading to ' + driveName(sp.drive) + ': Home › Local shows how it’s going', 5000);
179
- }, function (e) { U.toast('Couldn’t start the download: ' + U.problem(e), 6000); });
178
+ U.toast(U.t('Downloading to {drive}: Home › Local shows how it’s going', { drive: driveName(sp.drive) }), 5000);
179
+ }, function (e) { U.toast(U.t('Couldn’t start the download: {why}', { why: U.problem(e) }), 6000); });
180
180
  if (t.sub === undefined) { subtitleFor(stream, t, dir, name); } // (from a source: your language's, when an addon has one)
181
181
  else if (t.sub && t.sub.url) { addSub(t, dir, name, t.sub.url, t.sub.lang); } // (from the player: the one that's on)
182
182
  });
183
183
  }
184
184
  if (list.length === 1) { go(list[0]); return; }
185
- ui.pick('Download to which drive?', list.map(function (sp, i) { return ['' + i, driveName(sp.drive) + (sp.free != null ? ' · ' + size(sp.free) + ' free' : '')]; }), function (k) { go(list[+k]); });
186
- }, function () { U.toast('Couldn’t read the USB drives'); });
185
+ ui.pick(U.t('Download to which drive?'), list.map(function (sp, i) { return ['' + i, driveName(sp.drive) + (sp.free != null ? ' · ' + U.t('{free} free', { free: size(sp.free) }) : '')]; }), function (k) { go(list[+k]); });
186
+ }, function () { U.toast(U.t('Couldn’t read the USB drives')); });
187
187
  }
188
188
  // What's said about the subtitle, from the player (t.sub: the one that's on; undefined: from a
189
189
  // source, nothing said).
190
190
  function subNote(sub) {
191
191
  if (sub === undefined) { return ''; }
192
- if (sub && sub.url) { return ' With the subtitle that’s on' + (sub.name ? ' (' + sub.name + ')' : '') + ', next to it.'; }
193
- if (sub && sub.embedded) { return ' Its built-in subtitles come with it.'; }
194
- return ' No subtitle (they’re off).';
192
+ if (sub && sub.url) { return ' ' + (sub.name ? U.t('With the subtitle that’s on ({name}), next to it.', { name: sub.name }) : U.t('With the subtitle that’s on, next to it.')); }
193
+ if (sub && sub.embedded) { return ' ' + U.t('Its built-in subtitles come with it.'); }
194
+ return ' ' + U.t('No subtitle (they’re off).');
195
195
  }
196
196
  // A subtitle file next to the video: the video's name with the language (Film.en.srt).
197
197
  function addSub(t, dir, name, url, lang) {
198
198
  var two = (typeof Player !== 'undefined' && Player.lang2) ? (Player.lang2(lang) || (Player.langKey ? Player.lang2(Player.langKey(lang)) : '')) : '', code = two || ('' + (lang || '')).toLowerCase().replace(/[^a-z0-9-]/g, '').slice(0, 12) || 'sub';
199
199
  var ext = /\.vtt(\?|$)/i.test(url) ? '.vtt' : '.srt';
200
- add({ kind: 'sub', title: t.label + ' (subtitles)', name: name.replace(/\.[^.]+$/, '') + '.' + code + ext, dir: dir, url: url, size: 0 });
200
+ add({ kind: 'sub', title: t.label + ' ' + U.t('(subtitles)'), name: name.replace(/\.[^.]+$/, '') + '.' + code + ext, dir: dir, url: url, size: 0 });
201
201
  }
202
202
  // A subtitle in your language next to it (Film.en.srt), when a subtitle addon has one.
203
203
  function subtitleFor(stream, t, dir, name) {
package/js/epg.js CHANGED
@@ -128,7 +128,7 @@ var EPG = (function () {
128
128
  }, function () {
129
129
  g.asking = false;
130
130
  if (_guides[url] !== g) { return; }
131
- g.state = 'failed'; g.error = 'StremioK’s service didn’t answer';
131
+ g.state = 'failed'; g.error = U.t('StremioK’s service didn’t answer');
132
132
  changed();
133
133
  });
134
134
  })(0);
@@ -287,13 +287,12 @@ var EPG = (function () {
287
287
  }
288
288
 
289
289
  // 20:30, or with the day when it isn't today (Tue 01:00).
290
- var DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
291
290
  function two(n) { return (n < 10 ? '0' : '') + n; }
292
291
  function hhmm(sec) { var d = new Date(sec * 1000); return two(d.getHours()) + ':' + two(d.getMinutes()); }
293
292
  function dayTime(sec) {
294
293
  var d = new Date(sec * 1000), today = new Date(Date.now());
295
294
  var same = d.getFullYear() === today.getFullYear() && d.getMonth() === today.getMonth() && d.getDate() === today.getDate();
296
- return (same ? '' : DAYS[d.getDay()] + ' ') + hhmm(sec);
295
+ return (same ? '' : U.weekday(d.getDay()) + ' ') + hhmm(sec);
297
296
  }
298
297
 
299
298
  // Told when a guide is read or programs arrive (once for a burst).
package/js/hubpreview.js CHANGED
@@ -25,7 +25,7 @@ var HubPreview = (function () {
25
25
  }
26
26
  function payload() {
27
27
  var tiles = (Stremio.getPrefs().homePreview && Views.previewTiles) ? Views.previewTiles() : [];
28
- return { sections: tiles.length ? [{ title: 'Continue Watching', tiles: tiles }] : [] };
28
+ return { sections: tiles.length ? [{ title: U.t('Continue Watching'), tiles: tiles }] : [] };
29
29
  }
30
30
  // now: on / off just switched (sent whatever the wait). Else only a change, 10 minutes apart.
31
31
  function send(now) {
package/js/i18n.js ADDED
@@ -0,0 +1,108 @@
1
+ /* The interface's language (Settings › Appearance › Language): English or one of the languages
2
+ js/lang/languages.js lists (I18N_LANGS, written from translations/*.json with each one's name,
3
+ the TV languages it answers for and its plural rule); Automatic (the default) goes by the TV's
4
+ own language. Loaded first, after that list and before every
5
+ other script, so it can pull in the chosen language's phrases (js/lang/<code>.js, a list of
6
+ English phrase -> its translation) before any of them builds its text: some build it as they
7
+ load (a menu's choices). Changing the language restarts StremioK in it.
8
+ Phrases are looked up by their English text (U.t), with {name} for what's filled in and
9
+ singular / plural forms (U.tn) by the language's own rule; one not translated shows in English.
10
+ What the logs record stays in English (Settings › Diagnostics: read to find a problem).
11
+ Global namespace: I18N */
12
+ var I18N = (function () {
13
+ 'use strict';
14
+ function isList(x) { return Object.prototype.toString.call(x) === '[object Array]'; }
15
+ var LANGS = [{ code: 'en', name: 'English', matches: ['en'], plural: 'one' }];
16
+ try {
17
+ (typeof I18N_LANGS !== 'undefined' && isList(I18N_LANGS) ? I18N_LANGS : []).forEach(function (L) {
18
+ if (L && typeof L.code === 'string' && L.code !== 'en' && typeof L.name === 'string') { LANGS.push(L); }
19
+ });
20
+ } catch (e0) {}
21
+ // The form a number takes in each plural rule (one: the singular phrase; any other: the plural
22
+ // phrase's translation, one text for all of them or each by name). Whole numbers only.
23
+ function f2to4(n) { var a = n % 10, b = n % 100; return a >= 2 && a <= 4 && (b < 12 || b > 14); }
24
+ var PLURAL = {
25
+ 'one': function (n) { return n === 1 ? 'one' : 'other'; },
26
+ 'zero-one': function (n) { return n === 0 || n === 1 ? 'one' : 'other'; },
27
+ 'none': function () { return 'other'; },
28
+ 'slavic': function (n) { return n % 10 === 1 && n % 100 !== 11 ? 'one' : f2to4(n) ? 'few' : 'many'; },
29
+ 'polish': function (n) { return n === 1 ? 'one' : f2to4(n) ? 'few' : 'many'; },
30
+ 'hebrew': function (n) { return n === 1 ? 'one' : n === 2 ? 'two' : 'other'; },
31
+ 'arabic': function (n) { var b = n % 100; return n === 0 ? 'zero' : n === 1 ? 'one' : n === 2 ? 'two' : b >= 3 && b <= 10 ? 'few' : b >= 11 ? 'many' : 'other'; }
32
+ };
33
+ var PREFS_KEY = 'stremiok.prefs';
34
+ function find(code) { for (var i = 0; i < LANGS.length; i++) { if (LANGS[i].code === code) { return LANGS[i]; } } return null; }
35
+ function known(code) { return find(code) ? code : ''; }
36
+ // The TV's own language: the language that matches it most closely (pt-PT before pt), else English.
37
+ function auto() {
38
+ var l = '', best = 'en', len = 0;
39
+ try { l = ('' + ((typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage)) || '')).toLowerCase().replace(/_/g, '-'); } catch (e) {}
40
+ LANGS.forEach(function (L) {
41
+ [L.code].concat(isList(L.matches) ? L.matches : []).forEach(function (m) {
42
+ m = ('' + m).toLowerCase();
43
+ if (m && (l === m || l.indexOf(m + '-') === 0) && m.length > len) { best = L.code; len = m.length; }
44
+ });
45
+ });
46
+ return best;
47
+ }
48
+ // The choice kept in Settings ('auto' or a language), read straight from the TV's storage:
49
+ // nothing else is loaded yet. None kept yet: a new install goes by the TV (Automatic); one
50
+ // already used (StremioK's own data on the TV) stays in English, as it was. Kept either way,
51
+ // so it doesn't change on a later launch.
52
+ function choice() {
53
+ var p = null, ls = null;
54
+ try { ls = window.localStorage; p = JSON.parse(ls.getItem(PREFS_KEY) || 'null'); } catch (e) {}
55
+ if (p && typeof p.lang === 'string') { return p.lang === 'auto' || known(p.lang) ? p.lang : 'auto'; }
56
+ var used = false;
57
+ try { for (var i = 0; ls && i < ls.length; i++) { if (/^stremiok\./.test(ls.key(i) || '')) { used = true; break; } } } catch (e2) {}
58
+ var c = used ? 'en' : 'auto';
59
+ try { p = (p && typeof p === 'object') ? p : {}; p.lang = c; ls.setItem(PREFS_KEY, JSON.stringify(p)); } catch (e3) {}
60
+ return c;
61
+ }
62
+ var _choice = choice(), _lang = _choice === 'auto' ? auto() : _choice;
63
+ var _dict = {};
64
+ // The page says which language it's in; one written right to left has its text run that way
65
+ // (css: html.rtl-text).
66
+ try {
67
+ var root = document.documentElement, me0 = find(_lang);
68
+ root.setAttribute('lang', _lang);
69
+ if (me0 && me0.direction === 'rtl') { root.className = (root.className ? root.className + ' ' : '') + 'rtl-text'; }
70
+ } catch (e1) {}
71
+ // A language file says what it translates: I18N.add('es', { 'English phrase': 'Frase', … }).
72
+ function add(code, dict) { if (code === _lang && dict && typeof dict === 'object') { _dict = dict; } }
73
+ // Its file, before the scripts after this one run (this one's own ?v=, for the TV's cache).
74
+ if (_lang !== 'en' && typeof document !== 'undefined' && document.write) {
75
+ // (a version number only: rebuilt from its numbers)
76
+ var me = document.currentScript, m = me && me.src ? /\?v=(\d+(?:\.\d+)*)/.exec(me.src) : null;
77
+ var v = m ? '?v=' + m[1].split('.').map(function (x) { return +x; }).join('.') : '';
78
+ if (known(_lang)) { try { document.write('<script src="js/lang/' + _lang + '.js' + v + '"><\/script>'); } catch (e) {} }
79
+ }
80
+
81
+ function fill(s, vars) {
82
+ if (!vars) { return s; }
83
+ return s.replace(/\{(\w+)\}/g, function (m, k) { return Object.prototype.hasOwnProperty.call(vars, k) ? '' + vars[k] : m; });
84
+ }
85
+ // A phrase in the language: its translation (or itself), {name}s filled from vars.
86
+ function t(s, vars, form) {
87
+ s = '' + s;
88
+ var x = Object.prototype.hasOwnProperty.call(_dict, s) ? _dict[s] : s;
89
+ if (x && typeof x === 'object') { x = x[form] || x.other || x.many || ''; }
90
+ return fill(typeof x === 'string' && x ? x : s, vars);
91
+ }
92
+ // A phrase by a number (English: one for 1, else other), in the form the language's plural rule
93
+ // gives that number; {n} is the number.
94
+ function tn(n, one, other, vars) {
95
+ var v = { n: n };
96
+ if (vars) { Object.keys(vars).forEach(function (k) { v[k] = vars[k]; }); }
97
+ var L = find(_lang), form = ((L && PLURAL[L.plural]) || PLURAL.one)(n);
98
+ // A singular without its number ('saved once') says 1: any other number the rule calls
99
+ // singular (Russian 21, Portuguese 0) takes the plural phrase.
100
+ if (form === 'one' && n !== 1 && ('' + one).indexOf('{n}') < 0) { form = 'many'; }
101
+ return form === 'one' ? t(one, v) : t(other, v, form);
102
+ }
103
+
104
+ return {
105
+ lang: function () { return _lang; }, choice: choice, auto: auto, langs: function () { return LANGS.map(function (L) { return [L.code, L.name]; }); },
106
+ add: add, t: t, tn: tn
107
+ };
108
+ })();
package/js/iptv.js CHANGED
@@ -55,7 +55,7 @@ var IPTV = (function () {
55
55
  var st = _status[p.id];
56
56
  if (st && st.title) { return st.title; }
57
57
  var u = U.parseUrl(p.url);
58
- return u ? u.host : 'Playlist';
58
+ return u ? u.host : U.t('Playlist');
59
59
  }
60
60
  function labelOf(id) { var list = getPlaylists(), i = find(list, id); return i === -1 ? '' : label(list[i]); }
61
61
  // Your name for it ('' puts back the playlist's own / its server's).
@@ -213,9 +213,9 @@ var IPTV = (function () {
213
213
  // and the ones to read (none: as Stalker channels says). Read again by whoever sets them.
214
214
  function stalkerGroups(id) {
215
215
  var list = getPlaylists(), i = find(list, id);
216
- if (i < 0 || typeof YTPlay === 'undefined' || !YTPlay.stalkerGenres) { return Promise.reject(new Error('Stalker portals are read by StremioK’s service (not in a desktop browser)')); }
216
+ if (i < 0 || typeof YTPlay === 'undefined' || !YTPlay.stalkerGenres) { return Promise.reject(new Error(U.t('Stalker portals are read by StremioK’s service (not in a desktop browser)'))); }
217
217
  return YTPlay.stalkerGenres(list[i].url, list[i].mac).then(function (r) {
218
- if (!r || !Array.isArray(r.genres)) { throw new Error('Couldn’t read the portal: ' + ((r && r.why) || 'no answer')); }
218
+ if (!r || !Array.isArray(r.genres)) { throw new Error(U.t('Couldn’t read the portal: {why}', { why: (r && r.why) || U.t('no answer') })); }
219
219
  return r.genres;
220
220
  });
221
221
  }
@@ -421,7 +421,7 @@ var IPTV = (function () {
421
421
  var group = attr(s, /group-title="([^"]*)"/i);
422
422
  var kind = attr(s, /tvg-type="([^"]*)"/i);
423
423
  cur = {
424
- name: (s.slice(s.lastIndexOf(',') + 1).trim()) || 'Channel',
424
+ name: (s.slice(s.lastIndexOf(',') + 1).trim()) || U.t('Channel'),
425
425
  logo: attr(s, /tvg-logo="([^"]*)"/i),
426
426
  group: group,
427
427
  tvgId: attr(s, /tvg-id="([^"]*)"/i),
@@ -522,7 +522,7 @@ var IPTV = (function () {
522
522
  var at = -1;
523
523
  for (var i = 0; i < d.catalogs.length; i++) { if (d.catalogs[i].id === FAV_CAT) { at = i; } }
524
524
  var any = favs().some(function (id) { return !!d.byId[id]; });
525
- if (any && at === -1) { d.catalogs.unshift({ type: 'tv', id: FAV_CAT, name: '★ Favorites', extra: [{ name: 'search' }], _favs: true, _first: true }); }
525
+ if (any && at === -1) { d.catalogs.unshift({ type: 'tv', id: FAV_CAT, name: U.t('★ Favorites'), extra: [{ name: 'search' }], _favs: true, _first: true }); }
526
526
  if (!any && at !== -1) { d.catalogs.splice(at, 1); }
527
527
  }
528
528
  function build(channels) {
@@ -596,7 +596,7 @@ var IPTV = (function () {
596
596
  st.count = channels.length;
597
597
  st.groups = Object.keys(groups).length;
598
598
  if (!channels.length && !st.error && !st.vodLines) {
599
- st.error = 'No channels parsed (is the URL returning the .m3u file?)';
599
+ st.error = U.t('No channels parsed (is the URL returning the .m3u file?)');
600
600
  }
601
601
  return channels;
602
602
  }
@@ -608,7 +608,7 @@ var IPTV = (function () {
608
608
  });
609
609
  // A Stalker portal's channels, from the service (see stalkerCheck): its M3U text.
610
610
  function stalkerText() {
611
- if (typeof YTPlay === 'undefined' || !YTPlay.stalkerList) { return Promise.reject(new Error('Stalker portals are read by StremioK’s service (not in a desktop browser)')); }
611
+ if (typeof YTPlay === 'undefined' || !YTPlay.stalkerList) { return Promise.reject(new Error(U.t('Stalker portals are read by StremioK’s service (not in a desktop browser)'))); }
612
612
  return YTPlay.stalkerList(playlist.url, playlist.mac, stalkerAll(), playlist.genres).then(function (r) {
613
613
  if (r && typeof r.m3u === 'string') {
614
614
  if (r.cut) { // (stopped short: said, with what's there)
@@ -617,9 +617,10 @@ var IPTV = (function () {
617
617
  }
618
618
  return r.m3u;
619
619
  }
620
- throw new Error((r && r.refused ? 'The portal refused it: ' : 'Couldn’t read the portal: ') + ((r && r.why) || 'no answer'));
620
+ var why = (r && r.why) || U.t('no answer');
621
+ throw new Error(r && r.refused ? U.t('The portal refused it: {why}', { why: why }) : U.t('Couldn’t read the portal: {why}', { why: why }));
621
622
  }, function (e) {
622
- throw new Error(/no service/.test((e && e.message) || '') ? 'Stalker portals are read by StremioK’s service (not in a desktop browser)' : 'Couldn’t reach StremioK’s service: ' + U.problem(e));
623
+ throw new Error(/no service/.test((e && e.message) || '') ? U.t('Stalker portals are read by StremioK’s service (not in a desktop browser)') : U.t('Couldn’t reach StremioK’s service: {why}', { why: U.problem(e) }));
623
624
  });
624
625
  }
625
626
  function fetchIt() {
@@ -630,12 +631,11 @@ var IPTV = (function () {
630
631
  return finish(text, at);
631
632
  });
632
633
  }, function (e) {
633
- var msg = (e && e.message) ? e.message : 'Could not fetch the playlist URL';
634
+ var msg = (e && e.message) ? e.message : U.t('Could not fetch the playlist URL');
634
635
  // status 0 / network error on a URL that opens fine in a browser almost
635
636
  // always means the server sent no Access-Control-Allow-Origin header.
636
637
  if (!isStalker(playlist) && (/HTTP 0\b/.test(msg) || /Network error|^No answer/i.test(msg))) {
637
- msg += ' — the playlist server likely isn\'t sending an ' +
638
- 'Access-Control-Allow-Origin header (CORS). Serve the .m3u with CORS enabled.';
638
+ msg += U.t(' — the playlist server likely isn\'t sending an Access-Control-Allow-Origin header (CORS). Serve the .m3u with CORS enabled.');
639
639
  }
640
640
  st.error = msg;
641
641
  // Fall back to this playlist's saved copy so a failed refresh doesn't wipe it.
@@ -732,7 +732,7 @@ var IPTV = (function () {
732
732
  return {
733
733
  id: c.id, type: c.type, name: c.name,
734
734
  poster: c.logo || '', background: c.logo || '', logo: c.logo || '',
735
- posterShape: 'landscape', description: c.group + (sourceOf(c) ? ' · from ' + sourceOf(c) : '')
735
+ posterShape: 'landscape', description: c.group + (sourceOf(c) ? ' · ' + U.t('from {source}', { source: sourceOf(c) }) : '')
736
736
  };
737
737
  }
738
738