stremiok 2.2.4 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
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.2.6 — 2026-11-02
7
+ - **Watching:** a title saved without a poster, or whose poster no longer loads, shows its usual
8
+ poster instead of only its name, for titles already there too (#6). One still without a
9
+ poster: see [Troubleshooting](docs/TROUBLESHOOTING.md#home).
10
+ - **Start on** (Settings › Appearance): the tab StremioK opens on, any Home tab. Until you choose
11
+ one, Watching. The Guide opens once its TV guide is read.
12
+ - **Guide tab:** opened as StremioK starts, its channels no longer stay on *Loading…* until you
13
+ change tabs. OK on a channel still loading plays it.
14
+
15
+ ## 2.2.5 — 2026-11-01
16
+ - **A Stalker portal's Channel groups** (OK on it, in Settings › Content › IPTV): tick the genres you
17
+ want and only those are read, however big the portal is.
18
+ - **Whole portal** waits longer when a portal stops answering, slows down after that, and keeps what
19
+ it read instead of losing it all at the time limit.
20
+
6
21
  ## 2.2.4 — 2026-10-31
7
22
  - **The remote's ▶ Play key:** on a movie, an episode or a channel (its card, its row, its sources,
8
23
  its row in the Guide), plays the top source at once, whatever *Skip the source list* says.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  StremioK is a from-scratch Stremio-addon streaming client for Samsung Tizen TVs.
4
4
  It was originally built for a 2017 UN50MU6100 running Tizen 3.0
5
- (~Chromium 47) and is also tested on a 2021 QN55Q80AAG running Tizen 6.0.
5
+ (~Chromium 47) and is also tested on a 2021 QN55Q80AAG running Tizen 6.0. A user reports it working on Tizen 4 too.
6
6
 
7
7
  Old Samsung Tizen TVs run web applications rather than Android APKs. StremioK is
8
8
  therefore written in old-Chromium-compatible HTML, JavaScript (ES5) and CSS, and plays
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.2.4" viewmodes="maximized">
3
+ id="http://stremiok.tizen/StremioKTizen" version="2.2.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/index.html CHANGED
@@ -4,7 +4,7 @@
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.2.4">
7
+ <link rel="stylesheet" href="css/style.css?v=2.2.6">
8
8
  </head>
9
9
  <body>
10
10
  <!-- CSS-applied sentinel (kept off-screen); app.js waits for its width before rendering -->
@@ -53,38 +53,38 @@
53
53
 
54
54
  <!-- Load order matters: polyfills -> util -> iptv -> data -> input -> tvapps -> player parts -> player -> ytplay -> view parts -> views -> app -->
55
55
  <!-- ?v= busts the TV webview cache on every release (keep in sync with package.json) -->
56
- <script src="js/polyfills.js?v=2.2.4"></script>
57
- <script src="js/util.js?v=2.2.4"></script>
58
- <script src="js/iptv.js?v=2.2.4"></script>
59
- <script src="js/xtvod.js?v=2.2.4"></script>
60
- <script src="js/epg.js?v=2.2.4"></script>
61
- <script src="js/youtube.js?v=2.2.4"></script>
62
- <script src="js/stremio.js?v=2.2.4"></script>
63
- <script src="js/trakt.js?v=2.2.4"></script>
64
- <script src="js/keys.js?v=2.2.4"></script>
65
- <script src="js/focus.js?v=2.2.4"></script>
66
- <script src="js/tvapps.js?v=2.2.4"></script>
67
- <script src="js/player-core.js?v=2.2.4"></script>
68
- <script src="js/player-store.js?v=2.2.4"></script>
69
- <script src="js/player-lang.js?v=2.2.4"></script>
70
- <script src="js/player-quality.js?v=2.2.4"></script>
71
- <script src="js/player-subs.js?v=2.2.4"></script>
72
- <script src="js/player-audio.js?v=2.2.4"></script>
73
- <script src="js/player-controls.js?v=2.2.4"></script>
74
- <script src="js/player.js?v=2.2.4"></script>
75
- <script src="js/ytplay.js?v=2.2.4"></script>
76
- <script src="js/local.js?v=2.2.4"></script>
77
- <script src="js/downloads.js?v=2.2.4"></script>
78
- <script src="js/stremio-account.js?v=2.2.4"></script>
79
- <script src="js/view-core.js?v=2.2.4"></script>
80
- <script src="js/view-home.js?v=2.2.4"></script>
81
- <script src="js/view-guide.js?v=2.2.4"></script>
82
- <script src="js/view-detail.js?v=2.2.4"></script>
83
- <script src="js/view-search.js?v=2.2.4"></script>
84
- <script src="js/view-settings.js?v=2.2.4"></script>
85
- <script src="js/view-discover.js?v=2.2.4"></script>
86
- <script src="js/views.js?v=2.2.4"></script>
87
- <script src="js/app.js?v=2.2.4"></script>
88
- <script src="js/hubpreview.js?v=2.2.4"></script>
56
+ <script src="js/polyfills.js?v=2.2.6"></script>
57
+ <script src="js/util.js?v=2.2.6"></script>
58
+ <script src="js/iptv.js?v=2.2.6"></script>
59
+ <script src="js/xtvod.js?v=2.2.6"></script>
60
+ <script src="js/epg.js?v=2.2.6"></script>
61
+ <script src="js/youtube.js?v=2.2.6"></script>
62
+ <script src="js/stremio.js?v=2.2.6"></script>
63
+ <script src="js/trakt.js?v=2.2.6"></script>
64
+ <script src="js/keys.js?v=2.2.6"></script>
65
+ <script src="js/focus.js?v=2.2.6"></script>
66
+ <script src="js/tvapps.js?v=2.2.6"></script>
67
+ <script src="js/player-core.js?v=2.2.6"></script>
68
+ <script src="js/player-store.js?v=2.2.6"></script>
69
+ <script src="js/player-lang.js?v=2.2.6"></script>
70
+ <script src="js/player-quality.js?v=2.2.6"></script>
71
+ <script src="js/player-subs.js?v=2.2.6"></script>
72
+ <script src="js/player-audio.js?v=2.2.6"></script>
73
+ <script src="js/player-controls.js?v=2.2.6"></script>
74
+ <script src="js/player.js?v=2.2.6"></script>
75
+ <script src="js/ytplay.js?v=2.2.6"></script>
76
+ <script src="js/local.js?v=2.2.6"></script>
77
+ <script src="js/downloads.js?v=2.2.6"></script>
78
+ <script src="js/stremio-account.js?v=2.2.6"></script>
79
+ <script src="js/view-core.js?v=2.2.6"></script>
80
+ <script src="js/view-home.js?v=2.2.6"></script>
81
+ <script src="js/view-guide.js?v=2.2.6"></script>
82
+ <script src="js/view-detail.js?v=2.2.6"></script>
83
+ <script src="js/view-search.js?v=2.2.6"></script>
84
+ <script src="js/view-settings.js?v=2.2.6"></script>
85
+ <script src="js/view-discover.js?v=2.2.6"></script>
86
+ <script src="js/views.js?v=2.2.6"></script>
87
+ <script src="js/app.js?v=2.2.6"></script>
88
+ <script src="js/hubpreview.js?v=2.2.6"></script>
89
89
  </body>
90
90
  </html>
package/js/iptv.js CHANGED
@@ -31,6 +31,7 @@ var IPTV = (function () {
31
31
  if (p.off === true) { o.off = true; }
32
32
  if (typeof p.guide === 'string' && U.parseUrl(p.guide)) { o.guide = p.guide; } // (its TV guide, yours: see EPG.guideUrl)
33
33
  if (macOf(p.mac)) { o.mac = macOf(p.mac); } // (a Stalker portal: see addStalker)
34
+ if (o.mac && Array.isArray(p.genres) && p.genres.length) { o.genres = p.genres; } // (only those read: see setStalkerGroups)
34
35
  return o;
35
36
  });
36
37
  }
@@ -208,6 +209,23 @@ var IPTV = (function () {
208
209
  var STALKER_ALL_KEY = 'stremiok.iptv.stalkerall';
209
210
  function stalkerAll() { return U.store.get(STALKER_ALL_KEY, false) === true; }
210
211
  function setStalkerAll(on) { U.store.set(STALKER_ALL_KEY, !!on); }
212
+ // A portal's Channel groups: its genres (the service's { genres: [{ id, title }] } or { why }),
213
+ // and the ones to read (none: as Stalker channels says). Read again by whoever sets them.
214
+ function stalkerGroups(id) {
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)')); }
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')); }
219
+ return r.genres;
220
+ });
221
+ }
222
+ function setStalkerGroups(id, ids) {
223
+ var list = getPlaylists(), i = find(list, id);
224
+ if (i < 0) { return false; }
225
+ if (ids && ids.length) { list[i].genres = ids; } else { delete list[i].genres; }
226
+ savePlaylists(list);
227
+ return true;
228
+ }
211
229
  // Checked through the service (its channels read): { ok, count }, { refused, why },
212
230
  // { unreachable, why } or { noService } (a desktop browser).
213
231
  function stalkerCheck(portal, mac) {
@@ -479,7 +497,7 @@ var IPTV = (function () {
479
497
  if (/^http:/i.test(playlist.url)) { // (Settings › Diagnostics › Logs)
480
498
  U.log('iptv', 'Playlist “' + label(playlist) + '” is downloaded over unencrypted http:// — anyone on the network path can see or change it (and ' + (isStalker(playlist) ? 'its MAC address' : 'any username / password in its link') + ')');
481
499
  }
482
- var src = playlist.url + (playlist.mac ? '#mac=' + playlist.mac : ''); // (its saved copy: this portal and MAC's)
500
+ var src = playlist.url + (playlist.mac ? '#mac=' + playlist.mac : '') + (playlist.genres ? '#genres=' + playlist.genres.join(',') : ''); // (its saved copy: this portal, MAC and groups')
483
501
 
484
502
  function finish(text, at) {
485
503
  st.fetchedAt = at || 0;
@@ -516,7 +534,7 @@ var IPTV = (function () {
516
534
  // A Stalker portal's channels, from the service (see stalkerCheck): its M3U text.
517
535
  function stalkerText() {
518
536
  if (typeof YTPlay === 'undefined' || !YTPlay.stalkerList) { return Promise.reject(new Error('Stalker portals are read by StremioK’s service (not in a desktop browser)')); }
519
- return YTPlay.stalkerList(playlist.url, playlist.mac, stalkerAll()).then(function (r) {
537
+ return YTPlay.stalkerList(playlist.url, playlist.mac, stalkerAll(), playlist.genres).then(function (r) {
520
538
  if (r && typeof r.m3u === 'string') {
521
539
  if (r.cut) { // (stopped short: said, with what's there)
522
540
  st.cut = r.cut.total || true;
@@ -756,7 +774,7 @@ var IPTV = (function () {
756
774
  getPlaylists: getPlaylists, addPlaylist: addPlaylist, updatePlaylist: updatePlaylist,
757
775
  removePlaylist: removePlaylist, renamePlaylist: renamePlaylist, setPlaylistOff: setPlaylistOff,
758
776
  movePlaylist: movePlaylist, setPlaylistGuide: setPlaylistGuide, label: labelOf,
759
- macOf: macOf, stalkerPortal: stalkerPortal, stalkerCheck: stalkerCheck, addStalker: addStalker, isStalker: isStalker, stalkerAll: stalkerAll, setStalkerAll: setStalkerAll,
777
+ macOf: macOf, stalkerPortal: stalkerPortal, stalkerCheck: stalkerCheck, addStalker: addStalker, isStalker: isStalker, stalkerAll: stalkerAll, setStalkerAll: setStalkerAll, stalkerGroups: stalkerGroups, setStalkerGroups: setStalkerGroups,
760
778
  xtreamParts: xtreamParts, xtreamUrl: xtreamUrl, xtreamCheck: xtreamCheck, addXtream: addXtream, xtreamFormat: xtreamFormat, setXtreamFormat: setXtreamFormat,
761
779
  isFavorite: isFavorite, setFavorite: setFavorite, refreshEvery: refreshEvery, setRefreshEvery: setRefreshEvery, readAt: readAt,
762
780
  channels: function () { return _cache ? _cache.channels : []; }, channel: function (id) { return _cache ? _cache.byId[id] || null : null; }, isEnabled: isEnabled, reset: reset, status: status,
package/js/stremio.js CHANGED
@@ -179,6 +179,7 @@ var Stremio = (function () {
179
179
  homePreviewOrder: p.homePreviewOrder === 'watching' ? 'watching' : 'recent', // ...its tiles: the latest first, or as in Watching
180
180
  hiddenTabs: wordList(p.hiddenTabs, 20, 20), // Settings > Appearance > Menu: tabs hidden
181
181
  menuOrder: wordList(p.menuOrder, 20, 20), // ...and the menu's order (see ViewParts.menuOrder)
182
+ startTab: /^[a-z]{1,20}$/.test(p.startTab || '') ? p.startTab : 'continue', // Settings > Appearance > Start on: the Home tab a launch opens on
182
183
  hideWords: wordList(p.hideWords, 30, 40), // Settings > Source ranking: sources with these words at the bottom
183
184
  watchRegion: /^[A-Z]{2}$/.test(p.watchRegion || '') ? p.watchRegion : '' }; // Settings > Integrations ('' = automatic)
184
185
  }
package/js/view-core.js CHANGED
@@ -283,6 +283,29 @@ var ViewParts = {};
283
283
  U.toast('Its channels now play as ' + (fmt === 'hls' ? 'MPEG-TS' : 'HLS') + ' (reading the account again…)', 4000);
284
284
  renderSettings();
285
285
  };
286
+ var groups = U.el('div', 'pill focusable modal-btn', 'Channel groups'); // (a Stalker portal: the genres to read)
287
+ groups.__onselect = function () {
288
+ closeModal();
289
+ U.toast('Asking the portal for its groups…', 4000);
290
+ IPTV.stalkerGroups(playlist.id).then(function (list) {
291
+ if (!list.length) { U.toast('The portal lists no groups', 4000); return; }
292
+ pickMany('Groups to read from “' + label + '”', list.map(function (g) { return { key: g.id, label: g.title }; }), {
293
+ on: playlist.genres, none: true,
294
+ button: function (n) { return n ? 'Read ' + n + ' group' + (n === 1 ? '' : 's') : 'Read as Stalker channels says'; }
295
+ }, function (keys) {
296
+ IPTV.setStalkerGroups(playlist.id, keys);
297
+ refreshAddonRows('local:iptv');
298
+ U.toast('Reading the portal…', 4000);
299
+ renderSettings();
300
+ Stremio.iptvReload(playlist.id).then(function () {
301
+ refreshAddonRows('local:iptv');
302
+ var st = Stremio.iptvStatus(playlist.id);
303
+ U.toast(st.error ? ('Reload failed: ' + st.error) : ('Loaded ' + st.count + ' channels'), 4000);
304
+ renderSettings();
305
+ });
306
+ });
307
+ }, function (e) { U.toast(U.problem(e), 5000); });
308
+ };
286
309
  var reload = U.el('div', 'pill focusable modal-btn', 'Reload');
287
310
  var remove = U.el('div', 'pill focusable modal-btn danger', 'Remove');
288
311
 
@@ -363,6 +386,7 @@ var ViewParts = {};
363
386
  row.appendChild(edit);
364
387
  if (!playlist.off && typeof EPG !== 'undefined' && EPG.available && EPG.available()) { row.appendChild(guide); }
365
388
  if (!playlist.off && fmt) { row.appendChild(format); }
389
+ if (!playlist.off && IPTV.isStalker(playlist)) { row.appendChild(groups); }
366
390
  if (!playlist.off) { row.appendChild(reload); }
367
391
  row.appendChild(remove);
368
392
  box.appendChild(row);
@@ -405,8 +429,8 @@ var ViewParts = {};
405
429
  // Ticks in a popup (what to import): nothing ticked at first; OK on one ticks or unticks it,
406
430
  // Select all ticks every one that can be (again: none); the button counts what's ticked.
407
431
  // items: [{ key, label, have (already yours: shown as such, can't be ticked), note }];
408
- // opts: { button(n) -> its label, haveText }; onDone(keys) on the button with something
409
- // ticked (Cancel / BACK: nothing).
432
+ // opts: { button(n) -> its label, haveText, on (keys ticked at first), none (the button works
433
+ // with nothing ticked) }; onDone(keys) on the button with something ticked (Cancel / BACK: nothing).
410
434
  function pickMany(title, items, opts, onDone) {
411
435
  var existing = document.querySelector('.modal-overlay');
412
436
  if (existing) { existing.parentNode.removeChild(existing); }
@@ -414,6 +438,7 @@ var ViewParts = {};
414
438
  var box = U.el('div', 'modal-box pick-box');
415
439
  box.appendChild(U.el('div', 'modal-msg', title));
416
440
  var listEl = U.el('div', 'pick-list'), on = {}, nodes = [];
441
+ (opts.on || []).forEach(function (k) { on[k] = true; });
417
442
  var can = items.filter(function (it) { return !it.have; });
418
443
  var go = U.el('div', 'pill focusable modal-btn');
419
444
  function ticked() { return items.filter(function (it) { return on[it.key]; }).map(function (it) { return it.key; }); }
@@ -446,7 +471,7 @@ var ViewParts = {};
446
471
  var row = U.el('div', 'modal-row');
447
472
  go.__onselect = function () {
448
473
  var keys = ticked();
449
- if (!keys.length) { U.toast('Nothing ticked: OK on one ticks it', 2500); return; }
474
+ if (!keys.length && !opts.none) { U.toast('Nothing ticked: OK on one ticks it', 2500); return; }
450
475
  closeModal();
451
476
  onDone(keys);
452
477
  };
package/js/view-detail.js CHANGED
@@ -96,6 +96,8 @@
96
96
  Stremio.getMeta(type, id, pageCancel()).then(function (meta) {
97
97
  if (!still()) { return; }
98
98
  _d.meta = meta;
99
+ if (_d.preview && !meta.poster && _d.preview.poster) { meta.poster = _d.preview.poster; } // (details without artwork: the card's, so Continue Watching has one)
100
+ if (_d.preview && !meta.background && _d.preview.background) { meta.background = _d.preview.background; }
99
101
  U.spinner(false);
100
102
  afterMeta();
101
103
  }, function (err) {
package/js/view-guide.js CHANGED
@@ -22,14 +22,15 @@
22
22
 
23
23
  // Drawn again soon after (Home redrawn, the tab picked again): from what the grid before had
24
24
  // read (REUSE_MS), the same channels in the same window and hours, focus where it was;
25
- // no "Reading…" between, nothing asked again.
25
+ // no "Reading…" between, nothing asked again. Not while it's still reading (Home redrawn as
26
+ // StremioK starts on the Guide): what comes would draw only the grid gone, so asked again.
26
27
  var REUSE_MS = 5 * 60 * 1000;
27
28
  function guideGrid(rows) {
28
29
  stopFinding(); // (a lookup from the grid drawn before: stopped)
29
30
  var now = Date.now() / 1000, chans = EPG.guided(), was = _g;
30
31
  var g = _g = { el: rows, start: floorStep(now), live: true, chans: chans, lists: {}, asked: {}, failed: {}, got: {}, top: 0, nodes: [], at: Date.now(), gen: EPG.generation ? EPG.generation() : 0 }; // (live: the hours show the present, and follow the clock: tick)
31
32
  if (!chans.length) { rows.appendChild(U.el('div', 'row-empty', 'No TV guide yet (Settings › Content › IPTV › Guide link).')); return; }
32
- if (was && was.at && Date.now() - was.at < REUSE_MS && was.gen === g.gen && sameChans(was, chans)) {
33
+ if (was && was.at && !was.reading && Date.now() - was.at < REUSE_MS && was.gen === g.gen && sameChans(was, chans)) {
33
34
  var f = Focus.current(), want = (f && was.box && was.box.contains(f) && f.__chan) ? (f.__loading ? { id: f.__chan, t: f.__t } : { id: f.__chan, start: f.__p.start }) : null;
34
35
  g.lists = was.lists; g.asked = was.asked; g.failed = was.failed || {}; g.got = was.got || {}; g.at = was.at; g.top = was.top;
35
36
  g.chans = chans.filter(function (c) { return !(c.id in g.lists) || g.lists[c.id].length; });
@@ -75,7 +76,9 @@
75
76
  var ids = g.chans.slice(g.top, g.top + ROWS + AHEAD).filter(function (c) { return !g.asked[c.id]; }).map(function (c) { g.asked[c.id] = 1; return c.id; });
76
77
  if (!ids.length) { return Promise.resolve(false); }
77
78
  var now = Date.now() / 1000;
79
+ g.reading = (g.reading || 0) + 1; // (reads not in yet: see guideGrid)
78
80
  return EPG.range(ids, now - 2 * 3600, now + 30 * 3600).then(function (lists) {
81
+ g.reading--;
79
82
  var unknown = {};
80
83
  ((lists && lists._unknown) || []).forEach(function (id) { unknown[id] = 1; });
81
84
  ids.forEach(function (id) {
@@ -88,7 +91,7 @@
88
91
  g.top = Math.max(0, Math.min(g.top, g.chans.length - ROWS));
89
92
  if (Object.keys(unknown).length) { retryLater(g); }
90
93
  return true;
91
- }, function () { ids.forEach(function (id) { delete g.asked[id]; g.failed[id] = 1; }); retryLater(g); return true; });
94
+ }, function () { g.reading--; ids.forEach(function (id) { delete g.asked[id]; g.failed[id] = 1; }); retryLater(g); return true; });
92
95
  }
93
96
  // Channels whose programs didn't come (the service didn't answer, or not all of it): asked
94
97
  // again RETRY_MS later, while the grid is still on screen; their rows say so meanwhile.
@@ -169,7 +172,7 @@
169
172
  wait.__meta = { name: c.name, releaseInfo: 'Reading its TV guide…' };
170
173
  hooks(wait, -1);
171
174
  wait.__onlongpress = function () { hold(g, r, null); };
172
- if (!c.guideOnly) { wait.__onplay = function () { playChannel(g, r, true); }; }
175
+ if (!c.guideOnly) { wait.__onselect = function () { playChannel(g, r); }; wait.__onplay = function () { playChannel(g, r, true); }; } // (OK: the channel, as for what's on now)
173
176
  track.appendChild(wait);
174
177
  nodes.push(wait);
175
178
  if (want && want.id === c.id) { found = wait; }
@@ -310,14 +313,14 @@
310
313
 
311
314
  // Hold OK on a program: ▶ Watch now (what's on now, a channel that plays), ★ Add to / Remove
312
315
  // from favorites (its channel), Find in your addons (that program, as a guide-only channel's
313
- // OK). p: null for a channel whose guide hasn't come (its favorites only).
316
+ // OK). p: null for a channel whose guide hasn't come (Watch now, its favorites).
314
317
  function hold(g, r, p) {
315
318
  var c = g.chans[r], now = Date.now() / 1000, fav = IPTV.isFavorite(c.id), items = [];
316
- if (p && !c.guideOnly && p.start <= now && now < p.stop) { items.push(['play', '▶ Watch now']); }
319
+ if (!c.guideOnly && (!p || (p.start <= now && now < p.stop))) { items.push(['play', '▶ Watch now']); }
317
320
  items.push(['fav', fav ? '★ Remove from favorites' : '★ Add to favorites']);
318
321
  if (p && p.title) { items.push(['find', '🔍 Find in your addons']); }
319
322
  pickList(c.name + (p && p.title ? ' · ' + p.title : ''), items, items[0][0], function (v) {
320
- if (v === 'play') { pick(g, r, p); return; }
323
+ if (v === 'play') { if (p) { pick(g, r, p); } else { playChannel(g, r); } return; }
321
324
  if (v === 'find') { findInAddons(p); return; }
322
325
  IPTV.setFavorite(c.id, !fav);
323
326
  U.toast(fav ? 'Removed from favorites' : 'Added to favorites: ★ Favorites, first on the IPTV and Guide tabs', 3000);
package/js/view-home.js CHANGED
@@ -636,7 +636,8 @@
636
636
  // next episodes queued at the credits don't record one.
637
637
  var base = e.parent || e.id.split(':')[0];
638
638
  var a = (art && art[base]) || {};
639
- var c = posterCard({ id: base, type: e.type, name: e.name, poster: a.poster || e.poster, background: a.background || e.background }, e.type);
639
+ var stock = calPoster(base); // (a title's usual poster: for an entry saved without one, or whose link no longer loads)
640
+ var c = posterCard({ id: base, type: e.type, name: e.name, poster: a.poster || e.poster || stock, background: a.background || e.background, _posterAlt: stock }, e.type);
640
641
  // Keep the full episode/file id so detail opens on it. With a saved stream the
641
642
  // card resumes it directly; long-press offers the Details page instead.
642
643
  var preview = { name: e.name, poster: e.poster, type: e.type };
@@ -1197,10 +1198,14 @@
1197
1198
  }
1198
1199
 
1199
1200
  // Switch the active home tab (from the shared top menu) and show it.
1200
- function setHomeTab(key) { _homeTab = key || _homeTab; _focusFirstCard = 'new'; _wantTab = null; }
1201
+ function setHomeTab(key) { _homeTab = key || _homeTab; _focusFirstCard = 'new'; _wantTab = null; _wantGuide = null; }
1201
1202
  // A tab asked for whose rows are still coming (a first playlist's IPTV tab): shown when they
1202
1203
  // come, if Home is still on the tab it showed instead. { key, instead }
1203
1204
  var _wantTab = null;
1205
+ // Start on the Guide (Settings › Appearance › Start on): at a launch its guides aren't read yet,
1206
+ // so Home opens on Watching and switches once they are, if it's still there (a tab you picked:
1207
+ // not). The tab shown instead, or null.
1208
+ var _wantGuide = null;
1204
1209
 
1205
1210
  // prevFocus: a Home card to put focus back on after the rebuild (the card a title
1206
1211
  // was opened from). Otherwise the card currently focused on Home is kept, so rows
@@ -1224,12 +1229,15 @@
1224
1229
  U.clear(s);
1225
1230
 
1226
1231
  if (_homeCatalogs === null) { useHomeCache(); }
1232
+ var launch = _homeTab === null;
1233
+ if (launch) { _homeTab = Stremio.getPrefs().startTab; } // (a launch: Settings › Appearance › Start on)
1227
1234
  // Keep the active tab valid for what's actually available.
1228
1235
  var avail = availableTabs();
1229
1236
  if (!_homeTab || !avail.some(function (t) { return t.key === _homeTab; })) {
1230
1237
  var asked = _homeTab;
1231
1238
  _homeTab = avail.length ? avail[0].key : 'movie';
1232
1239
  if (asked && (_homeLoading || _reloadOnly)) { _wantTab = { key: asked, instead: _homeTab }; }
1240
+ if (launch && asked === 'guide' && (Stremio.getPrefs().hiddenTabs || []).indexOf('guide') === -1) { _wantGuide = _homeTab; } // (see EPG.onChange below)
1233
1241
  }
1234
1242
 
1235
1243
  s.appendChild(buildTopMenu(_homeTab));
@@ -1355,7 +1363,12 @@
1355
1363
  var has = hasGuide();
1356
1364
  if (has !== _hadGuide) {
1357
1365
  _hadGuide = has;
1358
- if (_current() === scr('home') && !isModalOpen() && !Player.isActive()) { renderHome(); }
1366
+ var want = has && _wantGuide; // (started on the Guide: it's here now)
1367
+ if (has) { _wantGuide = null; }
1368
+ if (_current() === scr('home') && !isModalOpen() && !Player.isActive()) {
1369
+ if (want && _homeTab === want) { setHomeTab('guide'); }
1370
+ renderHome();
1371
+ }
1359
1372
  }
1360
1373
  });
1361
1374
  }
@@ -243,6 +243,10 @@
243
243
  get: function () { return { spoilers: Stremio.getPrefs().spoilers }; },
244
244
  set: function (cfg) { Stremio.setPref('spoilers', cfg.spoilers); }
245
245
  }));
246
+ wrap.appendChild(subPickRow('Start on', V.HOME_TABS.map(function (t) { return [t.key, t.label]; }), 'startTab', {
247
+ get: function () { return { startTab: Stremio.getPrefs().startTab }; },
248
+ set: function (cfg) { Stremio.setPref('startTab', cfg.startTab); } // (the next launch: Home stays where it is now)
249
+ }));
246
250
  var menu = sectionRow('Menu ›', 'Order the top menu, and show or hide its tabs', 'menuorder');
247
251
  menu.className += ' cfg-row';
248
252
  wrap.appendChild(menu);
@@ -927,7 +931,8 @@
927
931
  parts.push(thousands(st.count || 0) + ' channel' + (st.count === 1 ? '' : 's') + (st.groups ? ' in ' + st.groups + ' group' + (st.groups === 1 ? '' : 's') : ''));
928
932
  if (st.fetchedAt) { var d = new Date(st.fetchedAt); parts.push('downloaded ' + U.dayLabel(st.fetchedAt) + ' ' + two(d.getHours()) + ':' + two(d.getMinutes())); }
929
933
  if (st.dropped) { parts.push(thousands(st.dropped) + ' more left out (a playlist keeps its first 30,000)'); }
930
- if (st.cut) { parts.push('stopped short' + (st.cut > 0 ? ' of ' + thousands(st.cut) : '') + ': see Stalker channels'); }
934
+ if (p.genres) { parts.push(p.genres.length + ' group' + (p.genres.length === 1 ? '' : 's') + ' chosen'); }
935
+ if (st.cut) { parts.push('stopped short' + (st.cut > 0 ? ' of ' + thousands(st.cut) : '') + ': OK on it, then Channel groups, reads only what you want'); }
931
936
  if (st.uncached) { parts.push('too large to save on the TV: downloaded each launch'); }
932
937
  var g = guideInfo(p);
933
938
  if (g) { parts.push(g); }
package/js/ytplay.js CHANGED
@@ -106,7 +106,11 @@ var YTPlay = (function () {
106
106
  return U.getJSON(PROXY + path + '?portal=' + encodeURIComponent(portal) + '&mac=' + encodeURIComponent(mac) + more + a.q, ms, max, cancel || null, a.h);
107
107
  });
108
108
  }
109
- function stalkerList(portal, mac, whole) { return stalkerAsk('/stalker/list', portal, mac, whole ? '&all=1' : '', whole ? 20 * 60000 : 90000, 48 * 1048576); } // (whole: the whole portal, see IPTV.stalkerAll)
109
+ function stalkerList(portal, mac, whole, genres) { // (whole: the whole portal, see IPTV.stalkerAll; genres: only those, see IPTV.setStalkerGroups)
110
+ var some = genres && genres.length;
111
+ return stalkerAsk('/stalker/list', portal, mac, (whole || some ? '&all=1' : '') + (some ? '&genres=' + encodeURIComponent(genres.join(',')) : ''), whole || some ? 20 * 60000 : 90000, 48 * 1048576);
112
+ }
113
+ function stalkerGenres(portal, mac) { return stalkerAsk('/stalker/genres', portal, mac, '', 40000, 1048576); }
110
114
  function stalkerLink(portal, mac, u, cancel) { return stalkerAsk('/stalker/link', portal, mac, '&u=' + encodeURIComponent(u), 25000, 65536, cancel); }
111
115
  // An Xtream account's films or series, kept by the service (see service/index.js, xtvControl;
112
116
  // user= and pass=: names Diagnostics masks):
@@ -253,6 +257,6 @@ var YTPlay = (function () {
253
257
  return MODE === 'tizenbrew' ? 'TizenBrew module' : MODE === 'wgt' ? 'Sideloaded app (.wgt)' : 'Browser (development)';
254
258
  }
255
259
 
256
- return { ensureService: ensureService, resolverUrl: resolverUrl, infoUrl: infoUrl, canPlay: canPlay, liveOpen: liveOpen, hlsMaster: hlsMaster, aiomAddons: aiomAddons, stalkerList: stalkerList, stalkerLink: stalkerLink, xtvodAsk: xtvodAsk, epgLoad: epgLoad, epgGet: epgGet, epgFiles: epgFiles, epgClear: epgClear, entryOpen: entryOpen, entryPoll: entryPoll, entryClose: entryClose, subsUrl: subsUrl, audioLang: audioLang, setAudioLang: setAudioLang, installMode: function () { return MODE; },
260
+ return { ensureService: ensureService, resolverUrl: resolverUrl, infoUrl: infoUrl, canPlay: canPlay, liveOpen: liveOpen, hlsMaster: hlsMaster, aiomAddons: aiomAddons, stalkerList: stalkerList, stalkerGenres: stalkerGenres, stalkerLink: stalkerLink, xtvodAsk: xtvodAsk, epgLoad: epgLoad, epgGet: epgGet, epgFiles: epgFiles, epgClear: epgClear, entryOpen: entryOpen, entryPoll: entryPoll, entryClose: entryClose, subsUrl: subsUrl, audioLang: audioLang, setAudioLang: setAudioLang, installMode: function () { return MODE; },
257
261
  installLabel: installLabel, unavailableMessage: unavailableMessage, isRunning: isRunning, port: PORT };
258
262
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stremiok",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "StremioK streaming client for Tizen 3.0+ Samsung TVs (TizenBrew app module).",
5
5
  "packageType": "app",
6
6
  "appName": "StremioK",
package/service/index.js CHANGED
@@ -1819,7 +1819,7 @@ function handle(req, res) {
1819
1819
  if (/^\/epg\//.test(path)) { epgControl(req, res, path, parts[1]); return; } // (a playlist's TV guide: see epgControl)
1820
1820
  if (path === '/aiom/addons') { aiomControl(req, res, parts[1], leaving); return; }
1821
1821
  if (path === '/xtvod/list' || path === '/xtvod/find') { xtvControl(req, res, path, parts[1]); return; } // (an Xtream account's films and series: see xtvControl)
1822
- if (path === '/stalker/list' || path === '/stalker/link') { stalkerControl(req, res, path, parts[1], leaving); return; } // (a Stalker portal: see stalkerControl) // (AIOManager's addons: see aiomControl) // (a live channel's sound repacked: see liveControl) // (the phone's one-time page: see below)
1822
+ if (path === '/stalker/list' || path === '/stalker/link' || path === '/stalker/genres') { stalkerControl(req, res, path, parts[1], leaving); return; } // (a Stalker portal: see stalkerControl) // (AIOManager's addons: see aiomControl) // (a live channel's sound repacked: see liveControl) // (the phone's one-time page: see below)
1823
1823
  if (path === '/fsfile') { // a USB file over HTTP, with Range: the player reads a big one from here (see fsfile in the header)
1824
1824
  var whyF = fsAllowed(req, parts[1]);
1825
1825
  if (whyF) { send(res, 403, 'text/plain', 'not allowed (' + whyF + ')'); return; }
@@ -2976,13 +2976,16 @@ function xtvControl(req, res, path, query) {
2976
2976
  // User-Agent, a session token from a handshake (none of which a web page can send). Its API at
2977
2977
  // <address>/portal.php, else /server/load.php (the address's /c/ left out). list: its genres and
2978
2978
  // channels (get_all_channels, else get_ordered_list a page at a time, STALKER_PAGES at most; all=1:
2979
- // the whole portal, up to STALKER_CHANNELS, a failed page tried again; cut: it stopped short) as an
2979
+ // the whole portal, up to STALKER_CHANNELS within STALKER_WHOLE_MS, a failed page tried again after
2980
+ // each of STALKER_WAITS, the rest then read STALKER_PACE_MS apart; genres=: only those genres, read
2981
+ // the same way; cut: it stopped short) as an
2980
2982
  // M3U playlist, genres as groups, xmltv_id as tvg-id, each channel's link the one in its cmd (often
2981
2983
  // a stand-in, http://localhost/ch/123_), kept STALKER_LIST_MS (adding a portal just checked reads it
2982
2984
  // once). link: the link to play now (create_link, with the channel's own cmd). A session whose
2983
2985
  // token the portal no longer takes is opened again, once. Redirects only on the same server.
2984
2986
  var STALKER_UA = 'Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) MAG200 stbapp ver: 2 rev: 250 Safari/533.3';
2985
- var STALKER_MS = 20000, STALKER_MAX = 16 * 1048576, STALKER_PAGES = 100, STALKER_CHANNELS = 30000, STALKER_LIST_MS = 2 * 60000, STALKER_KEEP = 4, STALKER_RETRIES = 2, STALKER_RETRY_MS = 3000;
2987
+ var STALKER_MS = 20000, STALKER_MAX = 16 * 1048576, STALKER_PAGES = 100, STALKER_CHANNELS = 30000, STALKER_LIST_MS = 2 * 60000, STALKER_KEEP = 4;
2988
+ var STALKER_GENRES = 1000, STALKER_WAITS = [3000, 10000, 30000, 60000, 120000], STALKER_PACE_MS = 1000, STALKER_WHOLE_MS = 17 * 60000; // (the app waits 20 minutes: what was read gets there)
2986
2989
  var _stalker = Object.create(null); // portal|mac -> { api, base, mac, token, cmds: { link: cmd }, list: { at, m3u, count }, used }
2987
2990
  function stalkerKeep(key) {
2988
2991
  var s = _stalker[key];
@@ -3102,7 +3105,8 @@ function stalkerSlim(c) { // (a page's channel: what the playlist takes; thous
3102
3105
  if (!c || typeof c !== 'object') { return null; }
3103
3106
  return { name: c.name, cmd: c.cmd, cmds: Array.isArray(c.cmds) ? c.cmds.slice(0, 1) : null, logo: c.logo, xmltv_id: c.xmltv_id, number: c.number, tv_genre_id: c.tv_genre_id };
3104
3107
  }
3105
- function stalkerChannels(s, ctl, whole, cb) {
3108
+ // picks: the genres to read (their ids), or none: all of them.
3109
+ function stalkerChannels(s, ctl, whole, picks, cb) {
3106
3110
  stalkerAsk(s, 'type=itv&action=get_genres', ctl, function (e0, genres) {
3107
3111
  if (e0 && e0.auth) { cb(e0); return; }
3108
3112
  var g = {};
@@ -3110,23 +3114,27 @@ function stalkerChannels(s, ctl, whole, cb) {
3110
3114
  stalkerAsk(s, 'type=itv&action=get_all_channels', ctl, function (e1, js) {
3111
3115
  if (e1 && e1.auth) { cb(e1); return; }
3112
3116
  var all = js && Array.isArray(js.data) ? js.data : Array.isArray(js) ? js : [];
3117
+ if (all.length && picks.length) { all = all.filter(function (c) { return c && picks.indexOf(String(c.tv_genre_id)) !== -1; }); cb(null, all.slice(0, STALKER_CHANNELS), g, all.length > STALKER_CHANNELS ? { total: all.length } : null); return; }
3113
3118
  if (all.length) { cb(null, all.slice(0, STALKER_CHANNELS), g, all.length > STALKER_CHANNELS ? { total: all.length } : null); return; }
3114
- var page = 1, tries = 0;
3119
+ var todo = picks.length ? picks : ['*'], at = 0, page = 1, tries = 0, pace = 0, from = 0, known = 0, began = Date.now();
3115
3120
  (function more() {
3116
- stalkerAsk(s, 'type=itv&action=get_ordered_list&genre=*&fav=0&sortby=number&hd=0&p=' + page, ctl, function (e2, o) {
3121
+ stalkerAsk(s, 'type=itv&action=get_ordered_list&genre=' + encodeURIComponent(todo[at]) + '&fav=0&sortby=number&hd=0&p=' + page, ctl, function (e2, o) {
3117
3122
  if (e2 && (!all.length || (whole && e2.auth))) { cb(e2); return; } // (whole: a session gone midway read again, once: stalkerWith)
3118
- if (e2 && whole && !ctl.gone && tries < STALKER_RETRIES) { tries++; setTimeout(more, STALKER_RETRY_MS); return; }
3123
+ var late = whole && Date.now() - began > STALKER_WHOLE_MS;
3124
+ if (e2 && whole && !ctl.gone && !late && tries < STALKER_WAITS.length) { pace = STALKER_PACE_MS; setTimeout(more, STALKER_WAITS[tries++]); return; }
3119
3125
  tries = 0;
3120
3126
  var d = !e2 && o && Array.isArray(o.data) ? o.data : [], total = +(o && o.total_items) || 0, room = STALKER_CHANNELS - all.length;
3121
- d.slice(0, room).forEach(function (c) { var x = stalkerSlim(c); if (x) { all.push(x); } });
3122
- var got = total && all.length >= total, full = all.length >= STALKER_CHANNELS, last = !whole && page >= STALKER_PAGES;
3123
- if (!d.length || got || full || last) {
3124
- var cut = e2 || (!got && d.length && (full || last)) ? { total: total, why: e2 ? (e2.message || 'failed') : '' } : null;
3127
+ d.slice(0, room).forEach(function (c) { var x = stalkerSlim(c); if (x) { if (picks.length) { x.tv_genre_id = todo[at]; } all.push(x); } });
3128
+ if (total) { known = total; }
3129
+ var ended = !d.length || (total && all.length - from >= total), lastOne = at + 1 >= todo.length; // (this genre's all read; no other to read)
3130
+ var full = all.length >= STALKER_CHANNELS, last = !whole && page >= STALKER_PAGES;
3131
+ if (e2 || full || last || late || (ended && lastOne)) {
3132
+ var cut = e2 || ((!ended || !lastOne) && (full || last || late)) ? { total: picks.length ? 0 : known, why: e2 ? (e2.message || 'failed') : late ? 'it took too long' : '' } : null;
3125
3133
  cb(null, all, g, cut);
3126
3134
  return;
3127
3135
  }
3128
- page++;
3129
- more();
3136
+ if (ended) { at++; page = 1; from = all.length; } else { page++; }
3137
+ if (pace) { setTimeout(more, pace); } else { more(); }
3130
3138
  });
3131
3139
  })();
3132
3140
  });
@@ -3173,15 +3181,23 @@ function stalkerControl(req, res, path, query, leaving) {
3173
3181
  }, function (err, link) { json(err ? { why: err.message || 'failed' } : { url: link }); });
3174
3182
  return;
3175
3183
  }
3184
+ if (path === '/stalker/genres') {
3185
+ stalkerWith(s, portal, mac, ctl, function (ss, done) { stalkerAsk(ss, 'type=itv&action=get_genres', ctl, done); }, function (err, js) {
3186
+ if (err) { json({ why: err.message || 'failed' }); return; }
3187
+ json({ genres: (Array.isArray(js) ? js : []).filter(function (x) { return x && x.id != null && x.id !== '*' && x.title; }).slice(0, STALKER_GENRES).map(function (x) { return { id: String(x.id).slice(0, 40), title: String(x.title).slice(0, 100) }; }) });
3188
+ });
3189
+ return;
3190
+ }
3191
+ var picks = String(q.genres || '').split(',').filter(function (x) { return /^[\w.-]{1,40}$/.test(x); }).slice(0, STALKER_GENRES), wanted = picks.join(',');
3176
3192
  var whole = q.all === '1', sock = req.socket;
3177
3193
  if (whole && sock && sock.setTimeout) { // (a read of many minutes: Node's two idle minutes would end it)
3178
3194
  sock.setTimeout(0);
3179
3195
  if (res.on) { res.on('finish', function () { sock.setTimeout(120000); }); }
3180
3196
  }
3181
3197
  function listed(l) { var o = { m3u: l.m3u, count: l.count }; if (l.cut) { o.cut = l.cut; } return o; }
3182
- if (s.list && Date.now() - s.list.at < STALKER_LIST_MS && (s.list.whole || !whole)) { json(listed(s.list)); return; }
3198
+ if (s.list && Date.now() - s.list.at < STALKER_LIST_MS && s.list.genres === wanted && (s.list.whole || !whole)) { json(listed(s.list)); return; }
3183
3199
  stalkerWith(s, portal, mac, ctl, function (ss, done) {
3184
- stalkerChannels(ss, ctl, whole, function (err, list, genres, cut) {
3200
+ stalkerChannels(ss, ctl, whole, picks, function (err, list, genres, cut) {
3185
3201
  var m = err ? null : stalkerM3u(ss, list, genres);
3186
3202
  if (m && cut) { m.cut = cut; }
3187
3203
  done(err, m);
@@ -3192,8 +3208,8 @@ function stalkerControl(req, res, path, query, leaving) {
3192
3208
  json(refused ? { refused: true, why: s.block || 'the portal refused that MAC address' } : { unreachable: true, why: err.message || 'failed' });
3193
3209
  return;
3194
3210
  }
3195
- if (!r.count) { json({ refused: true, why: s.block || 'the portal listed no channels for that MAC address' }); return; }
3196
- s.list = { at: Date.now(), m3u: r.m3u, count: r.count, cut: r.cut || null, whole: whole };
3211
+ if (!r.count) { json({ refused: true, why: s.block || (picks.length ? 'the portal listed no channels in the groups you chose' : 'the portal listed no channels for that MAC address') }); return; }
3212
+ s.list = { at: Date.now(), m3u: r.m3u, count: r.count, cut: r.cut || null, whole: whole, genres: wanted };
3197
3213
  json(listed(s.list));
3198
3214
  });
3199
3215
  }