stremiok 2.2.5 → 2.2.7
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 +16 -0
- package/README.md +2 -2
- package/config.xml +1 -1
- package/index.html +35 -34
- package/js/hubpreview.js +1 -1
- package/js/iptv.js +1 -1
- package/js/stremio.js +15 -6
- package/js/stvod.js +287 -0
- package/js/view-core.js +1 -0
- package/js/view-detail.js +2 -0
- package/js/view-guide.js +10 -7
- package/js/view-home.js +21 -7
- package/js/view-search.js +2 -2
- package/js/view-settings.js +31 -19
- package/js/ytplay.js +16 -1
- package/package.json +1 -1
- package/service/index.js +161 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.7 — 2026-11-03
|
|
7
|
+
- **A Stalker portal's films and series:** in the Movies and Series tabs, Discover by the
|
|
8
|
+
portal's categories, and Search; on titles from your addons, the portal's copy is a source
|
|
9
|
+
(*Stalker*). Experimental, like its channels.
|
|
10
|
+
- **Settings › Home**, a new group: *Start on*, *Titles in a Home row*, *Home bar preview*, *Menu*,
|
|
11
|
+
*Home feeds* and *Search results* moved there from Appearance, which keeps how StremioK looks.
|
|
12
|
+
|
|
13
|
+
## 2.2.6 — 2026-11-02
|
|
14
|
+
- **Watching:** a title saved without a poster, or whose poster no longer loads, shows its usual
|
|
15
|
+
poster instead of only its name, for titles already there too (#6). One still without a
|
|
16
|
+
poster: see [Troubleshooting](docs/TROUBLESHOOTING.md#home).
|
|
17
|
+
- **Start on** (Settings › Appearance): the tab StremioK opens on, any Home tab. Until you choose
|
|
18
|
+
one, Watching. The Guide opens once its TV guide is read.
|
|
19
|
+
- **Guide tab:** opened as StremioK starts, its channels no longer stay on *Loading…* until you
|
|
20
|
+
change tabs. OK on a channel still loading plays it.
|
|
21
|
+
|
|
6
22
|
## 2.2.5 — 2026-11-01
|
|
7
23
|
- **A Stalker portal's Channel groups** (OK on it, in Settings › Content › IPTV): tick the genres you
|
|
8
24
|
want and only those are read, however big the portal is.
|
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ 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, Xtream accounts (with their
|
|
35
|
-
|
|
34
|
+
- **IPTV and radio** from your M3U playlists, Xtream accounts and Stalker portals (with their
|
|
35
|
+
films and series), with CH+ / CH−.
|
|
36
36
|
- **YouTube:** live channels, trailers, and your own YouTube channels, playlists and searches,
|
|
37
37
|
with SponsorBlock, DeArrow, chapters and captions.
|
|
38
38
|
- **Local:** the videos on a USB drive, matched to their titles.
|
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.
|
|
3
|
+
id="http://stremiok.tizen/StremioKTizen" version="2.2.7" 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.
|
|
7
|
+
<link rel="stylesheet" href="css/style.css?v=2.2.7">
|
|
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,39 @@
|
|
|
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.
|
|
57
|
-
<script src="js/util.js?v=2.2.
|
|
58
|
-
<script src="js/iptv.js?v=2.2.
|
|
59
|
-
<script src="js/xtvod.js?v=2.2.
|
|
60
|
-
<script src="js/
|
|
61
|
-
<script src="js/
|
|
62
|
-
<script src="js/
|
|
63
|
-
<script src="js/
|
|
64
|
-
<script src="js/
|
|
65
|
-
<script src="js/
|
|
66
|
-
<script src="js/
|
|
67
|
-
<script src="js/
|
|
68
|
-
<script src="js/player-
|
|
69
|
-
<script src="js/player-
|
|
70
|
-
<script src="js/player-
|
|
71
|
-
<script src="js/player-
|
|
72
|
-
<script src="js/player-
|
|
73
|
-
<script src="js/player-
|
|
74
|
-
<script src="js/player.js?v=2.2.
|
|
75
|
-
<script src="js/
|
|
76
|
-
<script src="js/
|
|
77
|
-
<script src="js/
|
|
78
|
-
<script src="js/
|
|
79
|
-
<script src="js/
|
|
80
|
-
<script src="js/view-
|
|
81
|
-
<script src="js/view-
|
|
82
|
-
<script src="js/view-
|
|
83
|
-
<script src="js/view-
|
|
84
|
-
<script src="js/view-
|
|
85
|
-
<script src="js/view-
|
|
86
|
-
<script src="js/
|
|
87
|
-
<script src="js/
|
|
88
|
-
<script src="js/
|
|
56
|
+
<script src="js/polyfills.js?v=2.2.7"></script>
|
|
57
|
+
<script src="js/util.js?v=2.2.7"></script>
|
|
58
|
+
<script src="js/iptv.js?v=2.2.7"></script>
|
|
59
|
+
<script src="js/xtvod.js?v=2.2.7"></script>
|
|
60
|
+
<script src="js/stvod.js?v=2.2.7"></script>
|
|
61
|
+
<script src="js/epg.js?v=2.2.7"></script>
|
|
62
|
+
<script src="js/youtube.js?v=2.2.7"></script>
|
|
63
|
+
<script src="js/stremio.js?v=2.2.7"></script>
|
|
64
|
+
<script src="js/trakt.js?v=2.2.7"></script>
|
|
65
|
+
<script src="js/keys.js?v=2.2.7"></script>
|
|
66
|
+
<script src="js/focus.js?v=2.2.7"></script>
|
|
67
|
+
<script src="js/tvapps.js?v=2.2.7"></script>
|
|
68
|
+
<script src="js/player-core.js?v=2.2.7"></script>
|
|
69
|
+
<script src="js/player-store.js?v=2.2.7"></script>
|
|
70
|
+
<script src="js/player-lang.js?v=2.2.7"></script>
|
|
71
|
+
<script src="js/player-quality.js?v=2.2.7"></script>
|
|
72
|
+
<script src="js/player-subs.js?v=2.2.7"></script>
|
|
73
|
+
<script src="js/player-audio.js?v=2.2.7"></script>
|
|
74
|
+
<script src="js/player-controls.js?v=2.2.7"></script>
|
|
75
|
+
<script src="js/player.js?v=2.2.7"></script>
|
|
76
|
+
<script src="js/ytplay.js?v=2.2.7"></script>
|
|
77
|
+
<script src="js/local.js?v=2.2.7"></script>
|
|
78
|
+
<script src="js/downloads.js?v=2.2.7"></script>
|
|
79
|
+
<script src="js/stremio-account.js?v=2.2.7"></script>
|
|
80
|
+
<script src="js/view-core.js?v=2.2.7"></script>
|
|
81
|
+
<script src="js/view-home.js?v=2.2.7"></script>
|
|
82
|
+
<script src="js/view-guide.js?v=2.2.7"></script>
|
|
83
|
+
<script src="js/view-detail.js?v=2.2.7"></script>
|
|
84
|
+
<script src="js/view-search.js?v=2.2.7"></script>
|
|
85
|
+
<script src="js/view-settings.js?v=2.2.7"></script>
|
|
86
|
+
<script src="js/view-discover.js?v=2.2.7"></script>
|
|
87
|
+
<script src="js/views.js?v=2.2.7"></script>
|
|
88
|
+
<script src="js/app.js?v=2.2.7"></script>
|
|
89
|
+
<script src="js/hubpreview.js?v=2.2.7"></script>
|
|
89
90
|
</body>
|
|
90
91
|
</html>
|
package/js/hubpreview.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
(service/preview.js), which hands them to the TV: when StremioK opens (once the shows'
|
|
4
4
|
episodes are current) and when it's left (the TV's Home), only when they changed, and at
|
|
5
5
|
most once every 10 minutes, as Samsung asks. A tile picked on the home bar opens StremioK
|
|
6
|
-
on that title, on its episode. Off (Settings ›
|
|
6
|
+
on that title, on its episode. Off (Settings › Home › Home bar preview): the row
|
|
7
7
|
emptied. The sideloaded app only: TizenBrew runs no such service. Global namespace: HubPreview */
|
|
8
8
|
var HubPreview = (function () {
|
|
9
9
|
'use strict';
|
package/js/iptv.js
CHANGED
|
@@ -774,7 +774,7 @@ var IPTV = (function () {
|
|
|
774
774
|
getPlaylists: getPlaylists, addPlaylist: addPlaylist, updatePlaylist: updatePlaylist,
|
|
775
775
|
removePlaylist: removePlaylist, renamePlaylist: renamePlaylist, setPlaylistOff: setPlaylistOff,
|
|
776
776
|
movePlaylist: movePlaylist, setPlaylistGuide: setPlaylistGuide, label: labelOf,
|
|
777
|
-
macOf: macOf, stalkerPortal: stalkerPortal, stalkerCheck: stalkerCheck, addStalker: addStalker, isStalker: isStalker, stalkerAll: stalkerAll, setStalkerAll: setStalkerAll, stalkerGroups: stalkerGroups, setStalkerGroups: setStalkerGroups,
|
|
777
|
+
macOf: macOf, stbUa: STB_UA, stalkerPortal: stalkerPortal, stalkerCheck: stalkerCheck, addStalker: addStalker, isStalker: isStalker, stalkerAll: stalkerAll, setStalkerAll: setStalkerAll, stalkerGroups: stalkerGroups, setStalkerGroups: setStalkerGroups,
|
|
778
778
|
xtreamParts: xtreamParts, xtreamUrl: xtreamUrl, xtreamCheck: xtreamCheck, addXtream: addXtream, xtreamFormat: xtreamFormat, setXtreamFormat: setXtreamFormat,
|
|
779
779
|
isFavorite: isFavorite, setFavorite: setFavorite, refreshEvery: refreshEvery, setRefreshEvery: setRefreshEvery, readAt: readAt,
|
|
780
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
|
@@ -163,7 +163,7 @@ var Stremio = (function () {
|
|
|
163
163
|
var p = U.store.get(PREFS_KEY, {}) || {};
|
|
164
164
|
return { posterShape: p.posterShape || 'portrait', accent: p.accent || 'indigo', bg: p.bg || 'dark',
|
|
165
165
|
zoom: [110, 120, 130, 140].indexOf(p.zoom) !== -1 ? p.zoom : 100, // Settings > Appearance: everything bigger (percent)
|
|
166
|
-
rowCards: p.rowCards === 'all' || [50, 100, 200].indexOf(p.rowCards) !== -1 ? p.rowCards : 30, // Settings >
|
|
166
|
+
rowCards: p.rowCards === 'all' || [50, 100, 200].indexOf(p.rowCards) !== -1 ? p.rowCards : 30, // Settings > Home: titles in a Home row ('all': Unlimited)
|
|
167
167
|
formatsAuto: p.formatsAuto !== false, // Settings > Formats: mark "Not working" on its own
|
|
168
168
|
allowLocal: p.allowLocal === true, // Settings > Addons: home-network links from internet addons
|
|
169
169
|
addonWait: ADDON_WAITS.indexOf(p.addonWait) !== -1 ? p.addonWait : 0, // Settings > Addons: seconds to wait for an addon (0: Normal)
|
|
@@ -175,10 +175,11 @@ var Stremio = (function () {
|
|
|
175
175
|
nextOnFail: p.nextOnFail !== false, // Settings > Source ranking: a source that doesn't start gives way to the next
|
|
176
176
|
sizeLimits: { movie: sizeLimits(p.sizeLimits, 'movie'), series: sizeLimits(p.sizeLimits, 'series') }, // Settings > Source ranking (GB; 0: none)
|
|
177
177
|
posterRatings: p.posterRatings === true, // Settings > Appearance: IMDb rating on cards
|
|
178
|
-
homePreview: p.homePreview !== false, // Settings >
|
|
178
|
+
homePreview: p.homePreview !== false, // Settings > Home: Continue Watching on the TV's home bar (js/hubpreview.js)
|
|
179
179
|
homePreviewOrder: p.homePreviewOrder === 'watching' ? 'watching' : 'recent', // ...its tiles: the latest first, or as in Watching
|
|
180
|
-
hiddenTabs: wordList(p.hiddenTabs, 20, 20), // Settings >
|
|
180
|
+
hiddenTabs: wordList(p.hiddenTabs, 20, 20), // Settings > Home > 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 > Home > 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
|
}
|
|
@@ -432,10 +433,11 @@ var Stremio = (function () {
|
|
|
432
433
|
if (m) { addons.push({ url: url, base: baseOf(url), manifest: m }); }
|
|
433
434
|
});
|
|
434
435
|
// Prepend so the IPTV rows sort first on Home (reorder them in Settings >
|
|
435
|
-
//
|
|
436
|
+
// Home > Home feeds; there's no cap on how many rows or feeds).
|
|
436
437
|
if (iptvNow) { addons.unshift(IPTV.synthAddon()); }
|
|
437
438
|
else if (iptvOn) { iptvJoin(addons, rev); }
|
|
438
439
|
if (typeof XtVod !== 'undefined' && XtVod.isEnabled()) { addons.push(XtVod.synthAddon()); } // (your Xtream accounts' films and series: after your addons)
|
|
440
|
+
if (typeof StVod !== 'undefined' && StVod.isEnabled()) { addons.push(StVod.synthAddon()); } // (your Stalker portals' films and series)
|
|
439
441
|
if (hasYouTube()) { addons.push(YouTube.synthAddon()); } // (after your addons: its rows last on Home)
|
|
440
442
|
if (typeof Trakt !== 'undefined' && Trakt.isConnected()) { addons.push(Trakt.synthAddon()); } // (your Watchlist and Up next)
|
|
441
443
|
_loaded = addons;
|
|
@@ -521,6 +523,7 @@ var Stremio = (function () {
|
|
|
521
523
|
}
|
|
522
524
|
if (typeof XtVod !== 'undefined' && XtVod.onVodChange) { XtVod.onVodChange(iptvRebuild); }
|
|
523
525
|
if (typeof XtVod !== 'undefined' && XtVod.onChange) { XtVod.onChange(function () { sourcesChanged(); }); } // (its list read: its copies, on titles asked before)
|
|
526
|
+
if (typeof StVod !== 'undefined' && StVod.onChange) { StVod.onChange(function () { sourcesChanged(); }); } // (a portal's films and series: its copies too)
|
|
524
527
|
function iptvReload(id) {
|
|
525
528
|
configChanged();
|
|
526
529
|
return _hasIptv ? IPTV.reload(id) : Promise.resolve(null);
|
|
@@ -839,7 +842,7 @@ var Stremio = (function () {
|
|
|
839
842
|
function setPlayedFirst(on) { var g = getRanking(); g.played = !!on; saveRanking(g); }
|
|
840
843
|
function resetRanking() { U.store.remove(RANKING_KEY); }
|
|
841
844
|
|
|
842
|
-
function listCatalogsOrdered() { return homeFeeds.ordered(); } // (Settings >
|
|
845
|
+
function listCatalogsOrdered() { return homeFeeds.ordered(); } // (Settings > Home > Home feeds)
|
|
843
846
|
function catalogsForHome() { return homeFeeds.visible(); } // ordered + shown (the Home rows)
|
|
844
847
|
function moveFeed(key, dir) { return homeFeeds.move(key, dir); }
|
|
845
848
|
function toggleFeed(key) { homeFeeds.toggle(key); }
|
|
@@ -892,6 +895,9 @@ var Stremio = (function () {
|
|
|
892
895
|
if (/^xv[ms]\./.test(id) && typeof XtVod !== 'undefined') {
|
|
893
896
|
return XtVod.meta(type, id).then(function (m) { if (!m) { throw new Error('Not found on the Xtream server'); } return m; });
|
|
894
897
|
}
|
|
898
|
+
if (/^sv[ms]\./.test(id) && typeof StVod !== 'undefined') {
|
|
899
|
+
return StVod.meta(type, id).then(function (m) { if (!m) { throw new Error('Not found on the Stalker portal'); } return m; });
|
|
900
|
+
}
|
|
895
901
|
if (/^iptv:/.test(id)) {
|
|
896
902
|
return IPTV.meta(id).then(function (m) {
|
|
897
903
|
if (!m) { throw new Error('IPTV channel not found'); }
|
|
@@ -962,6 +968,9 @@ var Stremio = (function () {
|
|
|
962
968
|
if (/^xv[ms]\./.test(id) && typeof XtVod !== 'undefined') { // (an Xtream account's own film or episode)
|
|
963
969
|
return XtVod.streams(type, id).then(function (l) { l.forEach(function (s) { s._addon = 'Xtream'; }); if (onUpdate) { onUpdate(l, 0); } return l; });
|
|
964
970
|
}
|
|
971
|
+
if (/^sv[ms]\./.test(id) && typeof StVod !== 'undefined') { // (a Stalker portal's own film or episode)
|
|
972
|
+
return StVod.streams(type, id).then(function (l) { l.forEach(function (s) { s._addon = 'Stalker'; }); if (onUpdate) { onUpdate(l, 0); } return l; });
|
|
973
|
+
}
|
|
965
974
|
var key = type + ':' + id, e = _streamCache[key];
|
|
966
975
|
if (e && !force && (e.pending > 0 || Date.now() - e.at < STREAM_TTL)) {
|
|
967
976
|
syncLocal(e, type, id); // (the addons' answers kept; the USB drive's matches as they are now)
|
|
@@ -1854,7 +1863,7 @@ var Stremio = (function () {
|
|
|
1854
1863
|
// What Search asks, as the Search rows: one source per catalog that can search, named
|
|
1855
1864
|
// like its Home feed ("Series · Popular · Cinemeta"; a catalog just called "Search"
|
|
1856
1865
|
// goes by its type and addon), and IPTV's groups as one source per type. Sources are
|
|
1857
|
-
// ordered and shown / hidden in Settings >
|
|
1866
|
+
// ordered and shown / hidden in Settings > Home > Search results.
|
|
1858
1867
|
function searchSources() {
|
|
1859
1868
|
return getSearchCatalogs().then(function (cats) {
|
|
1860
1869
|
var out = [], local = {};
|
package/js/stvod.js
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/* Stalker films and series. Global namespace: StVod
|
|
2
|
+
A Stalker portal's (your IPTV playlists') films and series, as a local addon like Xtream's
|
|
3
|
+
(js/xtvod.js): a Movies and a Series catalog per portal (its categories as genres; none: the
|
|
4
|
+
newest; search), their pages and sources, and, on titles from your addons, the portal's copies
|
|
5
|
+
(found by a search of it when a title's sources are asked). All of it through StremioK's
|
|
6
|
+
service, which asks as a MAG box does (see service/index.js, /stalker/vod; YTPlay.stalkerVod).
|
|
7
|
+
A source is the service's link that asks the portal for the title's own when it's played
|
|
8
|
+
(/stalker/play): nothing is asked of the portal before, and the link saved to resume stays good.
|
|
9
|
+
Ids: svm.<portal>.<id> (a film), svs.<portal>.<id> (a series; svs.<portal>.v.<id>: a film the
|
|
10
|
+
portal marks as a series; its episodes svs.<portal>.<id>:<season>:<episode>, as other addons'
|
|
11
|
+
tt…:1:2). */
|
|
12
|
+
var StVod = (function () {
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
var CATS_KEY = 'stremiok.stvod.cats', SEEN_KEY = 'stremiok.stvod.seen', CATS_FRESH_MS = 86400000, CATS_RETRY_MS = 6 * 3600000, SEEN_MAX = 200;
|
|
16
|
+
function enc(v) { return encodeURIComponent('' + v); }
|
|
17
|
+
|
|
18
|
+
// The Stalker portals among your playlists (switched on): { id, label, url, mac }.
|
|
19
|
+
function accounts() {
|
|
20
|
+
if (typeof IPTV === 'undefined' || !IPTV.isStalker) { return []; }
|
|
21
|
+
return IPTV.getPlaylists().filter(function (p) { return !p.off && IPTV.isStalker(p); }).map(function (p) {
|
|
22
|
+
return { id: p.id, label: IPTV.label(p.id), url: p.url, mac: p.mac };
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function account(id) {
|
|
26
|
+
var l = accounts();
|
|
27
|
+
for (var i = 0; i < l.length; i++) { if (l[i].id === id) { return l[i]; } }
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
// The service's answer ({ why }: an error).
|
|
31
|
+
function ask(acc, more) {
|
|
32
|
+
if (typeof YTPlay === 'undefined' || !YTPlay.stalkerVod) { return Promise.reject(new Error('Stalker portals are read by StremioK’s service (not in a desktop browser)')); }
|
|
33
|
+
return YTPlay.stalkerVod(acc.url, acc.mac, more).then(function (r) {
|
|
34
|
+
if (!r || r.why) { throw new Error((r && r.why) || 'no answer'); }
|
|
35
|
+
return r;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ---- Categories: Discover's genres, kept a day (U.store), read again in the background ----
|
|
40
|
+
// What's kept follows the portal's address and MAC: either edited, the old one's aren't its own.
|
|
41
|
+
var _cats = null, _catsAsked = {}, _changeFns = [], _reloaded = {};
|
|
42
|
+
function onChange(fn) { _changeFns.push(fn); } // (catalogs added or gone once its categories came)
|
|
43
|
+
function changed() { _changeFns.forEach(function (fn) { try { fn(); } catch (e) {} }); }
|
|
44
|
+
function sigOf(acc) { return acc.id + '|' + acc.url + '|' + acc.mac; }
|
|
45
|
+
function catsAll() {
|
|
46
|
+
if (!_cats) { var c = U.store.get(CATS_KEY, {}); _cats = c && typeof c === 'object' && !Array.isArray(c) ? c : {}; }
|
|
47
|
+
return _cats;
|
|
48
|
+
}
|
|
49
|
+
function known(acc) { var c = catsAll()[acc.id]; return c && c.sig === sigOf(acc) ? c : null; }
|
|
50
|
+
function catsOf(acc, type) { var c = known(acc); return c && Array.isArray(c[type]) ? c[type] : []; }
|
|
51
|
+
// A portal with films or series of that type (either, without one), or whose categories
|
|
52
|
+
// haven't come yet. One that lists none adds nothing: no catalogs, no copies.
|
|
53
|
+
function hasVod(acc, type) {
|
|
54
|
+
var c = known(acc);
|
|
55
|
+
if (!c) { return !type; }
|
|
56
|
+
return type ? catsOf(acc, type).length > 0 : !c.none;
|
|
57
|
+
}
|
|
58
|
+
function isEnabled() { return accounts().some(function (acc) { return hasVod(acc); }); }
|
|
59
|
+
function catList(r) {
|
|
60
|
+
return (r && Array.isArray(r.cats) ? r.cats : []).filter(function (c) { return c && c.id && c.title; }).slice(0, 1000).map(function (c) { return [('' + c.id).slice(0, 40), ('' + c.title).slice(0, 80)]; });
|
|
61
|
+
}
|
|
62
|
+
function refreshCats() {
|
|
63
|
+
accounts().forEach(function (acc) {
|
|
64
|
+
var c = known(acc), sk = sigOf(acc);
|
|
65
|
+
if ((c && Date.now() - c.at < (c.none ? CATS_RETRY_MS : CATS_FRESH_MS)) || _catsAsked[sk]) { return; }
|
|
66
|
+
_catsAsked[sk] = true; // (once a launch: a portal that didn't answer is asked again at the next)
|
|
67
|
+
function either(p) { return p.then(null, function (e) { return { failed: e }; }); }
|
|
68
|
+
Promise.all([either(ask(acc, '&type=movie&do=cats')), either(ask(acc, '&type=series&do=cats'))]).then(function (r) {
|
|
69
|
+
if (r[0].failed && r[1].failed) { U.log('iptv', 'Stalker “' + acc.label + '”: its films and series couldn’t be read (' + U.problem(r[0].failed) + ')'); return; }
|
|
70
|
+
var all = catsAll(), keep = {}, o = { sig: sk, movie: catList(r[0]), series: catList(r[1]), at: Date.now() };
|
|
71
|
+
if (!o.movie.length && !o.series.length) { o.none = true; U.log('iptv', 'Stalker “' + acc.label + '”: no films or series'); }
|
|
72
|
+
accounts().forEach(function (a) { if (all[a.id]) { keep[a.id] = all[a.id]; } }); // (portals gone: dropped)
|
|
73
|
+
keep[acc.id] = o;
|
|
74
|
+
_cats = keep;
|
|
75
|
+
U.store.set(CATS_KEY, keep);
|
|
76
|
+
var before = _addon ? _addon.manifest.catalogs.length : 0;
|
|
77
|
+
fillCatalogs();
|
|
78
|
+
if (_addon && (_addon.manifest.catalogs.length !== before || _reloaded[acc.id])) { changed(); } // (its rows: Home reads them now)
|
|
79
|
+
delete _reloaded[acc.id];
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// Reload on a portal (Settings › Content › IPTV): its categories asked again now.
|
|
84
|
+
function reload(id) {
|
|
85
|
+
var acc = account(id), all = catsAll();
|
|
86
|
+
if (!acc) { return; }
|
|
87
|
+
delete all[id];
|
|
88
|
+
U.store.set(CATS_KEY, all);
|
|
89
|
+
_catsAsked[sigOf(acc)] = false;
|
|
90
|
+
_seasons.clear();
|
|
91
|
+
_reloaded[id] = true;
|
|
92
|
+
refreshCats();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ---- The addon ----
|
|
96
|
+
var _addon = null;
|
|
97
|
+
function catalogsNow() {
|
|
98
|
+
var out = [];
|
|
99
|
+
accounts().forEach(function (acc) {
|
|
100
|
+
['movie', 'series'].forEach(function (type) {
|
|
101
|
+
if (!hasVod(acc, type)) { return; }
|
|
102
|
+
out.push({ type: type, id: 'sv.' + acc.id + '.' + type, name: acc.label,
|
|
103
|
+
extra: [{ name: 'genre', options: catsOf(acc, type).map(function (c) { return c[1]; }) }, { name: 'search' }, { name: 'skip' }] });
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return out;
|
|
107
|
+
}
|
|
108
|
+
var RESOURCES = ['catalog', { name: 'stream', types: ['movie', 'series'], idPrefixes: ['tt', 'tmdb:'] }];
|
|
109
|
+
function fillCatalogs() { // (changed in place: the loaded addon holds the same list)
|
|
110
|
+
if (!_addon) { return; }
|
|
111
|
+
var l = _addon.manifest.catalogs;
|
|
112
|
+
l.splice.apply(l, [0, l.length].concat(catalogsNow()));
|
|
113
|
+
_addon.manifest.resources = accounts().some(function (acc) { return hasVod(acc, 'movie') || hasVod(acc, 'series'); }) ? RESOURCES : ['catalog'];
|
|
114
|
+
}
|
|
115
|
+
function synthAddon() {
|
|
116
|
+
if (!_addon) {
|
|
117
|
+
_addon = { __local: true, __impl: StVod, __sources: true, url: 'local:stvod', base: 'local:stvod',
|
|
118
|
+
manifest: { id: 'org.stremiok.stvod', name: 'Stalker', version: '1.0.0', types: ['movie', 'series'], resources: RESOURCES, catalogs: [] } };
|
|
119
|
+
}
|
|
120
|
+
fillCatalogs();
|
|
121
|
+
refreshCats();
|
|
122
|
+
return _addon;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ---- Titles: a card, and what the portal said of it (its cmd: what plays it) ----
|
|
126
|
+
// Kept while StremioK runs; a title whose page was opened, also for the next launches (SEEN_MAX
|
|
127
|
+
// of them: Continue Watching's open their pages again).
|
|
128
|
+
var _items = U.lru(600);
|
|
129
|
+
function slim(it) { var o = { name: it.name }; ['year', 'pic', 'cmd', 'rating', 'series'].forEach(function (k) { if (it[k]) { o[k] = it[k]; } }); return o; }
|
|
130
|
+
function seenAll() { var a = U.store.get(SEEN_KEY, []); return Array.isArray(a) ? a : []; }
|
|
131
|
+
function remember(id, it) {
|
|
132
|
+
var all = seenAll().filter(function (x) { return x && x[0] !== id; });
|
|
133
|
+
all.push([id, slim(it)]);
|
|
134
|
+
U.store.set(SEEN_KEY, all.slice(-SEEN_MAX));
|
|
135
|
+
}
|
|
136
|
+
function recall(id) {
|
|
137
|
+
var it = _items.get(id);
|
|
138
|
+
if (it) { return it; }
|
|
139
|
+
var all = seenAll();
|
|
140
|
+
for (var i = all.length - 1; i >= 0; i--) { if (all[i] && all[i][0] === id && all[i][1] && all[i][1].name) { return all[i][1]; } }
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
function idOf(acc, type, it) {
|
|
144
|
+
var series = type === 'series' || !!it.series;
|
|
145
|
+
return (series ? 'svs.' : 'svm.') + acc.id + '.' + (type === 'movie' && it.series ? 'v.' : '') + it.id;
|
|
146
|
+
}
|
|
147
|
+
function cardOf(acc, type, it) {
|
|
148
|
+
if (!it || !it.id || !it.name) { return null; }
|
|
149
|
+
var id = idOf(acc, type, it), m = { id: id, type: /^svs\./.test(id) ? 'series' : 'movie', name: it.name, posterShape: 'poster' };
|
|
150
|
+
if (it.pic) { m.poster = it.pic; }
|
|
151
|
+
if (it.rating > 0) { m.imdbRating = (+it.rating).toFixed(1); }
|
|
152
|
+
if (it.year) { m.releaseInfo = '' + it.year; }
|
|
153
|
+
if (it.desc) { m.description = it.desc; }
|
|
154
|
+
_items.set(id, it);
|
|
155
|
+
return m;
|
|
156
|
+
}
|
|
157
|
+
function catalog(catId, extra) {
|
|
158
|
+
var m = /^sv\.([^.]+)\.(movie|series)$/.exec(catId || ''), acc = m && account(m[1]);
|
|
159
|
+
if (!acc) { return Promise.resolve([]); }
|
|
160
|
+
var type = m[2], skip = extra && extra.skip ? (parseInt(extra.skip, 10) || 0) : 0, cat = '*';
|
|
161
|
+
if (extra && extra.genre) {
|
|
162
|
+
var c = catsOf(acc, type).filter(function (x) { return x[1] === extra.genre; })[0];
|
|
163
|
+
if (!c) { return Promise.resolve([]); }
|
|
164
|
+
cat = c[0];
|
|
165
|
+
}
|
|
166
|
+
var more = '&type=' + type + '&do=list&cat=' + enc(cat) + (extra && extra.search ? '&q=' + enc(('' + extra.search).slice(0, 120)) : '') + (skip ? '&skip=' + skip : '');
|
|
167
|
+
return ask(acc, more).then(function (r) {
|
|
168
|
+
return (Array.isArray(r.items) ? r.items : []).map(function (it) { return cardOf(acc, type, it); }).filter(Boolean);
|
|
169
|
+
}, function (e) {
|
|
170
|
+
U.log('iptv', 'Stalker “' + acc.label + '”: its ' + (type === 'movie' ? 'films' : 'series') + ' couldn’t be read (' + U.problem(e) + ')');
|
|
171
|
+
return [];
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// ---- A title's page ----
|
|
176
|
+
function parseId(id) {
|
|
177
|
+
var m = /^sv([ms])\.([^.]+)\.(v\.)?([\w-]+)(?::(\d+):(\d+))?$/.exec('' + id);
|
|
178
|
+
if (!m) { return null; }
|
|
179
|
+
var x = { kind: m[1], acc: account(m[2]), vod: !!m[3], num: m[4], season: m[5] != null ? +m[5] : null, episode: m[6] != null ? +m[6] : null };
|
|
180
|
+
x.base = 'sv' + x.kind + '.' + m[2] + '.' + (x.vod ? 'v.' : '') + x.num;
|
|
181
|
+
return x;
|
|
182
|
+
}
|
|
183
|
+
// A series' seasons, as the service lists them ({ season, name, cmd, eps: [{ n, cmd?, name? }] }).
|
|
184
|
+
var _seasons = U.lru(20);
|
|
185
|
+
function seasons(acc, x) {
|
|
186
|
+
var k = sigOf(acc) + '|' + x.base, kept = _seasons.get(k);
|
|
187
|
+
if (kept) { return kept; }
|
|
188
|
+
var p = ask(acc, '&type=series&do=seasons&id=' + enc(x.num) + (x.vod ? '&via=vod' : '')).then(function (r) { return Array.isArray(r.seasons) ? r.seasons : []; });
|
|
189
|
+
_seasons.set(k, p);
|
|
190
|
+
p.then(null, function () { if (_seasons.get(k) === p) { _seasons.set(k, null); } });
|
|
191
|
+
return p;
|
|
192
|
+
}
|
|
193
|
+
function list(v) { return ('' + (v || '')).split(/\s*,\s*/).map(function (s) { return s.trim(); }).filter(Boolean).slice(0, 12); }
|
|
194
|
+
function details(m, it) {
|
|
195
|
+
if (it.pic) { m.poster = it.pic; }
|
|
196
|
+
if (it.desc) { m.description = it.desc; }
|
|
197
|
+
if (list(it.genres).length) { m.genres = list(it.genres); }
|
|
198
|
+
if (list(it.cast).length) { m.cast = list(it.cast); }
|
|
199
|
+
if (list(it.director).length) { m.director = list(it.director); }
|
|
200
|
+
if (it.rating > 0) { m.imdbRating = (+it.rating).toFixed(1); }
|
|
201
|
+
if (it.mins > 0) { m.runtime = it.mins + ' min'; }
|
|
202
|
+
if (it.year) { m.releaseInfo = '' + it.year; m.year = '' + it.year; }
|
|
203
|
+
return m;
|
|
204
|
+
}
|
|
205
|
+
function meta(type, id) {
|
|
206
|
+
var x = parseId(id);
|
|
207
|
+
if (!x || !x.acc) { return Promise.resolve(null); }
|
|
208
|
+
var it = recall(x.base);
|
|
209
|
+
if (x.kind === 'm') {
|
|
210
|
+
if (!it) { return Promise.resolve(null); }
|
|
211
|
+
remember(x.base, it);
|
|
212
|
+
return Promise.resolve(details({ id: x.base, type: 'movie', name: it.name, _from: x.acc.label }, it));
|
|
213
|
+
}
|
|
214
|
+
return seasons(x.acc, x).then(function (l) {
|
|
215
|
+
if (!it && !l.length) { return null; }
|
|
216
|
+
if (it) { remember(x.base, it); }
|
|
217
|
+
var m = details({ id: x.base, type: 'series', name: it ? it.name : 'Series', _from: x.acc.label }, it || {});
|
|
218
|
+
m.videos = [];
|
|
219
|
+
l.forEach(function (se) {
|
|
220
|
+
(se.eps || []).forEach(function (ep) { m.videos.push({ id: x.base + ':' + se.season + ':' + ep.n, season: se.season, episode: ep.n, title: ep.name || 'Episode ' + ep.n }); });
|
|
221
|
+
});
|
|
222
|
+
return m;
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ---- Sources ----
|
|
227
|
+
function source(acc, url, name) {
|
|
228
|
+
var st = { url: url, name: 'Stalker', title: ('' + name).trim() + '\n' + acc.label, _stvod: true }, h = U.sanitizeHeaders({ ua: IPTV.stbUa });
|
|
229
|
+
if (h) { st._headers = h; }
|
|
230
|
+
return st;
|
|
231
|
+
}
|
|
232
|
+
function playUrl(acc, cmd, ep) {
|
|
233
|
+
if (typeof YTPlay === 'undefined' || !YTPlay.stalkerPlayUrl) { return Promise.reject(new Error('no service')); }
|
|
234
|
+
return YTPlay.stalkerPlayUrl(acc.url, acc.mac, cmd, ep);
|
|
235
|
+
}
|
|
236
|
+
function filmSource(acc, it) {
|
|
237
|
+
if (!it || !it.cmd) { return Promise.resolve(null); }
|
|
238
|
+
return playUrl(acc, it.cmd, -1).then(function (u) { return source(acc, u, it.name); }, function () { return null; });
|
|
239
|
+
}
|
|
240
|
+
function two(n) { return (n < 10 ? '0' : '') + n; }
|
|
241
|
+
function episodeSource(acc, x, season, episode, name) {
|
|
242
|
+
return seasons(acc, x).then(function (l) {
|
|
243
|
+
var se = l.filter(function (s) { return s.season === season; })[0], ep = se && (se.eps || []).filter(function (e) { return e.n === episode; })[0];
|
|
244
|
+
if (!ep || !(ep.cmd || se.cmd)) { return null; }
|
|
245
|
+
return playUrl(acc, ep.cmd || se.cmd, ep.cmd ? -1 : episode).then(function (u) { return source(acc, u, (name || '') + ' S' + two(season) + 'E' + two(episode)); });
|
|
246
|
+
}).then(null, function () { return null; });
|
|
247
|
+
}
|
|
248
|
+
// A title's sources: its own (svm / svs ids), or, for a title from your addons, each portal's
|
|
249
|
+
// copies (m: its details, for its name and year), found by a search of the portal.
|
|
250
|
+
function streams(type, id, m) {
|
|
251
|
+
var x = parseId(id);
|
|
252
|
+
if (x) {
|
|
253
|
+
if (!x.acc) { return Promise.resolve([]); }
|
|
254
|
+
var it = recall(x.base);
|
|
255
|
+
var p = x.kind === 'm' ? filmSource(x.acc, it) : x.season != null ? episodeSource(x.acc, x, x.season, x.episode, it ? it.name : '') : Promise.resolve(null);
|
|
256
|
+
return p.then(function (s) { return s ? [s] : []; });
|
|
257
|
+
}
|
|
258
|
+
return matches(type, id, m);
|
|
259
|
+
}
|
|
260
|
+
// A name to match: no accents, brackets, year at the end, quality words or punctuation.
|
|
261
|
+
var WORDS = /\b(4k|uhd|fhd|hd|sd|hdr|hevc|x265|h265|1080p|720p|2160p|multi|sub|subs|dub|dubbed|latino|castellano)\b/g;
|
|
262
|
+
function keyOf(name) {
|
|
263
|
+
var s = ('' + (name || '')).toLowerCase();
|
|
264
|
+
if (s.normalize) { s = s.normalize('NFD').replace(/[̀-ͯ]/g, ''); }
|
|
265
|
+
return s.replace(/\([^()]*\)|\[[^\[\]]*\]/g, ' ').replace(WORDS, ' ').trim().replace(/\b(19|20)\d{2}$/, ' ').replace(/&/g, ' and ').replace(/[^a-z0-9]+/g, ' ').trim();
|
|
266
|
+
}
|
|
267
|
+
function yearOf(v) { var y = parseInt(('' + (v || '')).slice(0, 4), 10); return y > 1880 && y < 2100 ? y : 0; }
|
|
268
|
+
function matches(type, id, m) {
|
|
269
|
+
var parts = ('' + id).split(':'), season = type === 'series' ? parseInt(parts[parts.length - 2], 10) : null, episode = type === 'series' ? parseInt(parts[parts.length - 1], 10) : null;
|
|
270
|
+
if (type === 'series' && !(season >= 0 && episode >= 0)) { return Promise.resolve([]); }
|
|
271
|
+
var name = m && m.name ? '' + m.name : '', year = m ? yearOf(m.year || m.releaseInfo || m.released) : 0, k = keyOf(name);
|
|
272
|
+
if (!k) { return Promise.resolve([]); }
|
|
273
|
+
return Promise.all(accounts().filter(function (acc) { return hasVod(acc, type); }).map(function (acc) {
|
|
274
|
+
return ask(acc, '&type=' + type + '&do=list&q=' + enc(name.slice(0, 120))).then(function (r) {
|
|
275
|
+
var hits = (Array.isArray(r.items) ? r.items : []).filter(function (it) {
|
|
276
|
+
return it && keyOf(it.name) === k && (type === 'series' || !it.series) && (!year || !it.year || Math.abs(it.year - year) <= (type === 'series' ? 0 : 1));
|
|
277
|
+
}).slice(0, 2);
|
|
278
|
+
return Promise.all(hits.map(function (it) {
|
|
279
|
+
var card = cardOf(acc, type, it); // (kept: what plays it)
|
|
280
|
+
return type === 'movie' ? filmSource(acc, it) : episodeSource(acc, parseId(card.id), season, episode, it.name);
|
|
281
|
+
}));
|
|
282
|
+
}, function () { return []; });
|
|
283
|
+
})).then(function (all) { return [].concat.apply([], all).filter(Boolean); });
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return { accounts: accounts, isEnabled: isEnabled, onChange: onChange, reload: reload, synthAddon: synthAddon, catalog: catalog, meta: meta, streams: streams, refreshCats: refreshCats };
|
|
287
|
+
})();
|
package/js/view-core.js
CHANGED
|
@@ -365,6 +365,7 @@ var ViewParts = {};
|
|
|
365
365
|
closeModal();
|
|
366
366
|
U.toast('Reloading playlist…', 4000);
|
|
367
367
|
if (typeof XtVod !== 'undefined' && XtVod.reload) { XtVod.reload(playlist.id); } // (an Xtream account: its films and series too)
|
|
368
|
+
if (typeof StVod !== 'undefined' && StVod.reload) { StVod.reload(playlist.id); } // (a Stalker portal: the same)
|
|
368
369
|
Stremio.iptvReload(playlist.id).then(function () {
|
|
369
370
|
refreshAddonRows('local:iptv');
|
|
370
371
|
var st = Stremio.iptvStatus(playlist.id);
|
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
|
|
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 (
|
|
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
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
function hasLocal() { return typeof LocalMedia !== 'undefined' && LocalMedia.present(); }
|
|
36
36
|
function hasGuide() { return typeof EPG !== 'undefined' && !!EPG.hasAny && EPG.hasAny(); }
|
|
37
37
|
|
|
38
|
-
// The top menu's order (Settings ›
|
|
38
|
+
// The top menu's order (Settings › Home › Menu): Watching first and Settings last, the
|
|
39
39
|
// rest (the tabs, Discover, Search) in yours. A saved order is kept as far as it goes: an
|
|
40
40
|
// item it doesn't have (one added since) goes after the one it usually follows, and one
|
|
41
41
|
// that no longer exists is dropped.
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
|
|
73
73
|
// Which tabs to show in the top menu (needs the home catalogs; falls back to the
|
|
74
74
|
// standard set before they've loaded so the menu is consistent everywhere).
|
|
75
|
-
// Tabs you hid (Settings ›
|
|
75
|
+
// Tabs you hid (Settings › Home › Menu) aren't shown; Watching always is.
|
|
76
76
|
function availableTabs() {
|
|
77
77
|
var hidden = Stremio.getPrefs().hiddenTabs || [];
|
|
78
78
|
function shown(t) { return t.key === 'continue' || (hidden.indexOf(t.key) === -1 && (t.key !== 'guide' || hasGuide())); }
|
|
@@ -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
|
|
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 };
|
|
@@ -927,7 +928,7 @@
|
|
|
927
928
|
}
|
|
928
929
|
function previewTiles() {
|
|
929
930
|
var out = [];
|
|
930
|
-
var recent = Stremio.getPrefs().homePreviewOrder !== 'watching'; // (Settings ›
|
|
931
|
+
var recent = Stremio.getPrefs().homePreviewOrder !== 'watching'; // (Settings › Home › Home bar preview)
|
|
931
932
|
continueEntries(recent).forEach(function (e) { // (the latest first: what you're bingeing leads; or Watching's order)
|
|
932
933
|
if (out.length >= PREVIEW_MAX || !playableNow(e)) { return; }
|
|
933
934
|
var base = e.parent || e.id.split(':')[0], code = e.type === 'series' ? codeOfId(e.id) : '';
|
|
@@ -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 › Home › 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 › Home › 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
|
-
|
|
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
|
}
|
|
@@ -1427,6 +1440,7 @@
|
|
|
1427
1440
|
// The IPTV playlists read after your addons loaded (they aren't waited for): their rows join.
|
|
1428
1441
|
if (typeof Stremio !== 'undefined' && Stremio.onIptvReady) { Stremio.onIptvReady(function () { refreshAddonRows('local:iptv'); }); }
|
|
1429
1442
|
if (typeof XtVod !== 'undefined' && XtVod.onChange) { XtVod.onChange(function () { refreshAddonRows('local:xtvod'); }); } // (an Xtream account's films and series, once its categories came)
|
|
1443
|
+
if (typeof StVod !== 'undefined' && StVod.onChange) { StVod.onChange(function () { refreshAddonRows('local:stvod'); }); } // (a Stalker portal's, the same)
|
|
1430
1444
|
var PARTIAL_DELAY = 150; // coalesces catalogs that arrive together into one redraw
|
|
1431
1445
|
function loadHomeCatalogs() {
|
|
1432
1446
|
if (_homeLoading) { return; }
|
|
@@ -1520,7 +1534,7 @@
|
|
|
1520
1534
|
|
|
1521
1535
|
// Catalogs of type "other" (e.g. Torrentio's RealDebrid downloads) aren't live TV:
|
|
1522
1536
|
// their items go to a Movies row and a Series row, split by the release name.
|
|
1523
|
-
// Everything is capped to the cards a Home row shows (Settings ›
|
|
1537
|
+
// Everything is capped to the cards a Home row shows (Settings › Home › Titles in a Home
|
|
1524
1538
|
// row), but for IPTV's ★ Favorites (all: every one you picked, up to the 300 kept).
|
|
1525
1539
|
var ROW_CARDS = 30;
|
|
1526
1540
|
function rowCards() { var n = Stremio.getPrefs().rowCards; return n === 'all' ? Infinity : n || ROW_CARDS; }
|
package/js/view-search.js
CHANGED
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
|
|
157
157
|
// Results come as one row per search source (Stremio.searchSources): each searchable
|
|
158
158
|
// catalog ("Series · Popular · Cinemeta"), IPTV's groups as one per type, in the order
|
|
159
|
-
// and with the ones shown in Settings >
|
|
159
|
+
// and with the ones shown in Settings > Home > Search results; each row in its
|
|
160
160
|
// addon's own order (its best match first). A row appears as its catalog answers, in its
|
|
161
161
|
// place; one whose catalog pages loads more as focus nears its end.
|
|
162
162
|
var LOAD_AHEAD = 6;
|
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
}
|
|
260
260
|
if (!found) {
|
|
261
261
|
results.appendChild(U.el('div', 'search-empty', (failed && failed === defs.length) ? 'Search failed. Check your network.'
|
|
262
|
-
: (!defs.length && !people) ? 'Nothing to search: no addon can, or all are hidden (Settings ›
|
|
262
|
+
: (!defs.length && !people) ? 'Nothing to search: no addon can, or all are hidden (Settings › Home › Search results).'
|
|
263
263
|
: 'No results for “' + query + '”.' + (silent.length ? ' No answer from: ' + silent.join(', ') + ' (try again).' : '')));
|
|
264
264
|
}
|
|
265
265
|
});
|
package/js/view-settings.js
CHANGED
|
@@ -215,11 +215,6 @@
|
|
|
215
215
|
get: function () { return { zoom: '' + zoomPct() }; },
|
|
216
216
|
set: function (cfg) { Stremio.setPref('zoom', +cfg.zoom); applyAppearance(); }
|
|
217
217
|
}));
|
|
218
|
-
wrap.appendChild(subPickRow('Titles in a Home row', [['30', '30'], ['50', '50'], ['100', '100'], ['200', '200'], ['all', 'Unlimited']], 'rowCards', {
|
|
219
|
-
warning: 'Unlimited: Home can take much longer to load, an addon may refuse so many requests, and very long rows can slow an older TV',
|
|
220
|
-
get: function () { return { rowCards: '' + Stremio.getPrefs().rowCards }; },
|
|
221
|
-
set: function (cfg) { Stremio.setPref('rowCards', cfg.rowCards === 'all' ? 'all' : +cfg.rowCards); clearCatalogCache(); } // (the rows read again, with more pages or fewer)
|
|
222
|
-
}));
|
|
223
218
|
wrap.appendChild(subPickRow('Poster orientation', POSTER_SHAPES, 'posterShape', {
|
|
224
219
|
get: function () { return { posterShape: Stremio.getPrefs().posterShape }; },
|
|
225
220
|
set: function (cfg) { Stremio.setPref('posterShape', cfg.posterShape); markHomeDirty(); } // Home redraws on return
|
|
@@ -228,6 +223,25 @@
|
|
|
228
223
|
get: function () { return { posterRatings: Stremio.getPrefs().posterRatings ? 'on' : 'off' }; },
|
|
229
224
|
set: function (cfg) { Stremio.setPref('posterRatings', cfg.posterRatings === 'on'); markHomeDirty(); }
|
|
230
225
|
}));
|
|
226
|
+
wrap.appendChild(subPickRow('Hide spoilers', [['off', 'Off'], ['pictures', 'Pictures'], ['all', 'Pictures and synopses']], 'spoilers', {
|
|
227
|
+
get: function () { return { spoilers: Stremio.getPrefs().spoilers }; },
|
|
228
|
+
set: function (cfg) { Stremio.setPref('spoilers', cfg.spoilers); }
|
|
229
|
+
}));
|
|
230
|
+
focusSettings();
|
|
231
|
+
}
|
|
232
|
+
// Home: the tab a launch opens on, how many titles a row holds, the TV's home bar, and the
|
|
233
|
+
// pages ordering the top menu, the Home rows and the Search rows.
|
|
234
|
+
function settingsHome(wrap) {
|
|
235
|
+
wrap.appendChild(U.el('h2', null, 'Home'));
|
|
236
|
+
wrap.appendChild(subPickRow('Start on', V.HOME_TABS.map(function (t) { return [t.key, t.label]; }), 'startTab', {
|
|
237
|
+
get: function () { return { startTab: Stremio.getPrefs().startTab }; },
|
|
238
|
+
set: function (cfg) { Stremio.setPref('startTab', cfg.startTab); } // (the next launch: Home stays where it is now)
|
|
239
|
+
}));
|
|
240
|
+
wrap.appendChild(subPickRow('Titles in a Home row', [['30', '30'], ['50', '50'], ['100', '100'], ['200', '200'], ['all', 'Unlimited']], 'rowCards', {
|
|
241
|
+
warning: 'Unlimited: Home can take much longer to load, an addon may refuse so many requests, and very long rows can slow an older TV',
|
|
242
|
+
get: function () { return { rowCards: '' + Stremio.getPrefs().rowCards }; },
|
|
243
|
+
set: function (cfg) { Stremio.setPref('rowCards', cfg.rowCards === 'all' ? 'all' : +cfg.rowCards); clearCatalogCache(); } // (the rows read again, with more pages or fewer)
|
|
244
|
+
}));
|
|
231
245
|
if (typeof HubPreview !== 'undefined' && HubPreview.available()) { // (the sideloaded app: see js/hubpreview.js)
|
|
232
246
|
// one choice: the tiles' order, or none (sent at once, whatever the wait)
|
|
233
247
|
wrap.appendChild(subPickRow('Home bar preview', [['recent', 'Most recent first'], ['watching', 'As in Watching'], ['off', 'Off']], 'homeBar', {
|
|
@@ -239,10 +253,6 @@
|
|
|
239
253
|
}
|
|
240
254
|
}));
|
|
241
255
|
}
|
|
242
|
-
wrap.appendChild(subPickRow('Hide spoilers', [['off', 'Off'], ['pictures', 'Pictures'], ['all', 'Pictures and synopses']], 'spoilers', {
|
|
243
|
-
get: function () { return { spoilers: Stremio.getPrefs().spoilers }; },
|
|
244
|
-
set: function (cfg) { Stremio.setPref('spoilers', cfg.spoilers); }
|
|
245
|
-
}));
|
|
246
256
|
var menu = sectionRow('Menu ›', 'Order the top menu, and show or hide its tabs', 'menuorder');
|
|
247
257
|
menu.className += ' cfg-row';
|
|
248
258
|
wrap.appendChild(menu);
|
|
@@ -345,9 +355,9 @@
|
|
|
345
355
|
Focus.setScope(s, s.querySelector('.settings-wrap .focusable') || undefined);
|
|
346
356
|
}
|
|
347
357
|
|
|
348
|
-
// Settings is
|
|
349
|
-
// its sections. [title, description, section] rows; Appearance
|
|
350
|
-
//
|
|
358
|
+
// Settings is five groups (Content, Playback, Appearance, Home, Diagnostics); each opens a page
|
|
359
|
+
// of its sections. [title, description, section] rows; Appearance and Home are pages of their
|
|
360
|
+
// own (their settings right on them; Home's Menu, Home feeds and Search results open pages).
|
|
351
361
|
var SETTINGS_GROUPS = {
|
|
352
362
|
content: { title: 'Content', rows: [
|
|
353
363
|
['Addons', 'Catalog, stream & subtitle addons', 'addons'],
|
|
@@ -374,9 +384,9 @@
|
|
|
374
384
|
|
|
375
385
|
// Return true if BACK stepped a settings section back to the menu.
|
|
376
386
|
// BACK goes up one level, onto the row it came from: from a section to its group (on
|
|
377
|
-
// that section, not the first one), from Home feeds / Search results to
|
|
387
|
+
// that section, not the first one), from Menu / Home feeds / Search results to Home,
|
|
378
388
|
// from a group to the Settings list (on that group).
|
|
379
|
-
var SECTION_PARENT = { menuorder: '
|
|
389
|
+
var SECTION_PARENT = { menuorder: 'home', feeds: 'home', searchfeeds: 'home', aiomanager: 'addons', subtitlelook: 'subtitles', rankfilters: 'ranking', rankplay: 'ranking' };
|
|
380
390
|
Object.keys(SETTINGS_GROUPS).forEach(function (g) {
|
|
381
391
|
SETTINGS_GROUPS[g].rows.forEach(function (row) { SECTION_PARENT[row[2]] = g; });
|
|
382
392
|
});
|
|
@@ -423,6 +433,7 @@
|
|
|
423
433
|
else if (_settingsSection === 'aiomanager') { settingsAiom(wrap); }
|
|
424
434
|
else if (_settingsSection === 'server') { settingsServer(wrap); }
|
|
425
435
|
else if (_settingsSection === 'appearance') { settingsAppearance(wrap); }
|
|
436
|
+
else if (_settingsSection === 'home') { settingsHome(wrap); }
|
|
426
437
|
else if (_settingsSection === 'formats') { settingsFormats(wrap); }
|
|
427
438
|
else { settingsMenu(wrap); }
|
|
428
439
|
var ver = appVersion();
|
|
@@ -464,7 +475,8 @@
|
|
|
464
475
|
wrap.appendChild(U.el('h2', null, 'Settings'));
|
|
465
476
|
wrap.appendChild(sectionRow('Content', 'Addons, API keys, IPTV playlists, streaming apps, importing a configuration file', 'content'));
|
|
466
477
|
wrap.appendChild(sectionRow('Playback', 'Audio and subtitles, source ranking, feed sources, formats', 'playback'));
|
|
467
|
-
wrap.appendChild(sectionRow('Appearance', 'Background, accent color, zoom,
|
|
478
|
+
wrap.appendChild(sectionRow('Appearance', 'Background, accent color, zoom, posters, spoilers', 'appearance'));
|
|
479
|
+
wrap.appendChild(sectionRow('Home', 'The tab it opens on, the top menu, Home feeds, Search results', 'home'));
|
|
468
480
|
wrap.appendChild(sectionRow('Diagnostics', 'Logs, storage, installed apps; how StremioK was installed', 'diagnostics'));
|
|
469
481
|
if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
|
|
470
482
|
focusBack(wrap);
|
|
@@ -2051,7 +2063,7 @@
|
|
|
2051
2063
|
return first;
|
|
2052
2064
|
}
|
|
2053
2065
|
|
|
2054
|
-
// ----- Home feeds and Search results (Settings >
|
|
2066
|
+
// ----- Home feeds and Search results (Settings > Home): order, show / hide -----
|
|
2055
2067
|
// kind 'home': the Home rows (every catalog); 'search': the Search rows (every catalog
|
|
2056
2068
|
// that can search, IPTV as one per type). ▲/▼ moves one; OK on its name shows / hides it.
|
|
2057
2069
|
// 'menu': the top menu between Watching and Settings (the tabs, Discover, Search: ViewParts'
|
|
@@ -2059,7 +2071,7 @@
|
|
|
2059
2071
|
var MENU_FIXED = { discover: 'Discover', search: 'Search' };
|
|
2060
2072
|
function menuHidden(k) { return !MENU_FIXED[k] && (Stremio.getPrefs().hiddenTabs || []).indexOf(k) !== -1; }
|
|
2061
2073
|
var FEED_KINDS = {
|
|
2062
|
-
menu: { section: 'menuorder', title: '
|
|
2074
|
+
menu: { section: 'menuorder', title: 'Home › Menu', hint: 'Watching comes first and Settings last: ⇈ ▲ ▼ ⇊ put the rest in your order · OK on a tab shows/hides it.',
|
|
2063
2075
|
list: function () {
|
|
2064
2076
|
return Promise.resolve(V.menuOrder().map(function (k) {
|
|
2065
2077
|
var t = (V.HOME_TABS || []).filter(function (x) { return x.key === k; })[0];
|
|
@@ -2076,11 +2088,11 @@
|
|
|
2076
2088
|
markHomeDirty();
|
|
2077
2089
|
},
|
|
2078
2090
|
hidden: menuHidden },
|
|
2079
|
-
home: { section: 'feeds', title: '
|
|
2091
|
+
home: { section: 'feeds', title: 'Home › Home feeds', hint: '▲/▼ reorder a feed · OK on the name shows/hides it on Home.',
|
|
2080
2092
|
list: function () { return Stremio.listCatalogsOrdered(); }, keyOf: function (c) { return Stremio.catalogKey(c); },
|
|
2081
2093
|
move: function (k, d) { return Stremio.moveFeed(k, d); }, toggle: function (k) { Stremio.toggleFeed(k); },
|
|
2082
2094
|
hidden: function (k) { return Stremio.isFeedHidden(k); } },
|
|
2083
|
-
search: { section: 'searchfeeds', title: '
|
|
2095
|
+
search: { section: 'searchfeeds', title: 'Home › Search results', hint: '▲/▼ reorder the Search rows · OK on the name shows/hides one in Search.',
|
|
2084
2096
|
list: function () { return Stremio.searchSourcesOrdered(); }, keyOf: function (src) { return src.key; },
|
|
2085
2097
|
move: function (k, d) { return Stremio.moveSearchFeed(k, d); }, toggle: function (k) { Stremio.toggleSearchFeed(k); },
|
|
2086
2098
|
hidden: function (k) { return Stremio.isSearchFeedHidden(k); } },
|
package/js/ytplay.js
CHANGED
|
@@ -112,6 +112,18 @@ var YTPlay = (function () {
|
|
|
112
112
|
}
|
|
113
113
|
function stalkerGenres(portal, mac) { return stalkerAsk('/stalker/genres', portal, mac, '', 40000, 1048576); }
|
|
114
114
|
function stalkerLink(portal, mac, u, cancel) { return stalkerAsk('/stalker/link', portal, mac, '&u=' + encodeURIComponent(u), 25000, 65536, cancel); }
|
|
115
|
+
// Its films and series (see js/stvod.js): more, the request (&type=&do=cats|list|seasons…) ->
|
|
116
|
+
// { cats } | { items, more } | { seasons }, or { why }.
|
|
117
|
+
function stalkerVod(portal, mac, more) { return stalkerAsk('/stalker/vod', portal, mac, more, 45000, 4 * 1048576); }
|
|
118
|
+
// A film's or episode's source: the service's link that asks the portal for one when it's
|
|
119
|
+
// played (cmd, and ep: an episode of a season's cmd), with the token, or the guide ticket (the
|
|
120
|
+
// player sends no header; a ticket is the service's until it starts again).
|
|
121
|
+
function stalkerPlayUrl(portal, mac, cmd, ep) {
|
|
122
|
+
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
123
|
+
return ensureService().then(entryAuth).then(function (a) { return a.q ? a.q : ticketOf(a); }).then(function (cred) {
|
|
124
|
+
return PROXY + '/stalker/play?portal=' + encodeURIComponent(portal) + '&mac=' + encodeURIComponent(mac) + '&cmd=' + encodeURIComponent(cmd) + (ep >= 0 ? '&ep=' + ep : '') + (cred || '');
|
|
125
|
+
});
|
|
126
|
+
}
|
|
115
127
|
// An Xtream account's films or series, kept by the service (see service/index.js, xtvControl;
|
|
116
128
|
// user= and pass=: names Diagnostics masks):
|
|
117
129
|
// path 'list' (the newest; more: &q= for a search, &skip=) or 'find' (a title's copies: &tmdb=
|
|
@@ -135,6 +147,9 @@ var YTPlay = (function () {
|
|
|
135
147
|
var _ticket = null;
|
|
136
148
|
function epgTicket(a) {
|
|
137
149
|
if (a.q || MODE === 'tizenbrew') { return Promise.resolve(a.q); } // (the token; TizenBrew's origin passes as it is)
|
|
150
|
+
return ticketOf(a);
|
|
151
|
+
}
|
|
152
|
+
function ticketOf(a) {
|
|
138
153
|
if (!_ticket) {
|
|
139
154
|
_ticket = U.getJSON(PROXY + '/epg/ticket', 8000, 4096, null, a.h).then(function (r) {
|
|
140
155
|
return r && /^[0-9a-f]{48}$/.test(r.ticket || '') ? '&ticket=' + r.ticket : '';
|
|
@@ -257,6 +272,6 @@ var YTPlay = (function () {
|
|
|
257
272
|
return MODE === 'tizenbrew' ? 'TizenBrew module' : MODE === 'wgt' ? 'Sideloaded app (.wgt)' : 'Browser (development)';
|
|
258
273
|
}
|
|
259
274
|
|
|
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; },
|
|
275
|
+
return { ensureService: ensureService, resolverUrl: resolverUrl, infoUrl: infoUrl, canPlay: canPlay, liveOpen: liveOpen, hlsMaster: hlsMaster, aiomAddons: aiomAddons, stalkerList: stalkerList, stalkerVod: stalkerVod, stalkerPlayUrl: stalkerPlayUrl, 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; },
|
|
261
276
|
installLabel: installLabel, unavailableMessage: unavailableMessage, isRunning: isRunning, port: PORT };
|
|
262
277
|
})();
|
package/package.json
CHANGED
package/service/index.js
CHANGED
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
* why }: a Stalker portal's channels as an M3U playlist; /stalker/link?portal&mac
|
|
31
31
|
* &u=<a channel's link in it> -> JSON { url } or { why }: its link to play now
|
|
32
32
|
* (see stalkerControl); StremioK only (entryAllowed)
|
|
33
|
+
* /stalker/vod?portal&mac&type=movie|series&do=cats|list|seasons[&cat=][&q=][&skip=][&id=][&via=vod]
|
|
34
|
+
* -> JSON { cats } | { items, more } | { seasons } or { why }: its films and
|
|
35
|
+
* series; /stalker/play?portal&mac&cmd=[&ep=] -> 302 to a film's or episode's
|
|
36
|
+
* link, asked now (the player's: the token, or the guide ticket)
|
|
33
37
|
* /epg/load?u=<guide>&k=<bitset>[&force=1] (or POSTed: the same in its body, as StremioK
|
|
34
38
|
* asks) -> JSON { state, at, channels, programmes, partial,
|
|
35
39
|
* error }: a playlist's TV guide (XMLTV) read for StremioK's channels
|
|
@@ -1819,7 +1823,7 @@ function handle(req, res) {
|
|
|
1819
1823
|
if (/^\/epg\//.test(path)) { epgControl(req, res, path, parts[1]); return; } // (a playlist's TV guide: see epgControl)
|
|
1820
1824
|
if (path === '/aiom/addons') { aiomControl(req, res, parts[1], leaving); return; }
|
|
1821
1825
|
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' || 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)
|
|
1826
|
+
if (path === '/stalker/list' || path === '/stalker/link' || path === '/stalker/genres' || path === '/stalker/vod' || path === '/stalker/play') { 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
1827
|
if (path === '/fsfile') { // a USB file over HTTP, with Range: the player reads a big one from here (see fsfile in the header)
|
|
1824
1828
|
var whyF = fsAllowed(req, parts[1]);
|
|
1825
1829
|
if (whyF) { send(res, 403, 'text/plain', 'not allowed (' + whyF + ')'); return; }
|
|
@@ -2971,7 +2975,7 @@ function xtvControl(req, res, path, query) {
|
|
|
2971
2975
|
answer();
|
|
2972
2976
|
}
|
|
2973
2977
|
|
|
2974
|
-
// ---- Stalker portals (/stalker/list, /stalker/link) ----
|
|
2978
|
+
// ---- Stalker portals (/stalker/list, /stalker/link, /stalker/genres; films and series below) ----
|
|
2975
2979
|
// A Stalker (Ministra) portal, asked as a MAG box asks: its MAC address in a cookie, a MAG
|
|
2976
2980
|
// User-Agent, a session token from a handshake (none of which a web page can send). Its API at
|
|
2977
2981
|
// <address>/portal.php, else /server/load.php (the address's /c/ left out). list: its genres and
|
|
@@ -3158,8 +3162,138 @@ function stalkerM3u(s, list, genres) {
|
|
|
3158
3162
|
s.cmds = cmds;
|
|
3159
3163
|
return { m3u: out.join('\n') + '\n', count: n };
|
|
3160
3164
|
}
|
|
3165
|
+
|
|
3166
|
+
// ---- A Stalker portal's films and series (/stalker/vod, /stalker/play) ----
|
|
3167
|
+
// Asked as they're shown, never read whole: cats (a type's categories: films type=vod, series
|
|
3168
|
+
// type=series, a portal without that module none), list (a category's titles, newest first, or
|
|
3169
|
+
// those a search finds: STALKER_VOD_TAKE from skip, STALKER_VOD_PAGES of the portal's pages at
|
|
3170
|
+
// most; a film that's a series, is_series, marked so), seasons (a series' seasons and their
|
|
3171
|
+
// episodes: a season's cmd and its episodes' numbers, or each episode's own cmd) and play (a film's
|
|
3172
|
+
// or an episode's link asked now, create_link, and sent there: what's saved to resume stays good).
|
|
3173
|
+
var STALKER_VOD_TAKE = 42, STALKER_VOD_PAGES = 4, STALKER_VOD_CATS_MS = 10 * 60000, STALKER_SEASONS = 60, STALKER_EPISODES = 500;
|
|
3174
|
+
function stalkerText(v, n) { return String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n); }
|
|
3175
|
+
function stalkerCmdOk(cmd) { return !!cmd && cmd.length <= 2000 && !/[\r\n]/.test(cmd); }
|
|
3176
|
+
function stalkerVodItem(s, o) {
|
|
3177
|
+
if (!o || typeof o !== 'object' || o.id == null) { return null; }
|
|
3178
|
+
var id = String(o.id), name = stalkerText(o.name || o.o_name, 200);
|
|
3179
|
+
if (!/^[\w-]{1,40}$/.test(id) || !name) { return null; }
|
|
3180
|
+
var it = { id: id, name: name }, y = parseInt(o.year, 10), pic = String(o.screenshot_uri || o.cover || ''), r = parseFloat(o.rating_imdb) || parseFloat(o.rating_kinopoisk), t = parseInt(o.time, 10), cmd = String(o.cmd || '');
|
|
3181
|
+
if (y > 1880 && y < 2100) { it.year = y; }
|
|
3182
|
+
if (/^\//.test(pic)) { var b = urllib.parse(s.base); pic = b.protocol + '//' + b.host + pic; } // (a picture on the portal's own server)
|
|
3183
|
+
if (/^https?:\/\//i.test(pic) && pic.length < 600) { it.pic = pic; }
|
|
3184
|
+
if (r > 0 && r <= 10) { it.rating = Math.round(r * 10) / 10; }
|
|
3185
|
+
if (stalkerText(o.description, 1)) { it.desc = stalkerText(o.description, 2000); }
|
|
3186
|
+
if (stalkerText(o.director, 1)) { it.director = stalkerText(o.director, 200); }
|
|
3187
|
+
if (stalkerText(o.actors, 1)) { it.cast = stalkerText(o.actors, 400); }
|
|
3188
|
+
if (stalkerText(o.genres_str, 1)) { it.genres = stalkerText(o.genres_str, 200); }
|
|
3189
|
+
if (t > 0 && t < 1000) { it.mins = t; }
|
|
3190
|
+
if (stalkerCmdOk(cmd)) { it.cmd = cmd; }
|
|
3191
|
+
if (+o.is_series === 1 || o.is_series === true) { it.series = true; }
|
|
3192
|
+
return it;
|
|
3193
|
+
}
|
|
3194
|
+
function stalkerVodCats(s, type, ctl, cb) {
|
|
3195
|
+
var kept = s.vodCats && s.vodCats[type];
|
|
3196
|
+
if (kept && Date.now() - kept.at < STALKER_VOD_CATS_MS) { cb(null, kept.list); return; }
|
|
3197
|
+
stalkerAsk(s, 'type=' + (type === 'movie' ? 'vod' : 'series') + '&action=get_categories', ctl, function (err, js) {
|
|
3198
|
+
if (err && (err.auth || type === 'movie')) { cb(err); return; } // (no series module: no series)
|
|
3199
|
+
var list = (Array.isArray(js) ? js : []).filter(function (x) { return x && x.id != null && String(x.id) !== '*' && x.title; }).slice(0, STALKER_GENRES)
|
|
3200
|
+
.map(function (x) { return { id: String(x.id).slice(0, 40), title: stalkerText(x.title, 100) }; });
|
|
3201
|
+
s.vodCats = s.vodCats || {};
|
|
3202
|
+
s.vodCats[type] = { at: Date.now(), list: list };
|
|
3203
|
+
cb(null, list);
|
|
3204
|
+
});
|
|
3205
|
+
}
|
|
3206
|
+
// cb(err, { items, more }): from skip on, in the portal's pages (s.vodSize titles each, learned
|
|
3207
|
+
// from its first answer: a page asked for that first, once, when skip is past it).
|
|
3208
|
+
function stalkerVodList(s, type, cat, words, skip, ctl, cb) {
|
|
3209
|
+
var params = 'type=' + (type === 'movie' ? 'vod' : 'series') + '&action=get_ordered_list&category=' + encodeURIComponent(cat || '*') + '&genre=*&sortby=added&hd=0¬_ended=0&fav=0' +
|
|
3210
|
+
(words ? '&search=' + encodeURIComponent(words) : '');
|
|
3211
|
+
function page(p, done) {
|
|
3212
|
+
stalkerAsk(s, params + '&p=' + p, ctl, function (err, o) {
|
|
3213
|
+
if (err) { done(err); return; }
|
|
3214
|
+
var d = o && Array.isArray(o.data) ? o.data : [], total = +(o && o.total_items) || 0;
|
|
3215
|
+
if (!s.vodSize && d.length && total > d.length) { s.vodSize = d.length; }
|
|
3216
|
+
done(null, d, total);
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
function from() {
|
|
3220
|
+
var size = s.vodSize || STALKER_VOD_TAKE, p = Math.floor(skip / size) + 1, drop = skip % size, out = [], asked = 0;
|
|
3221
|
+
(function more() {
|
|
3222
|
+
page(p, function (err, d, total) {
|
|
3223
|
+
if (err) { if (out.length) { cb(null, { items: out, more: true }); } else { cb(err); } return; }
|
|
3224
|
+
asked++;
|
|
3225
|
+
d.slice(drop).forEach(function (o) { var it = stalkerVodItem(s, o); if (it) { out.push(it); } });
|
|
3226
|
+
drop = 0;
|
|
3227
|
+
var left = d.length && (!total || p * (s.vodSize || d.length) < total);
|
|
3228
|
+
if (!left || out.length >= STALKER_VOD_TAKE || asked >= STALKER_VOD_PAGES) { cb(null, { items: out.slice(0, STALKER_VOD_TAKE * 2), more: !!left }); return; }
|
|
3229
|
+
p++;
|
|
3230
|
+
more();
|
|
3231
|
+
});
|
|
3232
|
+
})();
|
|
3233
|
+
}
|
|
3234
|
+
if (skip > 0 && !s.vodSize) {
|
|
3235
|
+
page(1, function (err, d) {
|
|
3236
|
+
if (err) { cb(err); return; }
|
|
3237
|
+
if (s.vodSize) { from(); return; }
|
|
3238
|
+
var out = []; // (one page held all there is)
|
|
3239
|
+
d.slice(skip).forEach(function (o) { var it = stalkerVodItem(s, o); if (it) { out.push(it); } });
|
|
3240
|
+
cb(null, { items: out, more: false });
|
|
3241
|
+
});
|
|
3242
|
+
return;
|
|
3243
|
+
}
|
|
3244
|
+
from();
|
|
3245
|
+
}
|
|
3246
|
+
// A series' seasons: { season, name, cmd, eps: [{ n, cmd?, name? }] }. viaVod: a film that's a
|
|
3247
|
+
// series (is_series), its seasons asked of the films (type=vod).
|
|
3248
|
+
function stalkerSeasonNo(o, at) {
|
|
3249
|
+
var n = parseInt(o.season_number, 10), m = /(\d+)/.exec(String(o.name || ''));
|
|
3250
|
+
return n >= 0 ? n : m ? +m[1] : at;
|
|
3251
|
+
}
|
|
3252
|
+
function stalkerSeasons(s, id, viaVod, ctl, cb) {
|
|
3253
|
+
var base = viaVod ? 'type=vod&action=get_ordered_list&movie_id=' + encodeURIComponent(id) : 'type=series&action=get_ordered_list&movie_id=' + encodeURIComponent(id) + '&season_id=0&episode_id=0';
|
|
3254
|
+
var out = [], p = 1;
|
|
3255
|
+
function all(params, each, done) { // (every page of an answer, 10 at most)
|
|
3256
|
+
var page = 1, got = 0;
|
|
3257
|
+
(function more() {
|
|
3258
|
+
stalkerAsk(s, params + '&p=' + page, ctl, function (err, o) {
|
|
3259
|
+
if (err) { done(err); return; }
|
|
3260
|
+
var d = o && Array.isArray(o.data) ? o.data : [], total = +(o && o.total_items) || 0;
|
|
3261
|
+
d.forEach(function (x, i) { each(x, got + i + 1); });
|
|
3262
|
+
got += d.length;
|
|
3263
|
+
if (d.length && page < 10 && total > got) { page++; more(); } else { done(null); }
|
|
3264
|
+
});
|
|
3265
|
+
})();
|
|
3266
|
+
}
|
|
3267
|
+
all(base, function (x, at) {
|
|
3268
|
+
if (!x || typeof x !== 'object' || out.length >= STALKER_SEASONS) { return; }
|
|
3269
|
+
var cmd = String(x.cmd || ''), eps = Array.isArray(x.series) ? x.series.map(function (n) { return parseInt(n, 10); }).filter(function (n) { return n >= 0; }).slice(0, STALKER_EPISODES) : null;
|
|
3270
|
+
out.push({ season: stalkerSeasonNo(x, at), name: stalkerText(x.name, 100), cmd: stalkerCmdOk(cmd) ? cmd : '', id: String(x.id == null ? '' : x.id).slice(0, 60), eps: eps ? eps.map(function (n) { return { n: n }; }) : null });
|
|
3271
|
+
}, function (err) {
|
|
3272
|
+
if (err && !out.length) { cb(err); return; }
|
|
3273
|
+
(function next(i) { // (seasons that don't list their episodes: asked for them, each with its own cmd)
|
|
3274
|
+
while (i < out.length && out[i].eps) { i++; }
|
|
3275
|
+
if (i >= out.length || viaVod) { cb(null, out.filter(function (x) { return x.eps && x.eps.length; }).map(function (x) { delete x.id; return x; })); return; }
|
|
3276
|
+
var se = out[i];
|
|
3277
|
+
se.eps = [];
|
|
3278
|
+
all('type=series&action=get_ordered_list&movie_id=' + encodeURIComponent(id) + '&season_id=' + encodeURIComponent(se.id) + '&episode_id=0', function (e, at) {
|
|
3279
|
+
var cmd = String((e && e.cmd) || '');
|
|
3280
|
+
if (!e || !stalkerCmdOk(cmd) || se.eps.length >= STALKER_EPISODES) { return; }
|
|
3281
|
+
var n = parseInt(e.series_number, 10), m = /(\d+)/.exec(String(e.name || ''));
|
|
3282
|
+
se.eps.push({ n: n >= 0 ? n : m ? +m[1] : at, cmd: cmd, name: stalkerText(e.name, 120) });
|
|
3283
|
+
}, function () { next(i + 1); });
|
|
3284
|
+
})(0);
|
|
3285
|
+
});
|
|
3286
|
+
}
|
|
3287
|
+
// A film's or an episode's link to play now: cmd (an episode of a season's cmd: ep, its number).
|
|
3288
|
+
function stalkerVodLink(s, cmd, ep, ctl, cb) {
|
|
3289
|
+
stalkerAsk(s, 'type=vod&action=create_link&cmd=' + encodeURIComponent(cmd) + '&series=' + (ep >= 0 ? ep : '') + '&forced_storage=undefined&disable_ad=0&download=0&force_ch_link_check=0', ctl, function (err, js) {
|
|
3290
|
+
if (err) { cb(err); return; }
|
|
3291
|
+
var m = /(https?:\/\/[^\s"]+)/i.exec(String((js && js.cmd) || ''));
|
|
3292
|
+
cb(m ? null : upError('the portal gave no link for this title', 502), m ? m[1] : null);
|
|
3293
|
+
});
|
|
3294
|
+
}
|
|
3161
3295
|
function stalkerControl(req, res, path, query, leaving) {
|
|
3162
|
-
if (!entryAllowed(req, query)) { send(res, 403, 'text/plain', 'not allowed (token)'); return; }
|
|
3296
|
+
if (!entryAllowed(req, query) && !(path === '/stalker/play' && hasTicket(query))) { send(res, 403, 'text/plain', 'not allowed (token)'); return; } // (play: the player asks, without the header)
|
|
3163
3297
|
var q = {};
|
|
3164
3298
|
(query || '').split('&').forEach(function (kv) { var i = kv.indexOf('='); if (i > 0) { try { q[kv.slice(0, i)] = decodeURIComponent(kv.slice(i + 1)); } catch (e) {} } });
|
|
3165
3299
|
var portal = String(q.portal || '').trim(), mac = String(q.mac || '').toUpperCase();
|
|
@@ -3181,6 +3315,30 @@ function stalkerControl(req, res, path, query, leaving) {
|
|
|
3181
3315
|
}, function (err, link) { json(err ? { why: err.message || 'failed' } : { url: link }); });
|
|
3182
3316
|
return;
|
|
3183
3317
|
}
|
|
3318
|
+
if (path === '/stalker/play') { // (a film's or episode's link: asked now, and sent there)
|
|
3319
|
+
var cmd = String(q.cmd || ''), ep = /^\d{1,4}$/.test(q.ep || '') ? +q.ep : -1;
|
|
3320
|
+
if (!stalkerCmdOk(cmd)) { send(res, 400, 'text/plain', 'bad title'); return; }
|
|
3321
|
+
stalkerWith(s, portal, mac, ctl, function (ss, done) { stalkerVodLink(ss, cmd, ep, ctl, done); }, function (err, link) {
|
|
3322
|
+
if (err) { log('Stalker: no link for a title (' + (err.message || 'failed') + ')'); send(res, 502, 'text/plain', err.message || 'failed'); return; }
|
|
3323
|
+
res.writeHead(302, { 'Location': link, 'Cache-Control': 'no-store' });
|
|
3324
|
+
res.end();
|
|
3325
|
+
});
|
|
3326
|
+
return;
|
|
3327
|
+
}
|
|
3328
|
+
if (path === '/stalker/vod') {
|
|
3329
|
+
var type = q.type === 'series' ? 'series' : 'movie', what = String(q.do || '');
|
|
3330
|
+
stalkerWith(s, portal, mac, ctl, function (ss, done) {
|
|
3331
|
+
if (what === 'cats') { stalkerVodCats(ss, type, ctl, function (err, list) { done(err, { cats: list }); }); return; }
|
|
3332
|
+
if (what === 'list') {
|
|
3333
|
+
var cat = /^[\w.-]{1,40}$/.test(q.cat || '') ? q.cat : '*', words = String(q.q || '').trim().slice(0, 120), skip = Math.min(parseInt(q.skip, 10) || 0, 100000);
|
|
3334
|
+
stalkerVodList(ss, type, cat, words, skip, ctl, done);
|
|
3335
|
+
return;
|
|
3336
|
+
}
|
|
3337
|
+
if (what === 'seasons' && /^[\w-]{1,40}$/.test(q.id || '')) { stalkerSeasons(ss, q.id, q.via === 'vod', ctl, function (err, l) { done(err, { seasons: l }); }); return; }
|
|
3338
|
+
done(upError('bad request', 400));
|
|
3339
|
+
}, function (err, r) { json(err ? { why: err.message || 'failed' } : r); });
|
|
3340
|
+
return;
|
|
3341
|
+
}
|
|
3184
3342
|
if (path === '/stalker/genres') {
|
|
3185
3343
|
stalkerWith(s, portal, mac, ctl, function (ss, done) { stalkerAsk(ss, 'type=itv&action=get_genres', ctl, done); }, function (err, js) {
|
|
3186
3344
|
if (err) { json({ why: err.message || 'failed' }); return; }
|