stremiok 2.2.1 → 2.2.3
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 +41 -0
- package/README.md +15 -12
- package/config.xml +1 -1
- package/css/style.css +14 -9
- package/index.html +34 -33
- package/js/app.js +18 -19
- package/js/focus.js +30 -10
- package/js/iptv.js +107 -9
- package/js/player-core.js +80 -18
- package/js/player-store.js +3 -3
- package/js/player-subs.js +47 -7
- package/js/stremio.js +196 -28
- package/js/util.js +137 -16
- package/js/view-core.js +53 -13
- package/js/view-detail.js +35 -7
- package/js/view-discover.js +1 -1
- package/js/view-home.js +110 -20
- package/js/view-settings.js +114 -4
- package/js/views.js +1 -1
- package/js/xtvod.js +366 -0
- package/js/ytplay.js +28 -4
- package/package.json +2 -1
- package/service/index.js +553 -18
package/js/view-home.js
CHANGED
|
@@ -164,18 +164,32 @@
|
|
|
164
164
|
// reordered): reload just its rows; every other row keeps what it has, with no request.
|
|
165
165
|
// url: the addon ('local:iptv' for IPTV); none: nothing to fetch (only the set / order
|
|
166
166
|
// of rows changed). Calls before the reload runs add up.
|
|
167
|
+
// An addon Home had no rows from (IPTV read after your addons, a first playlist) is one too:
|
|
168
|
+
// its rows asked for, its tabs added to the menu when they come.
|
|
167
169
|
var _reloadOnly = null; // { addon url: 1 } for the next reload, else a full one
|
|
168
|
-
var _homeAddons = {}; // { addon url: 1 } the addons Home's last load had catalogs from
|
|
169
170
|
function refreshAddonRows(url) {
|
|
170
171
|
if (_homeCatalogs === null) { clearCatalogCache(); return; } // nothing loaded yet: a full load anyway
|
|
171
|
-
// an addon Home didn't load rows from (the first playlist added: IPTV): a full load, its tab with it
|
|
172
|
-
if (url && !_homeAddons[url]) { clearCatalogCache(); return; }
|
|
173
172
|
_reloadOnly = _reloadOnly || {};
|
|
174
173
|
if (url) { _reloadOnly[url] = 1; }
|
|
175
174
|
_homeDirty = true;
|
|
176
175
|
if (_current() === scr('home') && !isModalOpen() && !Player.isActive()) { loadHomeCatalogs(); }
|
|
177
176
|
}
|
|
178
177
|
|
|
178
|
+
// Auto-refresh (Settings › Content › IPTV): every minute, whether the playlists are due —
|
|
179
|
+
// their oldest download (a saved copy's own date) and the last try both that long ago — then
|
|
180
|
+
// all of them and their guides read again, as Reload does, and their rows with them. Not
|
|
181
|
+
// while something plays or StremioK is in the background: at the next minute after.
|
|
182
|
+
var _iptvTriedAt = 0, _iptvReading = false;
|
|
183
|
+
function iptvRefreshTick() {
|
|
184
|
+
var h = Stremio.iptvRefreshEvery ? Stremio.iptvRefreshEvery() : 0;
|
|
185
|
+
if (!h || _iptvReading || document.hidden || Player.isActive()) { return; }
|
|
186
|
+
var due = h * 3600000, now = Date.now(), at = Stremio.iptvReadAt();
|
|
187
|
+
if (at === Infinity || now - at < due || now - _iptvTriedAt < due) { return; }
|
|
188
|
+
_iptvTriedAt = now; _iptvReading = true;
|
|
189
|
+
Stremio.iptvReload().then(function () { _iptvReading = false; refreshAddonRows('local:iptv'); }, function () { _iptvReading = false; });
|
|
190
|
+
}
|
|
191
|
+
setInterval(iptvRefreshTick, 60000);
|
|
192
|
+
|
|
179
193
|
// The Home rows are also saved on the TV, trimmed to what a card and the details strip
|
|
180
194
|
// use, so a launch shows the last rows at once and refreshes them in the background
|
|
181
195
|
// (as the 15-minute refresh does). Saved rows are only used with the same addons.
|
|
@@ -215,7 +229,7 @@
|
|
|
215
229
|
if (what === _savedHomeSig) { return; }
|
|
216
230
|
_savedHomeSig = what;
|
|
217
231
|
(_homeCatalogs || []).slice(0, HOME_ROWS_MAX).forEach(function (c) {
|
|
218
|
-
if (bytes > _homeBytesMax) { return; }
|
|
232
|
+
if (bytes > _homeBytesMax || c.loading) { return; }
|
|
219
233
|
var metas = c.metas.map(trimMeta);
|
|
220
234
|
metas.forEach(function (m) { bytes += sizeOf(m); });
|
|
221
235
|
if (bytes <= _homeBytesMax) { cats.push(copyCat(c, metas)); }
|
|
@@ -1179,7 +1193,10 @@
|
|
|
1179
1193
|
}
|
|
1180
1194
|
|
|
1181
1195
|
// Switch the active home tab (from the shared top menu) and show it.
|
|
1182
|
-
function setHomeTab(key) { _homeTab = key || _homeTab; _focusFirstCard = 'new'; }
|
|
1196
|
+
function setHomeTab(key) { _homeTab = key || _homeTab; _focusFirstCard = 'new'; _wantTab = null; }
|
|
1197
|
+
// A tab asked for whose rows are still coming (a first playlist's IPTV tab): shown when they
|
|
1198
|
+
// come, if Home is still on the tab it showed instead. { key, instead }
|
|
1199
|
+
var _wantTab = null;
|
|
1183
1200
|
|
|
1184
1201
|
// prevFocus: a Home card to put focus back on after the rebuild (the card a title
|
|
1185
1202
|
// was opened from). Otherwise the card currently focused on Home is kept, so rows
|
|
@@ -1206,7 +1223,9 @@
|
|
|
1206
1223
|
// Keep the active tab valid for what's actually available.
|
|
1207
1224
|
var avail = availableTabs();
|
|
1208
1225
|
if (!_homeTab || !avail.some(function (t) { return t.key === _homeTab; })) {
|
|
1226
|
+
var asked = _homeTab;
|
|
1209
1227
|
_homeTab = avail.length ? avail[0].key : 'movie';
|
|
1228
|
+
if (asked && (_homeLoading || _reloadOnly)) { _wantTab = { key: asked, instead: _homeTab }; }
|
|
1210
1229
|
}
|
|
1211
1230
|
|
|
1212
1231
|
s.appendChild(buildTopMenu(_homeTab));
|
|
@@ -1340,6 +1359,12 @@
|
|
|
1340
1359
|
if (!node || !scr('home').contains(node)) { return; }
|
|
1341
1360
|
if (_homeInfoTimer) { clearTimeout(_homeInfoTimer); }
|
|
1342
1361
|
_homeInfoTimer = setTimeout(function () { _homeInfoTimer = null; fillHomeInfo(node.__meta); }, 120);
|
|
1362
|
+
var row = node.parentNode && node.parentNode.parentNode;
|
|
1363
|
+
if (row && row.__more) { // (a long row: its next cards, as focus nears the end)
|
|
1364
|
+
var left = 0, n = node;
|
|
1365
|
+
while (left < ROW_NEAR && n.nextElementSibling) { n = n.nextElementSibling; left++; }
|
|
1366
|
+
if (left < ROW_NEAR) { row.__more(); }
|
|
1367
|
+
}
|
|
1343
1368
|
});
|
|
1344
1369
|
|
|
1345
1370
|
// Identify a Home card by its row title + content id, to find it again after a rebuild.
|
|
@@ -1356,6 +1381,10 @@
|
|
|
1356
1381
|
if (!title || title.textContent !== key.row) { continue; }
|
|
1357
1382
|
var cards = rows[i].querySelectorAll('.card');
|
|
1358
1383
|
for (var j = 0; j < cards.length; j++) { if (cards[j].getAttribute('data-id') === key.id) { return cards[j]; } }
|
|
1384
|
+
if (rows[i].__more) { // (a long row: it may be among those not built yet)
|
|
1385
|
+
while (rows[i].__more) { rows[i].__more(); }
|
|
1386
|
+
i--;
|
|
1387
|
+
}
|
|
1359
1388
|
}
|
|
1360
1389
|
return null;
|
|
1361
1390
|
}
|
|
@@ -1393,6 +1422,7 @@
|
|
|
1393
1422
|
}
|
|
1394
1423
|
// The IPTV playlists read after your addons loaded (they aren't waited for): their rows join.
|
|
1395
1424
|
if (typeof Stremio !== 'undefined' && Stremio.onIptvReady) { Stremio.onIptvReady(function () { refreshAddonRows('local:iptv'); }); }
|
|
1425
|
+
if (typeof XtVod !== 'undefined' && XtVod.onChange) { XtVod.onChange(function () { refreshAddonRows('local:xtvod'); }); } // (an Xtream account's films and series, once its categories came)
|
|
1396
1426
|
var PARTIAL_DELAY = 150; // coalesces catalogs that arrive together into one redraw
|
|
1397
1427
|
function loadHomeCatalogs() {
|
|
1398
1428
|
if (_homeLoading) { return; }
|
|
@@ -1401,8 +1431,8 @@
|
|
|
1401
1431
|
var only = first ? null : _reloadOnly; // a partial reload: just these addons' rows
|
|
1402
1432
|
_reloadOnly = null;
|
|
1403
1433
|
_homeFirstLoad = first;
|
|
1404
|
-
var old = {};
|
|
1405
|
-
(_homeCatalogs || []).forEach(function (c) { old[c.type + '|' + c.name] = c.metas; });
|
|
1434
|
+
var old = {}, oldLoading = {};
|
|
1435
|
+
(_homeCatalogs || []).forEach(function (c) { old[c.type + '|' + c.name] = c.metas; if (c.loading) { oldLoading[c.type + '|' + c.name] = true; } });
|
|
1406
1436
|
function oldFor(cat) {
|
|
1407
1437
|
return cat.type === 'other'
|
|
1408
1438
|
? (old['movie|' + otherRowName('Movies', cat.name)] || []).concat(old['series|' + otherRowName('Series', cat.name)] || [])
|
|
@@ -1416,13 +1446,13 @@
|
|
|
1416
1446
|
_homeLoading = false;
|
|
1417
1447
|
_homeFirstLoad = false;
|
|
1418
1448
|
if (first) { U.spinner(false); }
|
|
1419
|
-
|
|
1449
|
+
// (rows asked for meanwhile: the IPTV ones, read after the addons; unless the redraw
|
|
1450
|
+
// that follows has asked for them already)
|
|
1451
|
+
if (_reloadOnly && onHome()) { setTimeout(function () { if (_reloadOnly) { loadHomeCatalogs(); } }, 0); }
|
|
1420
1452
|
}
|
|
1421
1453
|
function onHome() { return _current() === s && !isModalOpen() && !Player.isActive(); }
|
|
1422
1454
|
Stremio.catalogsForHome().then(function (cats) {
|
|
1423
|
-
|
|
1424
|
-
cats.forEach(function (cat) { if (cat.addon && cat.addon.url) { _homeAddons[cat.addon.url] = 1; } });
|
|
1425
|
-
var acc = cats.map(function (cat) { return copyCat({ name: cat.name, type: cat.type, yt: isYouTubeCat(cat) }, []); });
|
|
1455
|
+
var acc = cats.map(function (cat) { return copyCat({ name: cat.name, type: cat.type, yt: isYouTubeCat(cat) }, [], cat.def && cat.def._favs ? { all: true } : null); }); // (all: IPTV's ★ Favorites, every one)
|
|
1426
1456
|
var arrived = cats.map(function () { return false; }), shown = 0, partialTimer = null;
|
|
1427
1457
|
// First load: publish each row as soon as it arrives, in its own place (a slower one above
|
|
1428
1458
|
// it held by a "Loading…" placeholder, so nothing jumps when it comes), and redraw when
|
|
@@ -1448,21 +1478,27 @@
|
|
|
1448
1478
|
return function () {
|
|
1449
1479
|
if (only && !only[cat.addon.url]) { // not the addon that changed: keep its rows
|
|
1450
1480
|
acc[i].metas = oldFor(cat); arrived[i] = true;
|
|
1481
|
+
if (oldLoading[cat.type + '|' + cat.name]) { acc[i].loading = true; } // (its Loading… stays: an Xtream list still being read)
|
|
1451
1482
|
return Promise.resolve();
|
|
1452
1483
|
}
|
|
1453
|
-
return
|
|
1484
|
+
return catalogUpTo(cat, rowCards()).then(function (metas) { acc[i].metas = metas; if (metas.pending) { acc[i].loading = true; } }, function () {
|
|
1454
1485
|
acc[i].metas = oldFor(cat);
|
|
1455
1486
|
}).then(function () { arrived[i] = true; partial(); });
|
|
1456
1487
|
};
|
|
1457
1488
|
});
|
|
1458
1489
|
U.settleAll(tasks, 3).then(function () {
|
|
1459
|
-
_homeCatalogs = splitOtherCatalogs(acc).filter(function (c) { return c.metas && c.metas.length; });
|
|
1490
|
+
_homeCatalogs = splitOtherCatalogs(acc).filter(function (c) { return c.loading || (c.metas && c.metas.length); });
|
|
1460
1491
|
done();
|
|
1492
|
+
var want = _wantTab;
|
|
1493
|
+
_wantTab = null;
|
|
1494
|
+
if (want && _homeTab === want.instead && onHome() && availableTabs().some(function (t) { return t.key === want.key; })) {
|
|
1495
|
+
setHomeTab(want.key);
|
|
1496
|
+
}
|
|
1461
1497
|
saveHomeCache();
|
|
1462
1498
|
// The tab on screen is redrawn only if what it shows changed: redrawing rebuilds
|
|
1463
1499
|
// every card (and reloads its artwork), which shows as a flicker. Continue
|
|
1464
1500
|
// Watching doesn't come from catalogs at all. Other tabs rebuild when opened.
|
|
1465
|
-
var same = (before !== null && shownSig() === before) || ownTabStill();
|
|
1501
|
+
var same = (before !== null && shownSig() === before && menuSig() === _renderedMenu) || ownTabStill();
|
|
1466
1502
|
var keep = {};
|
|
1467
1503
|
if (same && _tabRows[_homeTab]) { keep[_homeTab] = _tabRows[_homeTab]; }
|
|
1468
1504
|
_tabRows = keep;
|
|
@@ -1473,31 +1509,84 @@
|
|
|
1473
1509
|
});
|
|
1474
1510
|
}, function () {
|
|
1475
1511
|
done();
|
|
1512
|
+
_wantTab = null;
|
|
1476
1513
|
if (first) { U.toast('Failed to load addons. Check network / Settings.'); }
|
|
1477
1514
|
});
|
|
1478
1515
|
}
|
|
1479
1516
|
|
|
1480
1517
|
// Catalogs of type "other" (e.g. Torrentio's RealDebrid downloads) aren't live TV:
|
|
1481
1518
|
// their items go to a Movies row and a Series row, split by the release name.
|
|
1482
|
-
// Everything is capped to the
|
|
1519
|
+
// Everything is capped to the cards a Home row shows (Settings › Appearance › Titles in a Home
|
|
1520
|
+
// row), but for IPTV's ★ Favorites (all: every one you picked, up to the 300 kept).
|
|
1483
1521
|
var ROW_CARDS = 30;
|
|
1522
|
+
function rowCards() { return Stremio.getPrefs().rowCards || ROW_CARDS; }
|
|
1523
|
+
// A row's titles, up to n: a catalog that pages (skip) is asked for its next pages (skip =
|
|
1524
|
+
// titles so far, as Discover does) until there are n, a page brings nothing new or fails (what
|
|
1525
|
+
// came is kept), or HOME_PAGES pages. IPTV's and YouTube's own: as they come.
|
|
1526
|
+
var HOME_PAGES = 10;
|
|
1527
|
+
function catalogPages(cat) {
|
|
1528
|
+
var def = cat.def || {};
|
|
1529
|
+
return (def.extra || []).some(function (e) { return e && e.name === 'skip'; }) || (def.extraSupported || []).indexOf('skip') !== -1;
|
|
1530
|
+
}
|
|
1531
|
+
function catalogUpTo(cat, n) {
|
|
1532
|
+
return Stremio.getCatalog(cat).then(function (first) {
|
|
1533
|
+
if ((cat.addon && cat.addon.__local) || first.stale || !first.length || first.length >= n || !catalogPages(cat)) { return first; }
|
|
1534
|
+
var out = first.slice(), seen = {};
|
|
1535
|
+
out.forEach(function (m) { seen[m.id] = 1; });
|
|
1536
|
+
function next(page) {
|
|
1537
|
+
if (out.length >= n || page > HOME_PAGES) { return out; }
|
|
1538
|
+
return Stremio.getCatalog(cat, { skip: out.length }).then(function (more) {
|
|
1539
|
+
var added = 0;
|
|
1540
|
+
more.forEach(function (m) { if (!seen[m.id]) { seen[m.id] = 1; out.push(m); added++; } });
|
|
1541
|
+
return added ? next(page + 1) : out;
|
|
1542
|
+
}, function () { return out; });
|
|
1543
|
+
}
|
|
1544
|
+
return next(2);
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1484
1547
|
var SERIES_NAME = /(^|[^a-z0-9])(s\d{1,2}(e\d{1,3})?|\d{1,2}x\d{2}|season[\s._-]*\d+|temporada[\s._-]*\d+|complete[\s._-]*series)([^a-z0-9]|$)/i;
|
|
1485
1548
|
function otherRowName(kind, name) { return kind + ' · ' + ('' + name).replace(/^Other · /, ''); }
|
|
1486
1549
|
function splitOtherCatalogs(list) {
|
|
1487
1550
|
var out = [];
|
|
1488
1551
|
list.forEach(function (c) {
|
|
1489
1552
|
if (c.loading) { if (c.type !== 'other' || c.yt) { out.push(copyCat(c, [], { loading: true })); } return; } // (a placeholder: still loading)
|
|
1490
|
-
if (c.type !== 'other' || c.yt) { out.push(copyCat(c, c.metas.slice(0,
|
|
1553
|
+
if (c.type !== 'other' || c.yt) { out.push(copyCat(c, c.all ? c.metas.slice() : c.metas.slice(0, rowCards()))); return; } // (a YouTube one as it is, whatever its type)
|
|
1491
1554
|
var movies = [], series = [];
|
|
1492
1555
|
c.metas.forEach(function (m) { (SERIES_NAME.test(m.name || '') ? series : movies).push(m); });
|
|
1493
|
-
out.push({ name: otherRowName('Movies', c.name), type: 'movie', metas: movies.slice(0,
|
|
1494
|
-
out.push({ name: otherRowName('Series', c.name), type: 'series', metas: series.slice(0,
|
|
1556
|
+
out.push({ name: otherRowName('Movies', c.name), type: 'movie', metas: movies.slice(0, rowCards()) });
|
|
1557
|
+
out.push({ name: otherRowName('Series', c.name), type: 'series', metas: series.slice(0, rowCards()) });
|
|
1495
1558
|
});
|
|
1496
1559
|
return out;
|
|
1497
1560
|
}
|
|
1498
1561
|
|
|
1562
|
+
// A long row (up to 200 titles, ★ Favorites up to 300) builds ROW_FIRST cards, not all of them
|
|
1563
|
+
// in one go with the remote waiting, then ROW_MORE at a time when focus is within ROW_NEAR of
|
|
1564
|
+
// the end (Home's Focus.onFocus). row.__rest(): the titles not built yet (CH+ / CH− go through
|
|
1565
|
+
// them); row.__cardOf(meta): its card, built if it wasn't.
|
|
1566
|
+
var ROW_FIRST = 30, ROW_MORE = 30, ROW_NEAR = 8;
|
|
1567
|
+
function lateCards(row, c) {
|
|
1568
|
+
var at = ROW_FIRST, scroller = row.querySelector('.row-scroller');
|
|
1569
|
+
function add(n) {
|
|
1570
|
+
var end = Math.min(c.metas.length, at + n), first = scroller.firstChild, nav = first && first.__navDOWN;
|
|
1571
|
+
for (; at < end; at++) {
|
|
1572
|
+
var card = posterCard(c.metas[at], c.type);
|
|
1573
|
+
if (nav) { card.__navDOWN = nav; } // (the rows below it, as its neighbors)
|
|
1574
|
+
scroller.appendChild(card);
|
|
1575
|
+
}
|
|
1576
|
+
if (at >= c.metas.length) { row.__more = null; }
|
|
1577
|
+
}
|
|
1578
|
+
row.__more = function () { add(ROW_MORE); };
|
|
1579
|
+
row.__rest = function () { return c.metas.slice(at); };
|
|
1580
|
+
row.__cardOf = function (m) {
|
|
1581
|
+
var want = c.metas.indexOf(m), kids = scroller.children;
|
|
1582
|
+
if (want === -1) { return null; }
|
|
1583
|
+
add(want + 1 - at);
|
|
1584
|
+
return kids[want] || null;
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1499
1588
|
// Render cats[from .. from+ROW_BATCH) into `rows`. A large IPTV list can have 50+
|
|
1500
|
-
// groups x
|
|
1589
|
+
// groups x rowCards() cards; building them all up front bloats the DOM, the poster queue
|
|
1501
1590
|
// and every D-pad scan. While more remain, DOWN on either of the last two rendered
|
|
1502
1591
|
// rows renders the next batch first, then the normal DOWN move continues into it.
|
|
1503
1592
|
function appendRows(rows, cats, from, atLeast) {
|
|
@@ -1505,7 +1594,8 @@
|
|
|
1505
1594
|
var built = [];
|
|
1506
1595
|
for (var i = from; i < to; i++) {
|
|
1507
1596
|
var c = cats[i];
|
|
1508
|
-
var row = buildRow(c.name, c.metas.map(function (m) { return posterCard(m, c.type); }));
|
|
1597
|
+
var row = buildRow(c.name, c.metas.slice(0, ROW_FIRST).map(function (m) { return posterCard(m, c.type); }));
|
|
1598
|
+
if (c.metas.length > ROW_FIRST) { lateCards(row, c); }
|
|
1509
1599
|
if (c.loading) { row.className += ' row-loading'; row.appendChild(U.el('div', 'row-empty', 'Loading…')); } // (its place kept: nothing to focus)
|
|
1510
1600
|
rows.appendChild(row);
|
|
1511
1601
|
built.push(row);
|
package/js/view-settings.js
CHANGED
|
@@ -193,9 +193,13 @@
|
|
|
193
193
|
var bgs = { dark: 1, black: 1, gray: 1, white: 1 };
|
|
194
194
|
return { accent: ACCENT_NAMES[accent] ? accent : 'indigo', bg: bgs[bg] ? bg : 'dark' };
|
|
195
195
|
}
|
|
196
|
+
// Zoom: everything bigger (see U.setZoom), in percent.
|
|
197
|
+
var ZOOMS = [['100', '100%'], ['110', '110%'], ['120', '120%'], ['130', '130%'], ['140', '140%']];
|
|
198
|
+
function zoomPct() { return Stremio.getPrefs().zoom; }
|
|
196
199
|
function applyAppearance() {
|
|
197
200
|
var a = appearance();
|
|
198
201
|
U.applyTheme(a.accent, a.bg);
|
|
202
|
+
U.setZoom(zoomPct() / 100);
|
|
199
203
|
}
|
|
200
204
|
function settingsAppearance(wrap) {
|
|
201
205
|
var store = { get: appearance, set: function (cfg) {
|
|
@@ -207,6 +211,14 @@
|
|
|
207
211
|
wrap.appendChild(U.el('h2', null, 'Appearance'));
|
|
208
212
|
wrap.appendChild(subPickRow('Background', BACKGROUNDS, 'bg', store));
|
|
209
213
|
wrap.appendChild(subPickRow('Accent color', accents, 'accent', store));
|
|
214
|
+
wrap.appendChild(subPickRow('Zoom', ZOOMS, 'zoom', {
|
|
215
|
+
get: function () { return { zoom: '' + zoomPct() }; },
|
|
216
|
+
set: function (cfg) { Stremio.setPref('zoom', +cfg.zoom); applyAppearance(); }
|
|
217
|
+
}));
|
|
218
|
+
wrap.appendChild(subPickRow('Titles in a Home row', [['30', '30'], ['50', '50'], ['100', '100'], ['200', '200']], 'rowCards', {
|
|
219
|
+
get: function () { return { rowCards: '' + Stremio.getPrefs().rowCards }; },
|
|
220
|
+
set: function (cfg) { Stremio.setPref('rowCards', +cfg.rowCards); clearCatalogCache(); } // (the rows read again, with more pages or fewer)
|
|
221
|
+
}));
|
|
210
222
|
wrap.appendChild(subPickRow('Poster orientation', POSTER_SHAPES, 'posterShape', {
|
|
211
223
|
get: function () { return { posterShape: Stremio.getPrefs().posterShape }; },
|
|
212
224
|
set: function (cfg) { Stremio.setPref('posterShape', cfg.posterShape); markHomeDirty(); } // Home redraws on return
|
|
@@ -338,6 +350,7 @@
|
|
|
338
350
|
var SETTINGS_GROUPS = {
|
|
339
351
|
content: { title: 'Content', rows: [
|
|
340
352
|
['Addons', 'Catalog, stream & subtitle addons', 'addons'],
|
|
353
|
+
['Streaming server', 'Stremio’s streaming server or TorrServer on your network: torrents, and videos the TV can’t play', 'server'],
|
|
341
354
|
['Integrations', 'API keys (OMDb, TMDB, MDBList), where-to-watch country', 'integrations'],
|
|
342
355
|
['IPTV', 'Manage M3U playlist URLs', 'iptv'],
|
|
343
356
|
['YouTube', 'Your YouTube channels, playlists and searches; YouTube in Search', 'youtube'],
|
|
@@ -407,6 +420,7 @@
|
|
|
407
420
|
else if (_settingsSection === 'appshortcuts') { settingsAppShortcuts(wrap); }
|
|
408
421
|
else if (_settingsSection === 'import') { settingsImport(wrap); }
|
|
409
422
|
else if (_settingsSection === 'aiomanager') { settingsAiom(wrap); }
|
|
423
|
+
else if (_settingsSection === 'server') { settingsServer(wrap); }
|
|
410
424
|
else if (_settingsSection === 'appearance') { settingsAppearance(wrap); }
|
|
411
425
|
else if (_settingsSection === 'formats') { settingsFormats(wrap); }
|
|
412
426
|
else { settingsMenu(wrap); }
|
|
@@ -449,7 +463,7 @@
|
|
|
449
463
|
wrap.appendChild(U.el('h2', null, 'Settings'));
|
|
450
464
|
wrap.appendChild(sectionRow('Content', 'Addons, API keys, IPTV playlists, streaming apps, importing a configuration file', 'content'));
|
|
451
465
|
wrap.appendChild(sectionRow('Playback', 'Audio and subtitles, source ranking, feed sources, formats', 'playback'));
|
|
452
|
-
wrap.appendChild(sectionRow('Appearance', 'Background, accent color, poster orientation, Home feeds, Search results', 'appearance'));
|
|
466
|
+
wrap.appendChild(sectionRow('Appearance', 'Background, accent color, zoom, poster orientation, Home feeds, Search results', 'appearance'));
|
|
453
467
|
wrap.appendChild(sectionRow('Diagnostics', 'Logs, storage, installed apps; how StremioK was installed', 'diagnostics'));
|
|
454
468
|
if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
|
|
455
469
|
focusBack(wrap);
|
|
@@ -972,6 +986,92 @@
|
|
|
972
986
|
}
|
|
973
987
|
});
|
|
974
988
|
}
|
|
989
|
+
// + Add Stalker portal: its address, then its MAC address; checked (its channels read through
|
|
990
|
+
// the service), then added (Stremio.iptvAddStalker).
|
|
991
|
+
function addStalker() {
|
|
992
|
+
function done(portal, mac) {
|
|
993
|
+
U.toast('Checking the portal…', 60000);
|
|
994
|
+
IPTV.stalkerCheck(portal, mac).then(function (r) {
|
|
995
|
+
if (r.noService) { U.toast('Stalker portals are read by StremioK’s service, which a desktop browser doesn’t have (nothing was saved)', 5000); return; }
|
|
996
|
+
if (r.unreachable) { U.toast('Couldn’t read the portal' + (r.why ? ' (' + r.why + ')' : '') + ': nothing was saved', 6000); return; }
|
|
997
|
+
if (r.refused) { U.toast('The portal refused that MAC address' + (r.why ? ' (' + r.why + ')' : '') + ': nothing was saved', 6000); return; }
|
|
998
|
+
Stremio.iptvAddStalker(portal, mac);
|
|
999
|
+
refreshAddonRows('local:iptv');
|
|
1000
|
+
U.toast('Stalker portal added: ' + r.count + ' channels', 4000);
|
|
1001
|
+
renderSettings();
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
App.openEntry({
|
|
1005
|
+
title: 'Stalker portal: address', phone: 'playlist',
|
|
1006
|
+
hint: 'The portal address your provider gave you (http://portal.example.com/c/). RETURN cancels.',
|
|
1007
|
+
value: 'http://', placeholder: 'http://portal.example.com/c/',
|
|
1008
|
+
validate: function (v) { return IPTV.stalkerPortal(v) ? null : 'That isn’t a portal address'; },
|
|
1009
|
+
onConfirm: function (v) {
|
|
1010
|
+
var portal = IPTV.stalkerPortal(v);
|
|
1011
|
+
App.back();
|
|
1012
|
+
App.openEntry({
|
|
1013
|
+
title: 'Stalker portal: MAC address', phone: 'mac',
|
|
1014
|
+
hint: 'The MAC address your provider registered for you (00:1A:79:…), kept on the TV. RETURN cancels.', value: '00:1A:79:', placeholder: '00:1A:79:00:00:00',
|
|
1015
|
+
validate: function (m) { return IPTV.macOf(m) ? null : 'A MAC address is six pairs, like 00:1A:79:12:34:56'; },
|
|
1016
|
+
onConfirm: function (m) { App.back(); done(portal, IPTV.macOf(m)); }
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
// Streaming server: Stremio's or TorrServer, on your network (see Stremio.server). Picking one
|
|
1022
|
+
// asks for its address; Test says whether it answers.
|
|
1023
|
+
var SERVERS = [['', 'Off'], ['stremio', 'Stremio server'], ['torrserver', 'TorrServer']];
|
|
1024
|
+
var SERVER_PORT = { stremio: 11470, torrserver: 8090 };
|
|
1025
|
+
var TORRENT_WAITS = [['45', '45 seconds'], ['60', '1 minute'], ['120', '2 minutes'], ['180', '3 minutes'], ['300', '5 minutes']];
|
|
1026
|
+
function askServerAddress(kind, url) {
|
|
1027
|
+
var eg = 'http://192.168.0.10:' + SERVER_PORT[kind];
|
|
1028
|
+
App.openEntry({
|
|
1029
|
+
title: (kind === 'stremio' ? 'Stremio server' : 'TorrServer') + ': address',
|
|
1030
|
+
hint: 'Its address on your network, like ' + eg + '. RETURN cancels.',
|
|
1031
|
+
value: url || 'http://', placeholder: eg, phone: 'server',
|
|
1032
|
+
validate: function (v) { return Stremio.serverAddressProblem(v); },
|
|
1033
|
+
onConfirm: function (v) { Stremio.setServer({ kind: kind, url: v }); App.back(); renderSettings(); }
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
function settingsServer(wrap) {
|
|
1037
|
+
wrap.appendChild(U.el('h2', null, 'Streaming server'));
|
|
1038
|
+
wrap.appendChild(U.el('div', 'hint', 'Torrent-only sources play through it; Stremio’s can also convert a video the TV can’t play.'));
|
|
1039
|
+
var sv = Stremio.server();
|
|
1040
|
+
wrap.appendChild(subPickRow('Server', SERVERS, 'kind', {
|
|
1041
|
+
get: function () { return { kind: Stremio.server().kind }; },
|
|
1042
|
+
set: function (cfg) {
|
|
1043
|
+
var cur = Stremio.server();
|
|
1044
|
+
if (!cfg.kind) { Stremio.setServer({ kind: '' }); renderSettings(); return; }
|
|
1045
|
+
askServerAddress(cfg.kind, cur.kind === cfg.kind ? cur.url : '');
|
|
1046
|
+
}
|
|
1047
|
+
}));
|
|
1048
|
+
if (!sv.kind) { return; }
|
|
1049
|
+
var addr = U.el('div', 'addon-item focusable cfg-row');
|
|
1050
|
+
addr.appendChild(U.el('div', 'a-name', 'Address: ' + sv.url));
|
|
1051
|
+
addr.appendChild(U.el('div', 'a-url', 'Press OK to change'));
|
|
1052
|
+
addr.__onselect = function () { askServerAddress(sv.kind, sv.url); };
|
|
1053
|
+
wrap.appendChild(addr);
|
|
1054
|
+
var test = U.el('div', 'addon-item focusable cfg-row'), said = U.el('div', 'a-url', 'Press OK to see whether it answers');
|
|
1055
|
+
test.appendChild(U.el('div', 'a-name', 'Test'));
|
|
1056
|
+
test.appendChild(said);
|
|
1057
|
+
test.__onselect = function () {
|
|
1058
|
+
said.textContent = 'Asking…';
|
|
1059
|
+
Stremio.testServer().then(function (r) { said.textContent = (r.ok ? '✓ ' : '✗ ') + r.text; });
|
|
1060
|
+
};
|
|
1061
|
+
wrap.appendChild(test);
|
|
1062
|
+
wrap.appendChild(subPickRow('Wait for a torrent to start', TORRENT_WAITS, 'wait', {
|
|
1063
|
+
get: function () { return { wait: '' + Stremio.server().wait }; },
|
|
1064
|
+
set: function (cfg) { Stremio.setServer({ kind: Stremio.server().kind, wait: +cfg.wait }); }
|
|
1065
|
+
}));
|
|
1066
|
+
if (sv.kind === 'stremio') {
|
|
1067
|
+
wrap.appendChild(subPickRow('Convert videos the TV can’t play', [['on', 'On'], ['off', 'Off']], 'convert', {
|
|
1068
|
+
get: function () { return { convert: Stremio.server().convert ? 'on' : 'off' }; },
|
|
1069
|
+
set: function (cfg) { Stremio.setServer({ kind: 'stremio', convert: cfg.convert === 'on' }); }
|
|
1070
|
+
}));
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
var IPTV_EVERY = [['0', 'Off'], ['1', 'Every hour'], ['3', 'Every 3 hours'], ['6', 'Every 6 hours'], ['12', 'Every 12 hours']];
|
|
975
1075
|
function settingsIptv(wrap) {
|
|
976
1076
|
wrap.appendChild(U.el('h2', null, 'IPTV'));
|
|
977
1077
|
var playlists = Stremio.iptvGetPlaylists ? Stremio.iptvGetPlaylists() : [];
|
|
@@ -1000,7 +1100,7 @@
|
|
|
1000
1100
|
var btns = orderButtons(function (dir, name) { move(dir, name)(); }, ctl);
|
|
1001
1101
|
var item = ctl(U.el('div', 'addon-item focusable playlist-item'), 'item');
|
|
1002
1102
|
item.appendChild(U.el('div', 'a-name', label + (playlist.off ? ' (off)' : '')));
|
|
1003
|
-
item.appendChild(U.el('div', 'a-url', U.redactUrl(playlist.url))); // (credentials masked)
|
|
1103
|
+
item.appendChild(U.el('div', 'a-url', U.redactUrl(playlist.url) + (playlist.mac ? ' · MAC ' + playlist.mac.slice(0, 8) + ':••:••:••' : ''))); // (credentials masked; a Stalker portal's MAC too)
|
|
1004
1104
|
var info = U.el('div', 'a-url playlist-info', playlistInfo(playlist));
|
|
1005
1105
|
var problem = U.el('div', 'a-url addon-said', playlistProblem(playlist));
|
|
1006
1106
|
item.appendChild(info);
|
|
@@ -1058,6 +1158,15 @@
|
|
|
1058
1158
|
xt.appendChild(U.el('div', 'a-url', 'Its server, username and password: its channels and TV guide added'));
|
|
1059
1159
|
xt.__onselect = addXtream;
|
|
1060
1160
|
wrap.appendChild(xt);
|
|
1161
|
+
var sk = U.el('div', 'addon-item focusable add-row');
|
|
1162
|
+
sk.appendChild(U.el('div', 'a-name', '+ Add Stalker portal'));
|
|
1163
|
+
sk.appendChild(U.el('div', 'a-url', 'Its address and MAC address: its channels added'));
|
|
1164
|
+
sk.__onselect = addStalker;
|
|
1165
|
+
wrap.appendChild(sk);
|
|
1166
|
+
if (playlists.length && Stremio.iptvRefreshEvery) { // (all of them, with their guides, as Reload does)
|
|
1167
|
+
wrap.appendChild(subPickRow('Auto-refresh', IPTV_EVERY, 'every',
|
|
1168
|
+
{ get: function () { return { every: String(Stremio.iptvRefreshEvery()) }; }, set: function (c) { Stremio.iptvSetRefreshEvery(+c.every); } }));
|
|
1169
|
+
}
|
|
1061
1170
|
|
|
1062
1171
|
wrap.appendChild(U.el('div', 'hint',
|
|
1063
1172
|
'Channels are grouped into IPTV and Radio rows on Home. ▲ / ▼ set the playlists\' order: a channel in two playlists comes from the first.'));
|
|
@@ -1707,6 +1816,7 @@
|
|
|
1707
1816
|
line('Settings storage: ' + fmtBytes(inf.ls) + ' (progress, watched marks, settings…)' + (inf.lsTop.length ? '; the largest:' : ''));
|
|
1708
1817
|
inf.lsTop.forEach(function (e) { line(' ' + fmtBytes(e.bytes) + ' ' + e.key); });
|
|
1709
1818
|
if (inf.guides && inf.guides.count) { line('Saved TV guides (in StremioK’s folder): ' + fmtBytes(inf.guides.bytes) + ' in ' + inf.guides.count + (inf.guides.count === 1 ? ' file' : ' files')); }
|
|
1819
|
+
if (inf.guides && inf.guides.xtv && inf.guides.xtv.count) { line('Saved Xtream film and series lists (in StremioK’s folder): ' + fmtBytes(inf.guides.xtv.bytes) + ' in ' + inf.guides.xtv.count + (inf.guides.xtv.count === 1 ? ' file' : ' files')); }
|
|
1710
1820
|
if (inf.disk) { line('The TV’s own disk: ' + fmtBytes(inf.disk.free) + ' free of ' + fmtBytes(inf.disk.total) + ' (what the TV allows StremioK follows it: freeing space, unused apps for one, raises it)'); }
|
|
1711
1821
|
}
|
|
1712
1822
|
r.__onselect = function () {
|
|
@@ -1748,9 +1858,9 @@
|
|
|
1748
1858
|
}
|
|
1749
1859
|
var clr = U.el('div', 'addon-item focusable');
|
|
1750
1860
|
clr.appendChild(U.el('div', 'a-name', 'Clear saved copies'));
|
|
1751
|
-
clr.appendChild(U.el('div', 'a-url', 'Home’s saved rows, IPTV playlist copies, saved TV guides, the USB index: made again when needed (playlists and
|
|
1861
|
+
clr.appendChild(U.el('div', 'a-url', 'Home’s saved rows, IPTV playlist copies, saved TV guides and Xtream lists, the USB index: made again when needed (playlists, guides and lists download again)'));
|
|
1752
1862
|
clr.__onselect = function () {
|
|
1753
|
-
confirm('Clear the copies StremioK can make again (Home rows, playlist copies, TV guides, USB index)?', 'Clear', function () {
|
|
1863
|
+
confirm('Clear the copies StremioK can make again (Home rows, playlist copies, TV guides, Xtream lists, USB index)?', 'Clear', function () {
|
|
1754
1864
|
U.bigStore.keys().then(function (ks) {
|
|
1755
1865
|
return Promise.all(ks.filter(function (k) { return /^stremiok\.(homecache|local\.index|iptv\.cache\.)/.test(k); }).map(function (k) { return U.bigStore.remove(k); }));
|
|
1756
1866
|
}).then(function () {
|
package/js/views.js
CHANGED
|
@@ -14,7 +14,7 @@ var Views = (function (V) {
|
|
|
14
14
|
renderLive: V.renderLive,
|
|
15
15
|
renderSearch: V.renderSearch, searchFor: function (q) { V.searchFor(q); }, renderDiscover: V.renderDiscover, renderEntry: V.renderEntry, backInDetail: V.backInDetail,
|
|
16
16
|
homeDirty: V.homeDirty, refreshHomeIfStale: V.refreshHomeIfStale, alertNewEpisodes: V.alertNewEpisodes, previewTiles: V.previewTiles, withShowInfo: V.withShowInfo,
|
|
17
|
-
isModalOpen: V.isModalOpen, closeModal: V.closeModal, moveKey: V.moveKey, availableTabs: V.availableTabs,
|
|
17
|
+
isModalOpen: V.isModalOpen, closeModal: V.closeModal, confirm: V.confirm, moveKey: V.moveKey, availableTabs: V.availableTabs,
|
|
18
18
|
menuItems: V.menuItems, menuOrder: V.menuOrder, moveMenuItem: V.moveMenuItem
|
|
19
19
|
};
|
|
20
20
|
})(ViewParts);
|