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/view-core.js CHANGED
@@ -36,8 +36,8 @@ var ViewParts = {};
36
36
  var box = U.el('div', 'modal-box');
37
37
  box.appendChild(U.el('div', 'modal-msg', message));
38
38
  var row = U.el('div', 'modal-row');
39
- var no = U.el('div', 'pill focusable modal-btn', opts.noLabel || 'Cancel');
40
- var yes = U.el('div', 'pill focusable modal-btn' + (opts.plain ? '' : ' danger'), confirmLabel || 'Confirm');
39
+ var no = U.el('div', 'pill focusable modal-btn', opts.noLabel || U.t('Cancel'));
40
+ var yes = U.el('div', 'pill focusable modal-btn' + (opts.plain ? '' : ' danger'), confirmLabel || U.t('Confirm'));
41
41
  no.__onselect = function () { closeModal(); if (opts.onNo) { opts.onNo(); } };
42
42
  yes.__onselect = function () { closeModal(); onYes(); };
43
43
  row.appendChild(no);
@@ -67,7 +67,7 @@ var ViewParts = {};
67
67
  box.appendChild(qrSpot(text));
68
68
  box.appendChild(U.el('div', 'qr-link', U.redactUrl ? U.redactUrl(text) : text));
69
69
  (lines || []).forEach(function (l) { box.appendChild(U.el('div', 'qr-note', l)); });
70
- var row = U.el('div', 'modal-row'), done = U.el('div', 'pill focusable modal-btn', 'Done');
70
+ var row = U.el('div', 'modal-row'), done = U.el('div', 'pill focusable modal-btn', U.t('Done'));
71
71
  done.__onselect = function () { closeModal(); };
72
72
  row.appendChild(done);
73
73
  box.appendChild(row);
@@ -86,10 +86,10 @@ var ViewParts = {};
86
86
  if (existing) { existing.parentNode.removeChild(existing); }
87
87
  var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box qr-box');
88
88
  box.appendChild(U.el('div', 'modal-msg', o.title));
89
- var spot = U.el('div', 'qr-spot'), how = U.el('div', 'qr-note', 'Opening the page for your phone…'), link = U.el('div', 'qr-link', '');
89
+ var spot = U.el('div', 'qr-spot'), how = U.el('div', 'qr-note', U.t('Opening the page for your phone…')), link = U.el('div', 'qr-link', '');
90
90
  box.appendChild(spot); box.appendChild(link); box.appendChild(how);
91
91
  var row = U.el('div', 'modal-row');
92
- var cancel = U.el('div', 'pill focusable modal-btn', 'Cancel'), type = U.el('div', 'pill focusable modal-btn', 'Type it');
92
+ var cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel')), type = U.el('div', 'pill focusable modal-btn', U.t('Type it'));
93
93
  var token = null, timer = null, over = false;
94
94
  function stop() {
95
95
  over = true;
@@ -126,18 +126,18 @@ var ViewParts = {};
126
126
  var bad = o.validate ? o.validate(text) : null;
127
127
  if (bad) { U.toast(bad, 5000); return; }
128
128
  o.onText(text);
129
- }, function () { if (!over) { how.textContent = 'The phone page closed. Type it instead, or try again.'; token = null; } });
129
+ }, function () { if (!over) { how.textContent = U.t('The phone page closed. Type it instead, or try again.'); token = null; } });
130
130
  }, ENTRY_POLL_MS);
131
131
  }
132
- if (typeof YTPlay === 'undefined' || !YTPlay.entryOpen) { how.textContent = 'Type it with the TV’s keyboard.'; return; }
132
+ if (typeof YTPlay === 'undefined' || !YTPlay.entryOpen) { how.textContent = U.t('Type it with the TV’s keyboard.'); return; }
133
133
  YTPlay.ensureService().then(function () { return YTPlay.entryOpen(o.what); }).then(function (r) {
134
134
  if (over) { if (r && r.token) { YTPlay.entryClose(r.token); } return; }
135
135
  token = r.token;
136
136
  spot.appendChild(qrSpotCanvas(r.url));
137
137
  link.textContent = r.url;
138
- how.textContent = 'Scan it with your phone (on the same Wi-Fi as the TV), then type or paste it there. Only for the next 5 minutes, and once. It travels unencrypted over your home network: use it only on a network you trust.';
138
+ how.textContent = U.t('Scan it with your phone (on the same Wi-Fi as the TV), then type or paste it there. Only for the next 5 minutes, and once. It travels unencrypted over your home network: use it only on a network you trust.');
139
139
  poll();
140
- }, function () { if (!over) { how.textContent = 'Your phone can’t reach the TV just now (no home network, or StremioK’s service isn’t running): type it instead.'; } });
140
+ }, function () { if (!over) { how.textContent = U.t('Your phone can’t reach the TV just now (no home network, or StremioK’s service isn’t running): type it instead.'); } });
141
141
  }
142
142
  function qrSpotCanvas(text) { var s = qrSpot(text); s.className = ''; return s; }
143
143
  // A file given to the phone (an export: YTPlay.entryGive): a QR to the service's one-time page
@@ -149,10 +149,10 @@ var ViewParts = {};
149
149
  if (existing) { existing.parentNode.removeChild(existing); }
150
150
  var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box qr-box');
151
151
  box.appendChild(U.el('div', 'modal-msg', title));
152
- var spot = U.el('div', 'qr-spot'), how = U.el('div', 'qr-note', 'Opening the page for your phone…'), link = U.el('div', 'qr-link', '');
152
+ var spot = U.el('div', 'qr-spot'), how = U.el('div', 'qr-note', U.t('Opening the page for your phone…')), link = U.el('div', 'qr-link', '');
153
153
  box.appendChild(spot); box.appendChild(link); box.appendChild(how);
154
154
  if (note) { box.appendChild(U.el('div', 'qr-note', note)); }
155
- var row = U.el('div', 'modal-row'), done = U.el('div', 'pill focusable modal-btn', 'Done');
155
+ var row = U.el('div', 'modal-row'), done = U.el('div', 'pill focusable modal-btn', U.t('Done'));
156
156
  var token = null, timer = null, over = false;
157
157
  done.__onselect = function () { closeModal(); };
158
158
  row.appendChild(done); box.appendChild(row); overlay.appendChild(box);
@@ -165,21 +165,21 @@ var ViewParts = {};
165
165
  if (over || !token) { return; }
166
166
  YTPlay.entrySeen(token).then(function (seen) {
167
167
  if (over) { return; }
168
- if (seen) { how.textContent = 'Your phone has it: copy or download it there, then Done.'; }
168
+ if (seen) { how.textContent = U.t('Your phone has it: copy or download it there, then Done.'); }
169
169
  poll();
170
- }, function () { if (!over) { how.textContent = 'The phone page closed. Export again to open another.'; token = null; } });
170
+ }, function () { if (!over) { how.textContent = U.t('The phone page closed. Export again to open another.'); token = null; } });
171
171
  }, GIVE_POLL_MS);
172
172
  }
173
- if (typeof YTPlay === 'undefined' || !YTPlay.entryGive) { how.textContent = 'It needs StremioK’s service on the TV (not in a desktop browser).'; return; }
173
+ if (typeof YTPlay === 'undefined' || !YTPlay.entryGive) { how.textContent = U.t('It needs StremioK’s service on the TV (not in a desktop browser).'); return; }
174
174
  YTPlay.entryGive(text).then(function (r) {
175
175
  if (over) { if (r && r.token) { YTPlay.entryClose(r.token); } return; }
176
176
  if (!r || !r.url) { throw new Error('no page'); }
177
177
  token = r.token;
178
178
  spot.appendChild(qrSpotCanvas(r.url));
179
179
  link.textContent = r.url;
180
- how.textContent = 'Scan it with your phone (on the same Wi-Fi as the TV): the page shows the file to copy or download. For the next 5 minutes, unencrypted over your home network: only on a network you trust.';
180
+ how.textContent = U.t('Scan it with your phone (on the same Wi-Fi as the TV): the page shows the file to copy or download. For the next 5 minutes, unencrypted over your home network: only on a network you trust.');
181
181
  poll();
182
- }, function () { if (!over) { how.textContent = 'Your phone can’t reach the TV just now (no home network, or StremioK’s service isn’t running).'; } });
182
+ }, function () { if (!over) { how.textContent = U.t('Your phone can’t reach the TV just now (no home network, or StremioK’s service isn’t running).'); } });
183
183
  }
184
184
 
185
185
  // Show `overlay` (already in the page) as the modal: focus moves into it, and
@@ -212,11 +212,11 @@ var ViewParts = {};
212
212
  }
213
213
  function addYouTubeCatalog(meta) {
214
214
  var src = youTubeList(meta.id), name = meta.name || meta.title || src;
215
- if (YouTube.catalogFor(src)) { U.toast('“' + name + '” is already one of your YouTube catalogs'); return; }
216
- confirm('Add “' + name + '” to your YouTube catalogs? It becomes a row on Home and a catalog in Discover (Settings › Content › YouTube).', 'Add', function () {
217
- if (!YouTube.add({ src: src, name: name })) { U.toast('Couldn\'t add it (40 catalogs at most)'); return; }
215
+ if (YouTube.catalogFor(src)) { U.toast(U.t('“{name}” is already one of your YouTube catalogs', { name: name })); return; }
216
+ confirm(U.t('Add “{name}” to your YouTube catalogs? It becomes a row on Home and a catalog in Discover (Settings › Content › YouTube).', { name: name }), U.t('Add'), function () {
217
+ if (!YouTube.add({ src: src, name: name })) { U.toast(U.t('Couldn\'t add it (40 catalogs at most)')); return; }
218
218
  refreshAddonRows('local:youtube');
219
- U.toast('Added “' + name + '” to your YouTube catalogs', 3000);
219
+ U.toast(U.t('Added “{name}” to your YouTube catalogs', { name: name }), 3000);
220
220
  });
221
221
  }
222
222
 
@@ -227,21 +227,21 @@ var ViewParts = {};
227
227
  var overlay = U.el('div', 'modal-overlay');
228
228
  var box = U.el('div', 'modal-box actions-box'); // (as wide as its buttons)
229
229
 
230
- box.appendChild(U.el('div', 'modal-msg', 'Update “' + name + '”'));
230
+ box.appendChild(U.el('div', 'modal-msg', U.t('Update “{name}”', { name: name })));
231
231
 
232
232
  var row = U.el('div', 'modal-row');
233
233
 
234
- var cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
235
- var refresh = U.el('div', 'pill focusable modal-btn', 'Refresh');
236
- var remove = U.el('div', 'pill focusable modal-btn danger', 'Remove');
234
+ var cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
235
+ var refresh = U.el('div', 'pill focusable modal-btn', U.t('Refresh'));
236
+ var remove = U.el('div', 'pill focusable modal-btn danger', U.t('Remove'));
237
237
  // Turn off / on: kept in your list, not asked for anything while it's off (a backup)
238
238
  var isOff = !!(Stremio.isAddonOff && Stremio.isAddonOff(url));
239
- var onoff = U.el('div', 'pill focusable modal-btn', isOff ? 'Turn on' : 'Turn off');
239
+ var onoff = U.el('div', 'pill focusable modal-btn', isOff ? U.t('Turn on') : U.t('Turn off'));
240
240
  onoff.__onselect = function () {
241
241
  closeModal();
242
242
  Stremio.setAddonOff(url, !isOff);
243
243
  refreshAddonRows(); // (its rows come or go; nothing else is fetched)
244
- U.toast(isOff ? '“' + name + '” is on' : '“' + name + '” is off: not asked for anything until you turn it on', 4000);
244
+ U.toast(isOff ? U.t('“{name}” is on', { name: name }) : U.t('“{name}” is off: not asked for anything until you turn it on', { name: name }), 4000);
245
245
  renderSettings();
246
246
  };
247
247
 
@@ -256,12 +256,12 @@ var ViewParts = {};
256
256
  Stremio.refreshAddon(url).then(function () { // just this one; the others keep theirs
257
257
  refreshAddonRows(url);
258
258
  U.spinner(false);
259
- U.toast('Addon refreshed');
259
+ U.toast(U.t('Addon refreshed'));
260
260
  renderSettings();
261
261
  }, function () {
262
262
  U.spinner(false);
263
263
  var why = Stremio.manifestProblem ? Stremio.manifestProblem(url) : '', said = Stremio.manifestDetail ? Stremio.manifestDetail(url) : '';
264
- U.toast('Could not refresh addon' + (why ? ' (' + why + ')' : '') + (said ? ': ' + said : ''), said ? 8000 : 3000);
264
+ U.toast(U.t('Could not refresh addon') + (why ? ' (' + why + ')' : '') + (said ? ': ' + said : ''), said ? 8000 : 3000);
265
265
  renderSettings(); // (its row shows the reason)
266
266
  });
267
267
  };
@@ -270,22 +270,22 @@ var ViewParts = {};
270
270
  closeModal();
271
271
  Stremio.removeAddon(url);
272
272
  refreshAddonRows(); // its rows go; nothing else is fetched
273
- U.toast('Removed');
273
+ U.toast(U.t('Removed'));
274
274
  setTimeout(renderSettings, 300);
275
275
  };
276
276
 
277
277
  // Share: a QR of its link (to add it elsewhere); Configure: of its setup page (its
278
278
  // manifest says it has one), to change its settings on the phone
279
279
  var base = ('' + url).replace(/\/manifest\.json(\?.*)?$/, '');
280
- var share = U.el('div', 'pill focusable modal-btn', 'Share');
280
+ var share = U.el('div', 'pill focusable modal-btn', U.t('Share'));
281
281
  share.__onselect = function () {
282
- qrModal('Share “' + name + '”', url, ['Scan it to add this addon on another device. It carries the personal parts of its link (your tokens and settings): show it only to your own devices.']);
282
+ qrModal(U.t('Share “{name}”', { name: name }), url, [U.t('Scan it to add this addon on another device. It carries the personal parts of its link (your tokens and settings): show it only to your own devices.')]);
283
283
  };
284
284
  var m = Stremio.savedManifest ? Stremio.savedManifest(url) : null, bh = (m && m.behaviorHints) || {};
285
- var configure = (bh.configurable || bh.configurationRequired) ? U.el('div', 'pill focusable modal-btn', 'Configure') : null;
285
+ var configure = (bh.configurable || bh.configurationRequired) ? U.el('div', 'pill focusable modal-btn', U.t('Configure')) : null;
286
286
  if (configure) {
287
287
  configure.__onselect = function () {
288
- qrModal('Configure “' + name + '”', base + '/configure', ['Scan it to change this addon’s settings on your phone. Then add the new link it gives you (Settings › Content › Addons): it replaces this one.']);
288
+ qrModal(U.t('Configure “{name}”', { name: name }), base + '/configure', [U.t('Scan it to change this addon’s settings on your phone. Then add the new link it gives you (Settings › Content › Addons): it replaces this one.')]);
289
289
  };
290
290
  }
291
291
  row.appendChild(cancel);
@@ -307,61 +307,61 @@ var ViewParts = {};
307
307
 
308
308
  var overlay = U.el('div', 'modal-overlay');
309
309
  var box = U.el('div', 'modal-box actions-box'); // (as wide as its buttons)
310
- box.appendChild(U.el('div', 'modal-msg', 'Update “' + label + '”'));
310
+ box.appendChild(U.el('div', 'modal-msg', U.t('Update “{name}”', { name: label })));
311
311
 
312
312
  var row = U.el('div', 'modal-row');
313
- var cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
314
- var rename = U.el('div', 'pill focusable modal-btn', 'Rename');
315
- var onoff = U.el('div', 'pill focusable modal-btn', playlist.off ? 'Turn on' : 'Turn off');
316
- var edit = U.el('div', 'pill focusable modal-btn', 'Edit link');
317
- var guide = U.el('div', 'pill focusable modal-btn', 'Guide link');
313
+ var cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
314
+ var rename = U.el('div', 'pill focusable modal-btn', U.t('Rename'));
315
+ var onoff = U.el('div', 'pill focusable modal-btn', playlist.off ? U.t('Turn on') : U.t('Turn off'));
316
+ var edit = U.el('div', 'pill focusable modal-btn', U.t('Edit link'));
317
+ var guide = U.el('div', 'pill focusable modal-btn', U.t('Guide link'));
318
318
  var fmt = IPTV.xtreamFormat ? IPTV.xtreamFormat(playlist.id) : ''; // (an Xtream account: MPEG-TS or HLS)
319
- var format = U.el('div', 'pill focusable modal-btn', 'Format: ' + (fmt === 'hls' ? 'HLS' : 'MPEG-TS'));
319
+ var format = U.el('div', 'pill focusable modal-btn', U.t('Format: {format}', { format: fmt === 'hls' ? 'HLS' : 'MPEG-TS' }));
320
320
  format.__onselect = function () {
321
321
  closeModal();
322
322
  Stremio.iptvSetXtreamFormat(playlist.id, fmt === 'hls' ? 'ts' : 'hls');
323
323
  refreshAddonRows('local:iptv');
324
- U.toast('Its channels now play as ' + (fmt === 'hls' ? 'MPEG-TS' : 'HLS') + ' (reading the account again…)', 4000);
324
+ U.toast(U.t('Its channels now play as {format} (reading the account again…)', { format: fmt === 'hls' ? 'MPEG-TS' : 'HLS' }), 4000);
325
325
  renderSettings();
326
326
  };
327
- var groups = U.el('div', 'pill focusable modal-btn', 'Channel groups'); // (a Stalker portal: the genres to read)
327
+ var groups = U.el('div', 'pill focusable modal-btn', U.t('Channel groups')); // (a Stalker portal: the genres to read)
328
328
  groups.__onselect = function () {
329
329
  closeModal();
330
- U.toast('Asking the portal for its groups…', 4000);
330
+ U.toast(U.t('Asking the portal for its groups…'), 4000);
331
331
  IPTV.stalkerGroups(playlist.id).then(function (list) {
332
- if (!list.length) { U.toast('The portal lists no groups', 4000); return; }
333
- pickMany('Groups to read from “' + label + '”', list.map(function (g) { return { key: g.id, label: g.title }; }), {
332
+ if (!list.length) { U.toast(U.t('The portal lists no groups'), 4000); return; }
333
+ pickMany(U.t('Groups to read from “{name}”', { name: label }), list.map(function (g) { return { key: g.id, label: g.title }; }), {
334
334
  on: playlist.genres, none: true,
335
- button: function (n) { return n ? 'Read ' + n + ' group' + (n === 1 ? '' : 's') : 'Read as Stalker channels says'; }
335
+ button: function (n) { return n ? U.tn(n, 'Read {n} group', 'Read {n} groups') : U.t('Read as Stalker channels says'); }
336
336
  }, function (keys) {
337
337
  IPTV.setStalkerGroups(playlist.id, keys);
338
338
  refreshAddonRows('local:iptv');
339
- U.toast('Reading the portal…', 4000);
339
+ U.toast(U.t('Reading the portal…'), 4000);
340
340
  renderSettings();
341
341
  Stremio.iptvReload(playlist.id).then(function () {
342
342
  refreshAddonRows('local:iptv');
343
343
  var st = Stremio.iptvStatus(playlist.id);
344
- U.toast(st.error ? ('Reload failed: ' + st.error) : ('Loaded ' + st.count + ' channels'), 4000);
344
+ U.toast(st.error ? U.t('Reload failed: {why}', { why: st.error }) : U.t('Loaded {n} channels', { n: st.count }), 4000);
345
345
  renderSettings();
346
346
  });
347
347
  });
348
348
  }, function (e) { U.toast(U.problem(e), 5000); });
349
349
  };
350
- var reload = U.el('div', 'pill focusable modal-btn', 'Reload');
351
- var remove = U.el('div', 'pill focusable modal-btn danger', 'Remove');
350
+ var reload = U.el('div', 'pill focusable modal-btn', U.t('Reload'));
351
+ var remove = U.el('div', 'pill focusable modal-btn danger', U.t('Remove'));
352
352
 
353
353
  cancel.__onselect = function () { closeModal(); };
354
354
  rename.__onselect = function () {
355
355
  closeModal();
356
356
  App.openEntry({
357
- title: 'Rename IPTV playlist',
358
- hint: 'Type a name (up to 60 characters), then Confirm. Empty uses the playlist’s own name, or its server’s. RETURN cancels.',
357
+ title: U.t('Rename IPTV playlist'),
358
+ hint: U.t('Type a name (up to 60 characters), then Confirm. Empty uses the playlist’s own name, or its server’s. RETURN cancels.'),
359
359
  value: playlist.name || '', placeholder: label,
360
- validate: function (v) { return ('' + v).trim().length > 60 ? 'Up to 60 characters' : null; },
360
+ validate: function (v) { return ('' + v).trim().length > 60 ? U.t('Up to 60 characters') : null; },
361
361
  onConfirm: function (v) {
362
362
  Stremio.iptvRenamePlaylist(playlist.id, v);
363
363
  refreshAddonRows('local:iptv'); // (channels show the playlist they're from)
364
- U.toast(('' + v).trim() ? 'Playlist renamed' : 'Playlist name cleared');
364
+ U.toast(('' + v).trim() ? U.t('Playlist renamed') : U.t('Playlist name cleared'));
365
365
  App.back(); renderSettings();
366
366
  }
367
367
  });
@@ -370,20 +370,20 @@ var ViewParts = {};
370
370
  closeModal();
371
371
  Stremio.iptvSetPlaylistOff(playlist.id, !playlist.off);
372
372
  refreshAddonRows('local:iptv');
373
- U.toast(playlist.off ? 'Playlist on: its channels are back' : 'Playlist off: its channels are hidden (nothing is deleted)', 3000);
373
+ U.toast(playlist.off ? U.t('Playlist on: its channels are back') : U.t('Playlist off: its channels are hidden (nothing is deleted)'), 3000);
374
374
  renderSettings();
375
375
  };
376
376
  edit.__onselect = function () {
377
377
  closeModal();
378
378
  App.openEntry({
379
- title: 'Edit IPTV playlist', phone: 'playlist',
380
- hint: 'Update the M3U/M3U8 playlist URL, then Confirm. RETURN cancels.',
379
+ title: U.t('Edit IPTV playlist'), phone: 'playlist',
380
+ hint: U.t('Update the M3U/M3U8 playlist URL, then Confirm. RETURN cancels.'),
381
381
  value: playlist.url, placeholder: 'https://example.com/playlist.m3u',
382
382
  validate: function (v) { return U.urlProblem(v) || null; }, // (U.parseUrl: http(s), a real host, no user:password@)
383
383
  onConfirm: function (v) {
384
384
  Stremio.iptvUpdatePlaylist(playlist.id, v);
385
385
  refreshAddonRows('local:iptv'); // just the IPTV rows
386
- U.toast('Playlist updated');
386
+ U.toast(U.t('Playlist updated'));
387
387
  App.back(); renderSettings();
388
388
  }
389
389
  });
@@ -391,26 +391,26 @@ var ViewParts = {};
391
391
  guide.__onselect = function () { // its TV guide: yours, or the playlist's own (empty)
392
392
  closeModal();
393
393
  App.openEntry({
394
- title: 'TV guide link', phone: 'playlist',
395
- hint: 'An XMLTV guide (.xml or .xml.gz), then Confirm. Empty uses the playlist’s own (the one it names, or an Xtream playlist’s). RETURN cancels.',
394
+ title: U.t('TV guide link'), phone: 'playlist',
395
+ hint: U.t('An XMLTV guide (.xml or .xml.gz), then Confirm. Empty uses the playlist’s own (the one it names, or an Xtream playlist’s). RETURN cancels.'),
396
396
  value: playlist.guide || '', placeholder: 'https://example.com/guide.xml.gz',
397
397
  validate: function (v) { return ('' + v).trim() ? (U.urlProblem(v) || null) : null; },
398
398
  onConfirm: function (v) {
399
399
  Stremio.iptvSetPlaylistGuide(playlist.id, v);
400
- U.toast(('' + v).trim() ? 'Guide link set: reading it…' : 'Back to the playlist’s own guide', 3000);
400
+ U.toast(('' + v).trim() ? U.t('Guide link set: reading it…') : U.t('Back to the playlist’s own guide'), 3000);
401
401
  App.back(); renderSettings();
402
402
  }
403
403
  });
404
404
  };
405
405
  reload.__onselect = function () {
406
406
  closeModal();
407
- U.toast('Reloading playlist…', 4000);
407
+ U.toast(U.t('Reloading playlist…'), 4000);
408
408
  if (typeof XtVod !== 'undefined' && XtVod.reload) { XtVod.reload(playlist.id); } // (an Xtream account: its films and series too)
409
409
  if (typeof StVod !== 'undefined' && StVod.reload) { StVod.reload(playlist.id); } // (a Stalker portal: the same)
410
410
  Stremio.iptvReload(playlist.id).then(function () {
411
411
  refreshAddonRows('local:iptv');
412
412
  var st = Stremio.iptvStatus(playlist.id);
413
- U.toast(st.error ? ('Reload failed: ' + st.error) : ('Loaded ' + st.count + ' channels'), 4000);
413
+ U.toast(st.error ? U.t('Reload failed: {why}', { why: st.error }) : U.t('Loaded {n} channels', { n: st.count }), 4000);
414
414
  renderSettings();
415
415
  });
416
416
  };
@@ -418,7 +418,7 @@ var ViewParts = {};
418
418
  closeModal();
419
419
  Stremio.iptvRemovePlaylist(playlist.id);
420
420
  refreshAddonRows('local:iptv');
421
- U.toast('Playlist removed');
421
+ U.toast(U.t('Playlist removed'));
422
422
  setTimeout(renderSettings, 300);
423
423
  };
424
424
 
@@ -485,12 +485,12 @@ var ViewParts = {};
485
485
  var go = U.el('div', 'pill focusable modal-btn');
486
486
  function ticked() { return items.filter(function (it) { return on[it.key]; }).map(function (it) { return it.key; }); }
487
487
  function drawGo() { go.textContent = opts.button(ticked().length); }
488
- var all = U.el('div', 'pick-item focusable', can.length && can.every(function (it) { return on[it.key]; }) ? 'Select none' : 'Select all'); // (all ticked at first: an export's)
488
+ var all = U.el('div', 'pick-item focusable', can.length && can.every(function (it) { return on[it.key]; }) ? U.t('Select none') : U.t('Select all')); // (all ticked at first: an export's)
489
489
  all.__onselect = function () {
490
490
  var every = can.every(function (it) { return on[it.key]; });
491
491
  can.forEach(function (it) { on[it.key] = !every; });
492
492
  nodes.forEach(function (n) { n.__draw(); });
493
- all.textContent = every ? 'Select all' : 'Select none';
493
+ all.textContent = every ? U.t('Select all') : U.t('Select none');
494
494
  drawGo();
495
495
  };
496
496
  if (can.length > 1) { listEl.appendChild(all); }
@@ -498,11 +498,11 @@ var ViewParts = {};
498
498
  var n = U.el('div', 'pick-item focusable');
499
499
  n.__draw = function () {
500
500
  n.textContent = (on[it.key] ? '✓ ' : '') + it.label +
501
- (it.have ? ' (' + (opts.haveText || 'already added') + ')' : it.note ? ' (' + it.note + ')' : '');
501
+ (it.have ? ' (' + (opts.haveText || U.t('already added')) + ')' : it.note ? ' (' + it.note + ')' : '');
502
502
  if (on[it.key]) { n.classList.add('sel'); } else { n.classList.remove('sel'); }
503
503
  };
504
504
  n.__onselect = function () {
505
- if (it.have) { U.toast(opts.haveText ? 'That one is ' + opts.haveText : 'You already have that one', 2000); return; }
505
+ if (it.have) { U.toast(opts.haveText ? U.t('That one is {what}', { what: opts.haveText }) : U.t('You already have that one'), 2000); return; }
506
506
  on[it.key] = !on[it.key]; n.__draw(); drawGo();
507
507
  };
508
508
  n.__draw();
@@ -513,12 +513,12 @@ var ViewParts = {};
513
513
  var row = U.el('div', 'modal-row');
514
514
  go.__onselect = function () {
515
515
  var keys = ticked();
516
- if (!keys.length && !opts.none) { U.toast('Nothing ticked: OK on one ticks it', 2500); return; }
516
+ if (!keys.length && !opts.none) { U.toast(U.t('Nothing ticked: OK on one ticks it'), 2500); return; }
517
517
  closeModal();
518
518
  onDone(keys);
519
519
  };
520
520
  drawGo();
521
- var cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
521
+ var cancel = U.el('div', 'pill focusable modal-btn', U.t('Cancel'));
522
522
  cancel.__onselect = function () { closeModal(); };
523
523
  row.appendChild(go);
524
524
  row.appendChild(cancel);
@@ -577,14 +577,14 @@ var ViewParts = {};
577
577
  }
578
578
  menuItems().forEach(function (m) {
579
579
  if (m.tab) { item('tab-pill', m.key, m.tab.label, m.tab.icon, function () { App.goHome(m.key); }, tabbar); }
580
- else if (m.key === 'discover') { item('tab-pill', 'discover', 'Discover', '🔭', function () { App.openDiscover(); }, tabbar); }
581
- else if (m.key === 'search') { item('hchip', 'search', 'Search', '🔍', function () { App.openSearch(); }, tabbar); }
580
+ else if (m.key === 'discover') { item('tab-pill', 'discover', U.t('Discover'), '🔭', function () { App.openDiscover(); }, tabbar); }
581
+ else if (m.key === 'search') { item('hchip', 'search', U.t('Search'), '🔍', function () { App.openSearch(); }, tabbar); }
582
582
  });
583
583
  // The items in one strip that scrolls sideways when they don't all fit (Focus keeps the
584
584
  // focused one in view); the StremioK name outside it, at the right.
585
585
  var strip = U.el('div', 'menu-scroll');
586
586
  strip.appendChild(tabbar);
587
- item('hchip', 'settings', 'Settings', '⚙', function () { App.openSettings(); }, strip);
587
+ item('hchip', 'settings', U.t('Settings'), '⚙', function () { App.openSettings(); }, strip);
588
588
  head.appendChild(strip);
589
589
  setTimeout(function () { showActiveItem(strip); }, 0); // (once it's on screen)
590
590
  var brand = U.el('div', 'brand');
@@ -760,17 +760,17 @@ var ViewParts = {};
760
760
  U.spinner(false);
761
761
  if (!hold.still()) { return; } // (left meanwhile)
762
762
  var fav = IPTV.isFavorite(meta.id), t = Date.now() / 1000, at = 'play';
763
- var items = [['play', '▶ Watch now'], ['fav', fav ? '★ Remove from favorites' : '★ Add to favorites']];
763
+ var items = [['play', U.t('▶ Watch now')], ['fav', fav ? U.t('★ Remove from favorites') : U.t('★ Add to favorites')]];
764
764
  list.forEach(function (p, i) {
765
765
  var on = p.start <= t && t < p.stop;
766
766
  if (on) { at = 'p' + i; }
767
767
  items.push(['p' + i, (on ? '● ' : '') + EPG.dayTime(p.start) + ' ' + p.title]);
768
768
  });
769
- pickList((meta.name || '') + (list.length ? ' · TV guide' : ''), items, at, function (v) {
769
+ pickList((meta.name || '') + (list.length ? ' · ' + U.t('TV guide') : ''), items, at, function (v) {
770
770
  if (v === 'play') { card.__onselect(); return; }
771
771
  if (v === 'fav') {
772
772
  IPTV.setFavorite(meta.id, !fav);
773
- U.toast(fav ? 'Removed from favorites' : 'Added to favorites: ★ Favorites, first on the IPTV tab', 3000);
773
+ U.toast(fav ? U.t('Removed from favorites') : U.t('Added to favorites: ★ Favorites, first on the IPTV tab'), 3000);
774
774
  refreshAddonRows('local:iptv');
775
775
  return;
776
776
  }
@@ -819,21 +819,25 @@ var ViewParts = {};
819
819
  return Stremio.getMeta(type, meta.id).then(null, function () { return null; }).then(function (full) {
820
820
  var m = Object.assign({ id: meta.id, type: type }, meta, full || {});
821
821
  var eps = (type === 'series') ? (m.videos || []) : null;
822
- var opts = [['details', 'Details']];
822
+ var opts = [['details', U.t('Details')]];
823
823
  if (type === 'movie' || eps.length) {
824
- opts.push(['np', inNowPlaying(type, m.id) ? 'Remove from Continue Watching' : 'Add to Continue Watching']);
824
+ opts.push(['np', inNowPlaying(type, m.id) ? U.t('Remove from Continue Watching') : U.t('Add to Continue Watching')]);
825
825
  }
826
826
  var watched = (type === 'movie') ? Player.isWatched('movie', m.id) : (eps.length > 0 && eps.every(episodeWatched));
827
827
  if (type === 'movie' || eps.length) {
828
- opts.push(['watched', watched ? 'Mark unwatched' : (type === 'series' ? 'Mark whole series watched' : 'Mark watched')]);
828
+ opts.push(['watched', watched ? U.t('Mark unwatched') : (type === 'series' ? U.t('Mark whole series watched') : U.t('Mark watched'))]);
829
829
  }
830
+ // Your Stremio account's Library (connected): in it, or not
831
+ var lib = typeof StremioSync !== 'undefined' && StremioSync.isConnected() && (type === 'movie' || type === 'series');
832
+ if (lib) { opts.push(['lib', StremioSync.inLibrary(type, m.id) ? U.t('Remove from Stremio Library') : U.t('Add to Stremio Library')]); }
830
833
  // Rate on Trakt (connected, a title with an IMDb id): yours shown once rated
831
834
  var canRate = typeof Trakt !== 'undefined' && Trakt.isConnected() && Trakt.rate && /^tt\d+$/.test(m.id);
832
835
  var mine = canRate ? Trakt.myRating(type, m.id) : null;
833
- if (canRate) { opts.push(['rate', mine ? 'Your rating: ' + mine + ' · change' : 'Rate on Trakt']); }
836
+ if (canRate) { opts.push(['rate', mine ? U.t('Your rating: {n} · change', { n: mine }) : U.t('Rate on Trakt')]); }
834
837
  return { name: m.name || m.title || '', items: opts, run: function (v) {
835
838
  if (v === 'details') { App.openDetail(type, m.id, meta); }
836
839
  else if (v === 'np') { toggleNowPlaying(type, m); }
840
+ else if (v === 'lib') { toggleLibrary(type, m); }
837
841
  else if (v === 'watched') { setTitleWatched(type, m, !watched); }
838
842
  else if (v === 'rate') { rateOnTrakt(type, m.id, m.name || m.title || ''); }
839
843
  } };
@@ -842,14 +846,14 @@ var ViewParts = {};
842
846
 
843
847
  // 1 to 10, as Trakt words them; Remove rating when it has yours. kind: 'movie' | 'series' |
844
848
  // 'season' (id 'tt…:N').
845
- var TRAKT_RATINGS = ['Weak Sauce', 'Terrible', 'Bad', 'Poor', 'Meh', 'Fair', 'Good', 'Great', 'Superb', 'Totally Ninja!'];
849
+ var TRAKT_RATINGS = [U.t('Weak Sauce'), U.t('Terrible'), U.t('Bad'), U.t('Poor'), U.t('Meh'), U.t('Fair'), U.t('Good'), U.t('Great'), U.t('Superb'), U.t('Totally Ninja!')];
846
850
  function rateOnTrakt(kind, id, name) {
847
851
  var mine = Trakt.myRating(kind, id), opts = [];
848
852
  for (var n = 10; n >= 1; n--) { opts.push(['' + n, n + ' · ' + TRAKT_RATINGS[n - 1]]); }
849
- if (mine) { opts.push(['0', 'Remove rating']); }
850
- pickList('Rate “' + name + '” on Trakt', opts, mine ? '' + mine : null, function (v) {
853
+ if (mine) { opts.push(['0', U.t('Remove rating')]); }
854
+ pickList(U.t('Rate “{name}” on Trakt', { name: name }), opts, mine ? '' + mine : null, function (v) {
851
855
  Trakt.rate(kind, id, +v);
852
- U.toast(+v ? 'Rated ' + v + ' on Trakt' : 'Rating removed on Trakt');
856
+ U.toast(+v ? U.t('Rated {n} on Trakt', { n: v }) : U.t('Rating removed on Trakt'));
853
857
  });
854
858
  }
855
859
  V.rateOnTrakt = rateOnTrakt;
@@ -866,7 +870,7 @@ var ViewParts = {};
866
870
  }
867
871
  watchedTicks(m.id, on);
868
872
  markHomeDirty();
869
- U.toast(on ? 'Marked watched' : 'Marked unwatched');
873
+ U.toast(on ? U.t('Marked watched') : U.t('Marked unwatched'));
870
874
  }
871
875
  // Every card of this title on screen, in every row (Home, Discover, Search): its ✓.
872
876
  function watchedTicks(id, on) {
@@ -910,6 +914,7 @@ var ViewParts = {};
910
914
  function nowPlayingEntries(type, id) {
911
915
  var all = Player.continueList();
912
916
  if (typeof Trakt !== 'undefined' && Trakt.isConnected && Trakt.isConnected() && Trakt.continueList) { all = all.concat(Trakt.continueList()); }
917
+ if (typeof StremioSync !== 'undefined' && StremioSync.isConnected()) { all = all.concat(StremioSync.continueList()); } // (your Stremio account's)
913
918
  return all.filter(function (e) {
914
919
  return e.type === type && (e.id === id || e.parent === id || (type === 'series' && ('' + e.id).split(':')[0] === id));
915
920
  });
@@ -918,24 +923,33 @@ var ViewParts = {};
918
923
  function toggleNowPlaying(type, m) {
919
924
  var present = nowPlayingEntries(type, m.id);
920
925
  if (present.length) {
921
- present.forEach(function (e) { // (Trakt's: hidden from Watching, as Watching's own Remove does)
922
- if (e._trakt) { if (Trakt.dismiss) { Trakt.dismiss(e.type, e.id); } } else { Player.removeProgress(e.type, e.id); }
926
+ present.forEach(function (e) { // (Trakt's: hidden from Watching, as Watching's own Remove does; your Stremio account's: off there too)
927
+ if (e._trakt) { if (Trakt.dismiss) { Trakt.dismiss(e.type, e.id); } } else if (!e._stremio) { Player.removeProgress(e.type, e.id); }
928
+ if (typeof StremioSync !== 'undefined' && StremioSync.dismiss) { StremioSync.dismiss(e.type, e.id); }
923
929
  });
924
- U.toast('Removed from Continue Watching');
930
+ U.toast(U.t('Removed from Continue Watching'));
925
931
  } else if (type === 'movie') {
926
932
  Player.addToContinue({ id: m.id, type: 'movie', name: m.name || m.title, poster: m.poster, background: m.background, parent: m.id });
927
- U.toast('Added to Continue Watching');
933
+ U.toast(U.t('Added to Continue Watching'));
928
934
  } else {
929
935
  var v = nextUp(m).v;
930
936
  Player.addToContinue({ id: v.id, type: 'series', name: (m.name || '') + ' ' + epCode(v), poster: m.poster, background: m.background, parent: m.id });
931
- U.toast('Added to Continue Watching');
937
+ U.toast(U.t('Added to Continue Watching'));
932
938
  }
933
939
  markHomeDirty();
934
940
  }
935
941
  // The button's label, for a title page's meta (checked by the same id toggleNowPlaying
936
942
  // adds and removes by: the id the title's details came with, which can differ from the
937
943
  // one it was opened by, e.g. a TMDB id in Discover for an IMDb one).
938
- function nowPlayingLabel(type, id) { return inNowPlaying(type, id) ? '✓ In Continue Watching' : '+ Add to Continue Watching'; }
944
+ function nowPlayingLabel(type, id) { return inNowPlaying(type, id) ? U.t('✓ In Continue Watching') : U.t('+ Add to Continue Watching'); }
945
+ // Your Stremio account's Library (Settings › Integrations › Stremio account): a title in it or not.
946
+ function libraryLabel(type, id) { return StremioSync.inLibrary(type, id) ? U.t('✓ In Stremio Library') : U.t('+ Stremio Library'); }
947
+ function toggleLibrary(type, m) {
948
+ var on = !StremioSync.inLibrary(type, m.id);
949
+ StremioSync.setInLibrary(type, { id: m.id, name: m.name || m.title || '', poster: m.poster || '' }, on);
950
+ U.toast(on ? U.t('Added to your Stremio Library') : U.t('Removed from your Stremio Library'));
951
+ }
952
+ function libraryOn() { return typeof StremioSync !== 'undefined' && StremioSync.isConnected(); }
939
953
 
940
954
  // "Hold OK for more": shown while the focused item has a menu of its own behind a held OK
941
955
  // (a card, a season, an episode, a source, a file on the USB drive…), so those menus can
@@ -945,7 +959,7 @@ var ViewParts = {};
945
959
  if (!_holdHint) {
946
960
  var app = U.byId('app');
947
961
  if (!app) { return; }
948
- _holdHint = U.el('div', 'hidden', 'Hold OK for more');
962
+ _holdHint = U.el('div', 'hidden', U.t('Hold OK for more'));
949
963
  _holdHint.id = 'hold-hint';
950
964
  app.appendChild(_holdHint);
951
965
  }
@@ -974,4 +988,7 @@ var ViewParts = {};
974
988
  V.scr = scr;
975
989
  V.showModal = showModal;
976
990
  V.toggleNowPlaying = toggleNowPlaying;
991
+ V.libraryLabel = libraryLabel;
992
+ V.toggleLibrary = toggleLibrary;
993
+ V.libraryOn = libraryOn;
977
994
  })(ViewParts);