stremiok 2.2.2 → 2.2.4

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,34 @@
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.4 — 2026-10-31
7
+ - **The remote's ▶ Play key:** on a movie, an episode or a channel (its card, its row, its sources,
8
+ its row in the Guide), plays the top source at once, whatever *Skip the source list* says.
9
+ - **Titles in a Home row** has *Unlimited*, for catalogs and IPTV groups.
10
+ - **Stalker channels** (Settings › Content › IPTV): *Whole portal* reads past the first 100 pages
11
+ (about 1,400 channels), with a warning; a portal read that stopped short says so.
12
+ - **TV guide:** a guide read again (*Reload*, *Auto-refresh*) reaches the Guide tab at once; its grid
13
+ could keep the old titles for up to 2 hours.
14
+
15
+ ## 2.2.3 — 2026-10-30
16
+ - **Xtream films and series:** an account's films and series in the Movies and Series tabs (a show
17
+ is one tile, its episodes on its page), Discover by its categories, and Search. The IPTV tab
18
+ keeps its live channels. Home says *Loading…* while a long list is read; *Reload* on the account
19
+ reads them again.
20
+ - **Its copies on your titles:** a film or episode from your addons lists the account's copy among
21
+ its sources (*Xtream*), matched by TMDB id, or by name and year.
22
+ - **Stalker portals, experimental** (Settings › Content › IPTV › *Add Stalker portal*): its address and MAC
23
+ address; its channels are a playlist, a row per genre.
24
+ - **★ Favorites** shows all your favorites, not the last 30 picked.
25
+ - **Titles in a Home row** (Settings › Appearance): 30, 50, 100 or 200; a catalog that comes a page
26
+ at a time is asked for more pages to fill the row.
27
+ - **Films in a playlist** (a link to a file) play as films you can scrub through, not as live TV.
28
+ - **Subtitles** within a language come in your addon order, each addon's best match first (they
29
+ were shuffled on older TVs).
30
+ - **Smoother on older TVs:** D-pad moves reach the screen a quarter or more sooner on the 2017 TV;
31
+ long rows build as you reach them, and pictures off screen load while you aren't pressing keys.
32
+ - **Progress** is saved once a minute while playing, and at once when you stop or leave.
33
+
6
34
  ## 2.2.2 — 2026-10-28
7
35
  - **Torrents through a streaming server** (Settings › Content › Streaming server): with Stremio's
8
36
  streaming server or a TorrServer running on your network (a computer or a NAS), torrent-only
package/README.md CHANGED
@@ -31,12 +31,14 @@ video through Samsung's AVPlay API.
31
31
  - **The player:** resume where you stopped, skip intros, recaps and credits, next episode,
32
32
  subtitles (addons', the file's own, and your own files on a USB drive) with your choice of look, audio
33
33
  tracks remembered, switching source mid-playback, private viewing.
34
- - **IPTV and radio** from your M3U playlists and Xtream accounts, with CH+ / CH−.
34
+ - **IPTV and radio** from your M3U playlists, Xtream accounts (with their films and series) and
35
+ Stalker portals, with CH+ / CH−.
35
36
  - **YouTube:** live channels, trailers, and your own YouTube channels, playlists and searches,
36
37
  with SponsorBlock, DeArrow, chapters and captions.
37
38
  - **Local:** the videos on a USB drive, matched to their titles.
38
39
  - **Torrents**, through Stremio's streaming server or a TorrServer you run on your network.
39
- - **Made for the remote:** D-pad navigation throughout; hold OK where an item has more to
40
+ - **Made for the remote:** D-pad navigation throughout; ▶ Play on a movie, episode or channel plays
41
+ its top source at once; hold OK where an item has more to
40
42
  offer (*Hold OK for more* says so); zoom up to 140% for reading from further away.
41
43
 
42
44
  ## Install
@@ -58,8 +60,8 @@ Three ways, all covered step by step in the **[installation guide](docs/INSTALL.
58
60
  2. **API keys**, optional: your own TMDB, OMDb and MDBList keys add ratings, *Cast & more*,
59
61
  *where to watch* and episode trailers.
60
62
  3. **Trakt**, optional: connect your account to share watched marks and Continue Watching.
61
- 4. **IPTV**, optional: your M3U playlist links, or an Xtream account (its server, username and
62
- password).
63
+ 4. **IPTV**, optional: your M3U playlist links, an Xtream account (its server, username and
64
+ password) or a Stalker portal (its address and MAC address).
63
65
  5. **A USB drive**, optional: plug it in and the Local tab appears.
64
66
 
65
67
  [Getting started](docs/USER-GUIDE.md#getting-started) in the user guide walks through each.
@@ -77,8 +79,8 @@ or TorrServer): this app embeds no torrent or debrid engine.
77
79
  > shows that notice on it); its results are rent/buy/subscription *links to external
78
80
  > services*, not video URLs. Add stream addons that return HTTP/HLS URLs for actual playback.
79
81
 
80
- The **IPTV** feature likewise hosts no content: you supply your own M3U playlist URLs or Xtream
81
- accounts. For YouTube entries, the bundled service finds the video's stream; the video itself
82
+ The **IPTV** feature likewise hosts no content: you supply your own M3U playlist URLs, Xtream
83
+ accounts or Stalker portals. For YouTube entries, the bundled service finds the video's stream; the video itself
82
84
  comes straight from YouTube. No video or audio is kept: everything plays straight from its
83
85
  source, unless you download it to your own USB drive. What StremioK does keep, on the TV, is
84
86
  your progress, settings and copies that let it start faster (see
@@ -88,7 +90,8 @@ your progress, settings and copies that let it start faster (see
88
90
 
89
91
  - AVPlay behavior varies by TV generation, codec and HLS provider.
90
92
  - Torrents play only through a streaming server you run on your network.
91
- - Home rows show a catalog's first page (up to 30 titles); Discover pages through the rest.
93
+ - Home rows show 30 titles of a catalog unless you change it, up to *Unlimited* (★ Favorites shows
94
+ all yours); Discover pages through the rest.
92
95
  - No StremioK account and no profiles: settings, addons and progress stay on the TV. The
93
96
  only sync is optional: Trakt (watched marks, Continue Watching, ratings).
94
97
  - Subtitles use an HTML overlay; gzipped (`.gz`) subtitle files aren't decoded.
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.2" viewmodes="maximized">
3
+ id="http://stremiok.tizen/StremioKTizen" version="2.2.4" 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
@@ -48,7 +48,9 @@ html, body {
48
48
  .row { margin: 0 0 16px 0; }
49
49
  .row-title { font-size: 26px; font-weight: bold; margin: 0 0 8px 60px; color: #c7cbd4; }
50
50
  /* vertical padding leaves room for the scaled focus ring (overflow clips the rest) */
51
- .row-scroller { white-space: nowrap; padding: 26px 60px; overflow: hidden; }
51
+ /* Its own GPU layer: on the 2017 TV a D-pad move reached the screen a quarter or more sooner
52
+ (65 -> 47 ms sideways, 96 -> 72 ms up / down, measured); a layer per card was no better overall. */
53
+ .row-scroller { white-space: nowrap; padding: 26px 60px; overflow: hidden; -webkit-transform: translateZ(0); transform: translateZ(0); }
52
54
 
53
55
  /* --- Cards --- */
54
56
  .card {
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.2">
7
+ <link rel="stylesheet" href="css/style.css?v=2.2.4">
8
8
  </head>
9
9
  <body>
10
10
  <!-- CSS-applied sentinel (kept off-screen); app.js waits for its width before rendering -->
@@ -53,37 +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.2"></script>
57
- <script src="js/util.js?v=2.2.2"></script>
58
- <script src="js/iptv.js?v=2.2.2"></script>
59
- <script src="js/epg.js?v=2.2.2"></script>
60
- <script src="js/youtube.js?v=2.2.2"></script>
61
- <script src="js/stremio.js?v=2.2.2"></script>
62
- <script src="js/trakt.js?v=2.2.2"></script>
63
- <script src="js/keys.js?v=2.2.2"></script>
64
- <script src="js/focus.js?v=2.2.2"></script>
65
- <script src="js/tvapps.js?v=2.2.2"></script>
66
- <script src="js/player-core.js?v=2.2.2"></script>
67
- <script src="js/player-store.js?v=2.2.2"></script>
68
- <script src="js/player-lang.js?v=2.2.2"></script>
69
- <script src="js/player-quality.js?v=2.2.2"></script>
70
- <script src="js/player-subs.js?v=2.2.2"></script>
71
- <script src="js/player-audio.js?v=2.2.2"></script>
72
- <script src="js/player-controls.js?v=2.2.2"></script>
73
- <script src="js/player.js?v=2.2.2"></script>
74
- <script src="js/ytplay.js?v=2.2.2"></script>
75
- <script src="js/local.js?v=2.2.2"></script>
76
- <script src="js/downloads.js?v=2.2.2"></script>
77
- <script src="js/stremio-account.js?v=2.2.2"></script>
78
- <script src="js/view-core.js?v=2.2.2"></script>
79
- <script src="js/view-home.js?v=2.2.2"></script>
80
- <script src="js/view-guide.js?v=2.2.2"></script>
81
- <script src="js/view-detail.js?v=2.2.2"></script>
82
- <script src="js/view-search.js?v=2.2.2"></script>
83
- <script src="js/view-settings.js?v=2.2.2"></script>
84
- <script src="js/view-discover.js?v=2.2.2"></script>
85
- <script src="js/views.js?v=2.2.2"></script>
86
- <script src="js/app.js?v=2.2.2"></script>
87
- <script src="js/hubpreview.js?v=2.2.2"></script>
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>
88
89
  </body>
89
90
  </html>
package/js/app.js CHANGED
@@ -55,11 +55,11 @@ var App = (function () {
55
55
 
56
56
  // Live TV: skip the info page — load sources and (if a single one) play immediately.
57
57
  // channels: { list: [{ meta, card }], idx } — the row it was picked from, for CH+/CH−
58
- function openLive(type, id, preview, channels) {
58
+ function openLive(type, id, preview, channels, opts) {
59
59
  if (!id) { return; }
60
60
  pushFrame();
61
61
  showScreen('detail');
62
- Views.renderLive(type, id, preview, channels);
62
+ Views.renderLive(type, id, preview, channels, opts);
63
63
  }
64
64
 
65
65
  // A person's page (from a title's cast row).
@@ -210,6 +210,13 @@ var App = (function () {
210
210
  return true;
211
211
  }
212
212
  case 'BACK': back(); return true;
213
+ case 'PLAY':
214
+ case 'PLAYPAUSE': { // (a movie, an episode or a channel: its top source, as with Skip the source list on)
215
+ var cp = Focus.current();
216
+ if (cp && cp.__onplay) { cp.__onplay(cp); }
217
+ else if (_current === 'detail' && !Views.isModalOpen()) { Views.playKey(); }
218
+ return true;
219
+ }
213
220
  default:
214
221
  if (/^NUM\d$/.test(action)) { numberKey(+action.slice(3)); }
215
222
  return true;
package/js/epg.js CHANGED
@@ -122,7 +122,7 @@ var EPG = (function () {
122
122
  ['state', 'at', 'channels', 'programmes', 'partial', 'error'].forEach(function (f) { g[f] = r && r[f]; });
123
123
  if (g.state === 'loading' && n < POLLS) { g.timer = setTimeout(function () { g.timer = null; ask(n + 1); }, n < POLL_MS.length ? POLL_MS[n] : POLL_MS_LATER); }
124
124
  if (g.state + '|' + g.at !== was) {
125
- if (g.state === 'ready') { forget(url); } // (read again: what's on, asked again)
125
+ if (g.state === 'ready') { _gen++; forget(url); } // (read again: what's on, and the Guide tab's grid, asked again)
126
126
  changed();
127
127
  }
128
128
  }, function () {
package/js/focus.js CHANGED
@@ -85,12 +85,23 @@ var Focus = (function () {
85
85
  // UP/DOWN in a list of rows (Home, Search, Cast & more): only the next / previous
86
86
  // row's items are candidates, not every card on the screen (thousands on a big IPTV
87
87
  // tab). No row that way: as below (the top menu, …).
88
+ _rowsAsked = false;
88
89
  if ((dir === 'UP' || dir === 'DOWN') && (best = nextRowPick(dir, r))) { setFocus(enterGroup(best)); return; }
90
+ // A card in a sideways row: only its neighbor can be next along the row, and no other
91
+ // row's card is ever on its line. So the next one first, and at the row's end (or going
92
+ // up or down with no row that way) other rows' cards aren't measured at all.
93
+ var inRow = isRowCard(_current);
94
+ if ((dir === 'LEFT' || dir === 'RIGHT') && inRow) {
95
+ var nb = _current[dir === 'RIGHT' ? 'nextElementSibling' : 'previousElementSibling'];
96
+ best = nb ? pick(dir, r, [nb]) : null;
97
+ if (best) { setFocus(enterGroup(best)); return; }
98
+ }
99
+ var skip = (inRow && (dir === 'LEFT' || dir === 'RIGHT' || _rowsAsked)) ? isRowCard : null;
89
100
  // LEFT/RIGHT fast path: in a carousel row the only same-row candidates are the
90
101
  // card's siblings, so skip measuring the whole screen. At a row end (nothing
91
102
  // there) fall back to the full scan, which may reach a non-sibling on the same
92
103
  // line (e.g. last tab pill -> Search).
93
- if ((dir === 'LEFT' || dir === 'RIGHT') && _current.parentNode) {
104
+ if ((dir === 'LEFT' || dir === 'RIGHT') && _current.parentNode && !inRow) {
94
105
  best = pick(dir, r, _current.parentNode.children);
95
106
  }
96
107
  // UP/DOWN: stay inside the scrolling area focus is in (Home rows, a Settings
@@ -100,13 +111,19 @@ var Focus = (function () {
100
111
  // jump to the menu (or skip a row) instead of the row just scrolled out of view.
101
112
  if (dir === 'UP' || dir === 'DOWN') {
102
113
  for (var p = _current.parentNode; !best && p && p !== _scope && p.nodeType === 1; p = p.parentNode) {
103
- if (p.scrollHeight > p.clientHeight + 2) { best = pick(dir, r, p.querySelectorAll('.focusable')); }
114
+ if (p.scrollHeight > p.clientHeight + 2) { best = pick(dir, r, p.querySelectorAll('.focusable'), skip); }
104
115
  }
105
116
  }
106
- if (!best) { best = pick(dir, r, _scope.querySelectorAll('.focusable')); }
117
+ if (!best) { best = pick(dir, r, _scope.querySelectorAll('.focusable'), skip); }
107
118
  if (best) { setFocus(enterGroup(best)); }
108
119
  }
109
120
 
121
+ var _rowsAsked = false; // (this move: every row that way was looked at, by nextRowPick)
122
+ function isRowCard(n) {
123
+ var p = n.parentNode;
124
+ return !!p && (' ' + (p.className || '') + ' ').indexOf(' row-scroller ') !== -1;
125
+ }
126
+
110
127
  function nextRowPick(dir, r) {
111
128
  var row = null, box = null;
112
129
  for (var p = _current.parentNode; p && p !== _scope && p.nodeType === 1; p = p.parentNode) {
@@ -115,6 +132,7 @@ var Focus = (function () {
115
132
  if (row && /\s(rows|search-results|more-rows)\s/.test(cn)) { box = p; break; }
116
133
  }
117
134
  if (!row || !box) { return null; }
135
+ _rowsAsked = true;
118
136
  // a row that's a grid (Watching's): its next / previous line first (a sideways row has
119
137
  // one line: nothing more to measure)
120
138
  var grid = _current.parentNode && (' ' + (_current.parentNode.className || '') + ' ').indexOf(' card-grid ') !== -1 ? _current.parentNode : null;
@@ -139,8 +157,9 @@ var Focus = (function () {
139
157
  return target;
140
158
  }
141
159
 
142
- // Best focusable in `nodes` for a move in `dir` from rect `r` (null if none).
143
- function pick(dir, r, nodes) {
160
+ // Best focusable in `nodes` for a move in `dir` from rect `r` (null if none). skip(node): ones
161
+ // that can't be it.
162
+ function pick(dir, r, nodes, skip) {
144
163
  var cx = r.left + r.width / 2, cy = r.top + r.height / 2;
145
164
 
146
165
  // Collect candidates in the pressed direction with their primary (distance
@@ -150,6 +169,7 @@ var Focus = (function () {
150
169
  for (var i = 0; i < nodes.length; i++) {
151
170
  var node = nodes[i];
152
171
  if (node === _current || !node.classList || !node.classList.contains('focusable')) { continue; }
172
+ if (skip && skip(node)) { continue; } // (without measuring it)
153
173
  var b = node.getBoundingClientRect();
154
174
  if (b.width <= 0 || b.height <= 0) { continue; }
155
175
  var bx = b.left + b.width / 2, by = b.top + b.height / 2;
package/js/iptv.js CHANGED
@@ -30,6 +30,7 @@ var IPTV = (function () {
30
30
  if (typeof p.name === 'string' && p.name.trim()) { o.name = p.name.trim().slice(0, NAME_MAX); }
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
+ if (macOf(p.mac)) { o.mac = macOf(p.mac); } // (a Stalker portal: see addStalker)
33
34
  return o;
34
35
  });
35
36
  }
@@ -185,6 +186,50 @@ var IPTV = (function () {
185
186
  return id;
186
187
  }
187
188
 
189
+ // ---- A Stalker portal: its address and the MAC address your provider registered ----
190
+ // Read by StremioK's service, which asks as a MAG box does (YTPlay.stalkerList): its channels
191
+ // come as an M3U playlist, and a channel's link is asked for each time it plays (streams). Saved
192
+ // as a playlist with its MAC ({ url: the portal, mac }).
193
+ var STB_UA = 'Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) MAG200 stbapp ver: 2 rev: 250 Safari/533.3';
194
+ // A MAC address as typed (00:1A:79:12:34:56, with dashes, or none): 00:1A:79:12:34:56, or ''.
195
+ function macOf(v) {
196
+ var h = ('' + (v || '')).trim().toUpperCase().replace(/[:\-.\s]/g, '');
197
+ return /^[0-9A-F]{12}$/.test(h) ? h.match(/../g).join(':') : '';
198
+ }
199
+ // The portal as typed (http:// when it has no scheme): its address, or ''.
200
+ function stalkerPortal(v) {
201
+ var s = ('' + (v || '')).trim();
202
+ if (s && !/^[a-z][a-z0-9+.-]*:\/\//i.test(s)) { s = 'http://' + s.replace(/^\/+/, ''); }
203
+ return checkedUrl(s);
204
+ }
205
+ function isStalker(p) { return !!(p && p.mac); }
206
+ // Settings › Content › IPTV › Stalker channels: a portal read past its first 100 pages, up to
207
+ // 30,000 channels (adding one is still checked by those pages: stalkerCheck).
208
+ var STALKER_ALL_KEY = 'stremiok.iptv.stalkerall';
209
+ function stalkerAll() { return U.store.get(STALKER_ALL_KEY, false) === true; }
210
+ function setStalkerAll(on) { U.store.set(STALKER_ALL_KEY, !!on); }
211
+ // Checked through the service (its channels read): { ok, count }, { refused, why },
212
+ // { unreachable, why } or { noService } (a desktop browser).
213
+ function stalkerCheck(portal, mac) {
214
+ if (typeof YTPlay === 'undefined' || !YTPlay.stalkerList) { return Promise.resolve({ noService: true }); }
215
+ return YTPlay.stalkerList(portal, mac).then(function (r) {
216
+ if (r && typeof r.m3u === 'string') { return { ok: true, count: r.count || 0, cut: r.cut || null }; }
217
+ return r && r.refused ? { refused: true, why: '' + (r.why || '') } : { unreachable: true, why: '' + ((r && r.why) || '') };
218
+ }, function (e) { return /no service/.test((e && e.message) || '') ? { noService: true } : { unreachable: true, why: U.problem(e) }; });
219
+ }
220
+ // Added (named after its server: "Stalker · portal.example.com"), or the one already there with
221
+ // that portal and MAC. Its id.
222
+ function addStalker(portal, mac) {
223
+ portal = stalkerPortal(portal); mac = macOf(mac);
224
+ if (!portal || !mac) { return false; }
225
+ var list = getPlaylists();
226
+ for (var i = 0; i < list.length; i++) { if (list[i].url === portal && list[i].mac === mac) { return list[i].id; } }
227
+ var id = newId(), u = U.parseUrl(portal);
228
+ list.push({ id: id, url: portal, mac: mac, name: freeName('Stalker · ' + (u ? u.host : 'portal'), list) });
229
+ savePlaylists(list);
230
+ return id;
231
+ }
232
+
188
233
  function updatePlaylist(id, url) {
189
234
  url = checkedUrl(url);
190
235
  if (!url) { return false; }
@@ -249,6 +294,10 @@ var IPTV = (function () {
249
294
  if (n === 'user-agent') { c.ua = v; } else if (n === 'referer' || n === 'referrer') { c.ref = v; }
250
295
  }
251
296
 
297
+ // A link to a file, not a stream: a film or an episode (an Xtream account's /movie/… and
298
+ // /series/… links, or a video file's name), played as one (seeking; see Player's isLive).
299
+ var VOD_LINK = /\.(mkv|mp4|m4v|avi|mov|wmv|mpg|mpeg|webm)(?:[?#]|$)/i;
300
+ var XTREAM_VOD = /^https?:\/\/[^\/]+(?:\/[^?#]*)?\/(movie|series)\/[^\/?#]+\/[^\/?#]+\/\d+\.[a-z0-9]{2,4}(?:[?#]|$)/i;
252
301
  function truthy(v) { return /^(?:1|true|yes)$/i.test(('' + (v || '')).trim()); }
253
302
 
254
303
  function audioUrl(u) {
@@ -328,6 +377,7 @@ var IPTV = (function () {
328
377
  cur._yt =
329
378
  /^https?:\/\/(?:[^\/]+\.)?youtube\.com(?::\d+)?(?:\/|$)/i.test(u) ||
330
379
  /^https?:\/\/youtu\.be(?::\d+)?(?:\/|$)/i.test(u);
380
+ if (VOD_LINK.test(u) || XTREAM_VOD.test(u)) { cur.vod = true; } // (a film's file: played as one, see plainStreams)
331
381
  add(cur);
332
382
  }
333
383
  cur = null;
@@ -427,8 +477,9 @@ var IPTV = (function () {
427
477
  var st = { id: playlist.id, url: playlist.url, count: 0, groups: 0, error: '', uncached: false, title: '', fetchedAt: 0, stale: false };
428
478
  _status[playlist.id] = st;
429
479
  if (/^http:/i.test(playlist.url)) { // (Settings › Diagnostics › Logs)
430
- U.log('iptv', 'Playlist “' + label(playlist) + '” is downloaded over unencrypted http:// — anyone on the network path can see or change it (and any username / password in its link)');
480
+ 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') + ')');
431
481
  }
482
+ var src = playlist.url + (playlist.mac ? '#mac=' + playlist.mac : ''); // (its saved copy: this portal and MAC's)
432
483
 
433
484
  function finish(text, at) {
434
485
  st.fetchedAt = at || 0;
@@ -437,7 +488,13 @@ var IPTV = (function () {
437
488
  st.title = r.title || '';
438
489
  st.guides = r.guides || [];
439
490
  _sources = null;
440
- return counted(tagChannels(r.channels, playlist.id));
491
+ // An Xtream account's films and episodes: its Movies and Series (js/xtvod.js), not channels
492
+ var channels = r.channels;
493
+ if (isXtream(playlist.url) && typeof XtVod !== 'undefined' && XtVod.hidesVodLines && XtVod.hidesVodLines(playlist.id)) {
494
+ channels = channels.filter(function (c) { return !XTREAM_VOD.test(c.url); });
495
+ st.vodLines = r.channels.length - channels.length;
496
+ }
497
+ return counted(tagChannels(channels, playlist.id));
441
498
  });
442
499
  }
443
500
  function counted(channels) {
@@ -445,7 +502,7 @@ var IPTV = (function () {
445
502
  channels.forEach(function (c) { groups[c.type + '|' + c.group] = 1; });
446
503
  st.count = channels.length;
447
504
  st.groups = Object.keys(groups).length;
448
- if (!channels.length && !st.error) {
505
+ if (!channels.length && !st.error && !st.vodLines) {
449
506
  st.error = 'No channels parsed (is the URL returning the .m3u file?)';
450
507
  }
451
508
  return channels;
@@ -453,13 +510,29 @@ var IPTV = (function () {
453
510
 
454
511
  var saved = force ? Promise.resolve(null) : readPersist(playlist.id);
455
512
  return saved.then(function (p) {
456
- if (p && p.url === playlist.url && typeof p.text === 'string') { return finish(p.text, p.at); }
513
+ if (p && p.url === src && typeof p.text === 'string') { return finish(p.text, p.at); }
457
514
  return fetchIt();
458
515
  });
516
+ // A Stalker portal's channels, from the service (see stalkerCheck): its M3U text.
517
+ function stalkerText() {
518
+ 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) {
520
+ if (r && typeof r.m3u === 'string') {
521
+ if (r.cut) { // (stopped short: said, with what's there)
522
+ st.cut = r.cut.total || true;
523
+ U.log('iptv', 'Stalker portal “' + label(playlist) + '”: read ' + (r.count || 0) + ' channels' + (r.cut.total ? ' of ' + r.cut.total : '') + ', and stopped' + (r.cut.why ? ' (' + r.cut.why + ')' : ''));
524
+ }
525
+ return r.m3u;
526
+ }
527
+ throw new Error((r && r.refused ? 'The portal refused it: ' : 'Couldn’t read the portal: ') + ((r && r.why) || 'no answer'));
528
+ }, function (e) {
529
+ 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));
530
+ });
531
+ }
459
532
  function fetchIt() {
460
- return U.getText(playlist.url, 15000, PLAYLIST_MAX).then(function (text) {
533
+ return (isStalker(playlist) ? stalkerText() : U.getText(playlist.url, 15000, PLAYLIST_MAX)).then(function (text) {
461
534
  var at = Date.now();
462
- return writePersist(playlist.id, playlist.url, text, at).then(function (ok) {
535
+ return writePersist(playlist.id, src, text, at).then(function (ok) {
463
536
  st.uncached = !ok;
464
537
  return finish(text, at);
465
538
  });
@@ -467,14 +540,14 @@ var IPTV = (function () {
467
540
  var msg = (e && e.message) ? e.message : 'Could not fetch the playlist URL';
468
541
  // status 0 / network error on a URL that opens fine in a browser almost
469
542
  // always means the server sent no Access-Control-Allow-Origin header.
470
- if (/HTTP 0\b/.test(msg) || /Network error|^No answer/i.test(msg)) {
543
+ if (!isStalker(playlist) && (/HTTP 0\b/.test(msg) || /Network error|^No answer/i.test(msg))) {
471
544
  msg += ' — the playlist server likely isn\'t sending an ' +
472
545
  'Access-Control-Allow-Origin header (CORS). Serve the .m3u with CORS enabled.';
473
546
  }
474
547
  st.error = msg;
475
548
  // Fall back to this playlist's saved copy so a failed refresh doesn't wipe it.
476
549
  return readPersist(playlist.id).then(function (prev) {
477
- if (!(prev && prev.url === playlist.url && typeof prev.text === 'string')) { return []; }
550
+ if (!(prev && prev.url === src && typeof prev.text === 'string')) { return []; }
478
551
  st.stale = true; // (the channels are the saved copy's)
479
552
  return finish(prev.text, prev.at);
480
553
  });
@@ -629,6 +702,8 @@ var IPTV = (function () {
629
702
  if (c._yt) {
630
703
  return [{ url: c.url, _yt: true, ytPage: c.url, name: c.name, title: 'YouTube · ' + c.group }];
631
704
  }
705
+ var list = getPlaylists(), pl = list[find(list, c._playlistId)];
706
+ if (isStalker(pl)) { return stalkerStreams(c, pl); }
632
707
  return youTubeEnd(c.url).then(function (page) {
633
708
  if (page) { return [{ url: page, _yt: true, ytPage: page, name: c.name, title: 'YouTube · ' + c.group }]; }
634
709
  return plainStreams(c);
@@ -638,11 +713,31 @@ var IPTV = (function () {
638
713
  function plainStreams(c) {
639
714
  var from = sourceOf(c);
640
715
  var st = { url: c.url, name: c.name, title: 'IPTV · ' + c.group + (from ? ' · ' + from : '') };
716
+ if (c.vod) { st._vod = true; }
641
717
  var h = U.sanitizeHeaders({ ua: c.ua, ref: c.ref }); // (only what the player takes, checked)
642
718
  if (h) { st._headers = h; }
643
719
  return [st];
644
720
  }
645
721
 
722
+ // A Stalker portal's channel: its link asked for now (create_link: most portals' links work for
723
+ // a short while, or once), played with a MAG User-Agent. None given: the one in its playlist,
724
+ // unless that's a stand-in (http://localhost/ch/…), which plays nothing.
725
+ function stalkerStreams(c, pl) {
726
+ var asked = typeof YTPlay !== 'undefined' && YTPlay.stalkerLink ? YTPlay.stalkerLink(pl.url, pl.mac, c.url) : Promise.reject(new Error('no service'));
727
+ return asked.then(function (r) {
728
+ if (r && r.url) { return r.url; }
729
+ U.log('iptv', 'Stalker: no link for “' + c.name + '” (' + ((r && r.why) || 'no answer') + ')');
730
+ return '';
731
+ }, function (e) { U.log('iptv', 'Stalker: no link for “' + c.name + '” (' + U.problem(e) + ')'); return ''; }).then(function (url) {
732
+ if (!url && /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?\//i.test(c.url)) { return []; }
733
+ var st = plainStreams(c)[0];
734
+ st.url = url || c.url;
735
+ var h = U.sanitizeHeaders({ ua: STB_UA, ref: c.ref });
736
+ if (h) { st._headers = h; }
737
+ return [st];
738
+ });
739
+ }
740
+
646
741
  // A local addon object shaped like the HTTP addons in Stremio.loadAddons().
647
742
  // `__local` tells Stremio to route resource calls here instead of over HTTP.
648
743
  function synthAddon() {
@@ -661,6 +756,7 @@ var IPTV = (function () {
661
756
  getPlaylists: getPlaylists, addPlaylist: addPlaylist, updatePlaylist: updatePlaylist,
662
757
  removePlaylist: removePlaylist, renamePlaylist: renamePlaylist, setPlaylistOff: setPlaylistOff,
663
758
  movePlaylist: movePlaylist, setPlaylistGuide: setPlaylistGuide, label: labelOf,
759
+ macOf: macOf, stalkerPortal: stalkerPortal, stalkerCheck: stalkerCheck, addStalker: addStalker, isStalker: isStalker, stalkerAll: stalkerAll, setStalkerAll: setStalkerAll,
664
760
  xtreamParts: xtreamParts, xtreamUrl: xtreamUrl, xtreamCheck: xtreamCheck, addXtream: addXtream, xtreamFormat: xtreamFormat, setXtreamFormat: setXtreamFormat,
665
761
  isFavorite: isFavorite, setFavorite: setFavorite, refreshEvery: refreshEvery, setRefreshEvery: setRefreshEvery, readAt: readAt,
666
762
  channels: function () { return _cache ? _cache.channels : []; }, channel: function (id) { return _cache ? _cache.byId[id] || null : null; }, isEnabled: isEnabled, reset: reset, status: status,
package/js/player-core.js CHANGED
@@ -128,7 +128,7 @@ var PlayerParts = {};
128
128
  saveProgress();
129
129
  // (where you stopped to Trakt; past 80% nothing: Trakt takes no paused place there, and you
130
130
  // may come back)
131
- if (!S.isLive && !_creditsHandled && S.ctx && !S.ctx.trailer && !S.ctx.private && !isNotice() && S.cur > 60 && typeof Trakt !== 'undefined' && Trakt.onProgress &&
131
+ if (!S.isLive && !_creditsHandled && S.ctx && !S.ctx.trailer && !S.ctx.private && !isNotice() && !/^iptv:/.test(S.ctx.id || '') && S.cur > 60 && typeof Trakt !== 'undefined' && Trakt.onProgress &&
132
132
  !(S.dur > 0 && S.cur / S.dur >= 0.8)) {
133
133
  Trakt.onProgress(S.ctx.type, S.ctx.id, S.cur, S.dur, S.ctx.name);
134
134
  }
@@ -157,14 +157,14 @@ var PlayerParts = {};
157
157
 
158
158
  function isActive() { return S.active; }
159
159
 
160
- // fromTicker: the 5-second save while it plays: skipped when nothing moved since the last one
161
- // (paused); a stop, a leave or a jump always saves.
162
- var _savedSig = '';
160
+ // fromTicker: the save while it plays, at most every SAVE_EVERY_MS: skipped when nothing moved
161
+ // since the last one (paused); a stop, a leave or a jump always saves.
162
+ var _savedSig = '', _savedAt = 0, SAVE_EVERY_MS = 60000;
163
163
  function saveProgress(fromTicker) {
164
- if (!S.ctx || !S.dur || S.isLive || S.ctx.trailer || S.ctx.private || isNotice()) { return; } // (a notice clip, private viewing: nothing saved, nothing removed)
164
+ if (!S.ctx || !S.dur || S.isLive || S.ctx.trailer || S.ctx.private || isNotice() || /^iptv:/.test(S.ctx.id || '')) { return; } // (a notice clip, private viewing, a film in a playlist: nothing saved, nothing removed)
165
165
  var sig = progressKey(S.ctx) + '|' + Math.floor(S.cur) + '|' + Math.floor(S.dur);
166
- if (fromTicker && sig === _savedSig) { return; }
167
- _savedSig = sig;
166
+ if (fromTicker && (sig === _savedSig || Date.now() - _savedAt < SAVE_EVERY_MS)) { return; }
167
+ _savedSig = sig; _savedAt = Date.now();
168
168
  // Past the credits the episode is watched: its entry was removed and the next one
169
169
  // queued (handleCredits). Saving again would put it back next to the next episode.
170
170
  if (_creditsHandled) { return; }
@@ -433,7 +433,7 @@ var PlayerParts = {};
433
433
  if (U.crumb) { U.crumb('play ' + (ctx.type || '') + ' ' + (ctx.private ? '(private)' : /^file:/i.test(ctx.url || '') ? 'file .' + ('' + ctx.url).split('.').pop() : ('' + (ctx.url || '')).replace(/^https?:\/\/([^\/?#]+).*$/i, '$1'))); } // (Diagnostics, after an unexpected close)
434
434
  S.active = true; S.cur = 0; S.dur = 0; _bg = null; S.actual = null;
435
435
  // Stremio "tv" and "radio" types are strong live hints; refined after prepare.
436
- S.isLive = (ctx.type === 'tv' || ctx.type === 'radio') || /^iptv:/.test(ctx.id || '') || !!ctx.isLive; // (an IPTV channel: live, a sports one too)
436
+ S.isLive = !(ctx.stream && ctx.stream._vod) && ((ctx.type === 'tv' || ctx.type === 'radio') || /^iptv:/.test(ctx.id || '') || !!ctx.isLive); // (an IPTV channel: live, a sports one too; a film in a playlist isn't)
437
437
  formatStart(ctx);
438
438
  S.ctx.resumeSec = (ctx.trailer || ctx.fromStart) ? 0 : (ctx.resumeSec || getResume(ctx.type, ctx.id)); // (Play from start: 0:00)
439
439
 
@@ -580,7 +580,7 @@ var PlayerParts = {};
580
580
 
581
581
  // Decides live vs VOD from the reported duration (0 / non-finite = live).
582
582
  function markLiveFromDuration() {
583
- if (S.ctx && (S.ctx.type === 'tv' || S.ctx.type === 'radio' || /^iptv:/.test(S.ctx.id || ''))) { S.isLive = true; }
583
+ if (S.ctx && !(S.ctx.stream && S.ctx.stream._vod) && (S.ctx.type === 'tv' || S.ctx.type === 'radio' || /^iptv:/.test(S.ctx.id || ''))) { S.isLive = true; }
584
584
  if (!S.dur || S.dur <= 0 || !isFinite(S.dur)) { S.isLive = true; }
585
585
  }
586
586
 
@@ -142,7 +142,7 @@
142
142
  // ---------- progress (Continue Watching) ----------
143
143
  function progressAll() { return U.store.get(PROGRESS_KEY, {}); }
144
144
  function progressKey(ctx) { return ctx.type + ':' + ctx.id; }
145
- function writeProgress(all) { U.store.set(PROGRESS_KEY, all); }
145
+ function writeProgress(all) { U.store.set(PROGRESS_KEY, all, true); }
146
146
 
147
147
  // "Add to Continue Watching": list a title there without playing it. Also how
148
148
  // a show's next episode is queued (credits, marking episodes watched): like an added