stremiok 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +15 -14
- package/config.xml +1 -1
- package/css/modern.css +1 -0
- package/css/style.css +5 -2
- package/index.html +40 -38
- package/js/app.js +4 -0
- package/js/jellyfin.js +96 -17
- package/js/local.js +99 -31
- package/js/netfolders.js +157 -0
- package/js/player-audio.js +25 -1
- package/js/player-controls.js +3 -2
- package/js/player-core.js +63 -15
- package/js/player-store.js +12 -5
- package/js/plex.js +58 -10
- package/js/stremio-account.js +11 -6
- package/js/stremio-sync.js +641 -0
- package/js/stremio.js +1 -0
- package/js/util.js +1 -1
- package/js/view-core.js +19 -2
- package/js/view-detail.js +15 -4
- package/js/view-home.js +42 -19
- package/js/view-settings.js +218 -28
- package/js/ytplay.js +1 -1
- package/package.json +1 -1
- package/service/index.js +353 -12
- package/tizenbrew.html +1 -1
package/js/view-core.js
CHANGED
|
@@ -827,6 +827,9 @@ var ViewParts = {};
|
|
|
827
827
|
if (type === 'movie' || eps.length) {
|
|
828
828
|
opts.push(['watched', watched ? 'Mark unwatched' : (type === 'series' ? 'Mark whole series watched' : 'Mark watched')]);
|
|
829
829
|
}
|
|
830
|
+
// Your Stremio account's Library (connected): in it, or not
|
|
831
|
+
var lib = typeof StremioSync !== 'undefined' && StremioSync.isConnected() && (type === 'movie' || type === 'series');
|
|
832
|
+
if (lib) { opts.push(['lib', StremioSync.inLibrary(type, m.id) ? 'Remove from Stremio Library' : 'Add to Stremio Library']); }
|
|
830
833
|
// Rate on Trakt (connected, a title with an IMDb id): yours shown once rated
|
|
831
834
|
var canRate = typeof Trakt !== 'undefined' && Trakt.isConnected() && Trakt.rate && /^tt\d+$/.test(m.id);
|
|
832
835
|
var mine = canRate ? Trakt.myRating(type, m.id) : null;
|
|
@@ -834,6 +837,7 @@ var ViewParts = {};
|
|
|
834
837
|
return { name: m.name || m.title || '', items: opts, run: function (v) {
|
|
835
838
|
if (v === 'details') { App.openDetail(type, m.id, meta); }
|
|
836
839
|
else if (v === 'np') { toggleNowPlaying(type, m); }
|
|
840
|
+
else if (v === 'lib') { toggleLibrary(type, m); }
|
|
837
841
|
else if (v === 'watched') { setTitleWatched(type, m, !watched); }
|
|
838
842
|
else if (v === 'rate') { rateOnTrakt(type, m.id, m.name || m.title || ''); }
|
|
839
843
|
} };
|
|
@@ -910,6 +914,7 @@ var ViewParts = {};
|
|
|
910
914
|
function nowPlayingEntries(type, id) {
|
|
911
915
|
var all = Player.continueList();
|
|
912
916
|
if (typeof Trakt !== 'undefined' && Trakt.isConnected && Trakt.isConnected() && Trakt.continueList) { all = all.concat(Trakt.continueList()); }
|
|
917
|
+
if (typeof StremioSync !== 'undefined' && StremioSync.isConnected()) { all = all.concat(StremioSync.continueList()); } // (your Stremio account's)
|
|
913
918
|
return all.filter(function (e) {
|
|
914
919
|
return e.type === type && (e.id === id || e.parent === id || (type === 'series' && ('' + e.id).split(':')[0] === id));
|
|
915
920
|
});
|
|
@@ -918,8 +923,9 @@ var ViewParts = {};
|
|
|
918
923
|
function toggleNowPlaying(type, m) {
|
|
919
924
|
var present = nowPlayingEntries(type, m.id);
|
|
920
925
|
if (present.length) {
|
|
921
|
-
present.forEach(function (e) { // (Trakt's: hidden from Watching, as Watching's own Remove does)
|
|
922
|
-
if (e._trakt) { if (Trakt.dismiss) { Trakt.dismiss(e.type, e.id); } } else { Player.removeProgress(e.type, e.id); }
|
|
926
|
+
present.forEach(function (e) { // (Trakt's: hidden from Watching, as Watching's own Remove does; your Stremio account's: off there too)
|
|
927
|
+
if (e._trakt) { if (Trakt.dismiss) { Trakt.dismiss(e.type, e.id); } } else if (!e._stremio) { Player.removeProgress(e.type, e.id); }
|
|
928
|
+
if (typeof StremioSync !== 'undefined' && StremioSync.dismiss) { StremioSync.dismiss(e.type, e.id); }
|
|
923
929
|
});
|
|
924
930
|
U.toast('Removed from Continue Watching');
|
|
925
931
|
} else if (type === 'movie') {
|
|
@@ -936,6 +942,14 @@ var ViewParts = {};
|
|
|
936
942
|
// adds and removes by: the id the title's details came with, which can differ from the
|
|
937
943
|
// one it was opened by, e.g. a TMDB id in Discover for an IMDb one).
|
|
938
944
|
function nowPlayingLabel(type, id) { return inNowPlaying(type, id) ? '✓ In Continue Watching' : '+ Add to Continue Watching'; }
|
|
945
|
+
// Your Stremio account's Library (Settings › Integrations › Stremio account): a title in it or not.
|
|
946
|
+
function libraryLabel(type, id) { return StremioSync.inLibrary(type, id) ? '✓ In Stremio Library' : '+ Stremio Library'; }
|
|
947
|
+
function toggleLibrary(type, m) {
|
|
948
|
+
var on = !StremioSync.inLibrary(type, m.id);
|
|
949
|
+
StremioSync.setInLibrary(type, { id: m.id, name: m.name || m.title || '', poster: m.poster || '' }, on);
|
|
950
|
+
U.toast(on ? 'Added to your Stremio Library' : 'Removed from your Stremio Library');
|
|
951
|
+
}
|
|
952
|
+
function libraryOn() { return typeof StremioSync !== 'undefined' && StremioSync.isConnected(); }
|
|
939
953
|
|
|
940
954
|
// "Hold OK for more": shown while the focused item has a menu of its own behind a held OK
|
|
941
955
|
// (a card, a season, an episode, a source, a file on the USB drive…), so those menus can
|
|
@@ -974,4 +988,7 @@ var ViewParts = {};
|
|
|
974
988
|
V.scr = scr;
|
|
975
989
|
V.showModal = showModal;
|
|
976
990
|
V.toggleNowPlaying = toggleNowPlaying;
|
|
991
|
+
V.libraryLabel = libraryLabel;
|
|
992
|
+
V.toggleLibrary = toggleLibrary;
|
|
993
|
+
V.libraryOn = libraryOn;
|
|
977
994
|
})(ViewParts);
|
package/js/view-detail.js
CHANGED
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
function posterActions() { return V.posterActions.apply(null, arguments); } // core
|
|
18
18
|
function scr() { return V.scr.apply(null, arguments); } // core
|
|
19
19
|
function toggleNowPlaying() { return V.toggleNowPlaying.apply(null, arguments); } // core
|
|
20
|
+
// Your Stremio account's Library (connected): + Stremio Library / ✓ In Stremio Library.
|
|
21
|
+
function libraryPill(type, id) {
|
|
22
|
+
if (!V.libraryOn() || _d.addonType) { return null; }
|
|
23
|
+
var p = U.el('div', 'pill focusable', V.libraryLabel(type, id));
|
|
24
|
+
p.__onselect = function () { V.toggleLibrary(type, _d.meta); setTimeout(function () { p.textContent = V.libraryLabel(type, id); }, 0); };
|
|
25
|
+
return p;
|
|
26
|
+
}
|
|
20
27
|
function trimMeta() { return V.trimMeta.apply(null, arguments); } // home
|
|
21
28
|
function searchFor() { return V.searchFor.apply(null, arguments); } // search
|
|
22
29
|
|
|
@@ -219,7 +226,7 @@
|
|
|
219
226
|
// retries end there too, one press from another source.
|
|
220
227
|
function startResume(p) {
|
|
221
228
|
// (a file on a USB drive: its source again, with its subtitle files, from whichever drive has it now)
|
|
222
|
-
var local = (typeof LocalMedia !== 'undefined' && /^file:\/\//i.test(p.url || '')) ? LocalMedia.streamForUrl(p.url) : null;
|
|
229
|
+
var local = (typeof LocalMedia !== 'undefined' && (/^file:\/\//i.test(p.url || '') || (LocalMedia.isFolderUrl && LocalMedia.isFolderUrl(p.url)))) ? LocalMedia.streamForUrl(p.url) : null;
|
|
223
230
|
var how = p.fromStart ? { fromStart: true } : null; // (Play from start: the same source, from 0:00)
|
|
224
231
|
if (local) { resumeSources(startPlayback(local, p.id, p.name, how), p.id); return; }
|
|
225
232
|
var st = { url: p.url, name: p.name, _headers: U.sanitizeHeaders(p.headers) || undefined,
|
|
@@ -860,6 +867,8 @@
|
|
|
860
867
|
np.__onselect = function () { toggleNowPlaying('series', _d.meta); _d._focusNp = true; drawDetail(); };
|
|
861
868
|
if (_d._focusNp) { _d._epFocus = np; _d._focusNp = false; }
|
|
862
869
|
row.appendChild(np);
|
|
870
|
+
var lp = libraryPill('series', _d.meta.id || _d.id);
|
|
871
|
+
if (lp) { row.appendChild(lp); }
|
|
863
872
|
var tp = trailerPill();
|
|
864
873
|
if (tp) { row.appendChild(tp); }
|
|
865
874
|
var mp = morePill();
|
|
@@ -1433,8 +1442,8 @@
|
|
|
1433
1442
|
// then ones with a format marked "not working" on this TV (Settings > Formats), then
|
|
1434
1443
|
// links that don't play here.
|
|
1435
1444
|
var TIERS = ['2160', '1440', '1080', '720', 'sd', 'other'];
|
|
1436
|
-
var GROUPS = ['local', 'server', 'emby', 'plex', 'played'].concat(TIERS, ['ranked', 'unsuitable', 'worded', 'sized', 'bad', 'where']);
|
|
1437
|
-
var GROUP_TITLES = { local: 'On your USB drive', server: 'On your Jellyfin server', emby: 'On your Emby server', plex: 'On your Plex server', played: 'Played before', '2160': '4K', '1440': '1440p', '1080': '1080p', '720': '720p',
|
|
1445
|
+
var GROUPS = ['local', 'net', 'server', 'emby', 'plex', 'played'].concat(TIERS, ['ranked', 'unsuitable', 'worded', 'sized', 'bad', 'where']);
|
|
1446
|
+
var GROUP_TITLES = { local: 'On your USB drive', net: 'On your network folder', server: 'On your Jellyfin server', emby: 'On your Emby server', plex: 'On your Plex server', played: 'Played before', '2160': '4K', '1440': '1440p', '1080': '1080p', '720': '720p',
|
|
1438
1447
|
sd: 'SD', other: 'Other', ranked: 'Sources', unsuitable: 'Marked not suitable', worded: 'Hidden by your words', sized: 'Outside your size limits', bad: 'Not working or not allowed on this TV', where: 'Where to watch · other apps' };
|
|
1439
1448
|
var KIND_SCORE = { remux: 4, bluray: 3, web: 2, hdtv: 1, '': 1.5, cam: -5 };
|
|
1440
1449
|
function tierOf(info) {
|
|
@@ -1470,7 +1479,7 @@
|
|
|
1470
1479
|
var bad = usable ? Stremio.badFormats(st, info) : [];
|
|
1471
1480
|
var blocked = usable ? Stremio.blockedRes(st, info) : ''; // a resolution you don't allow
|
|
1472
1481
|
var pr = (usable && !unsuitable && !worded && !sized && !bad.length && !blocked) ? playedIndex(hist, st, info) : -1;
|
|
1473
|
-
var group = !usable ? 'where' : unsuitable ? 'unsuitable' : worded ? 'worded' : sized ? 'sized' : (bad.length || blocked) ? 'bad' : st._localFile ? 'local' : st._jf ? (st._jf.kind === 'emby' ? 'emby' : st._jf.kind === 'plex' ? 'plex' : 'server') : pr >= 0 ? 'played' : byRes ? tierOf(info) : 'ranked';
|
|
1482
|
+
var group = !usable ? 'where' : unsuitable ? 'unsuitable' : worded ? 'worded' : sized ? 'sized' : (bad.length || blocked) ? 'bad' : st._localFile ? (st._localFile.dav ? 'net' : 'local') : st._jf ? (st._jf.kind === 'emby' ? 'emby' : st._jf.kind === 'plex' ? 'plex' : 'server') : pr >= 0 ? 'played' : byRes ? tierOf(info) : 'ranked';
|
|
1474
1483
|
var app = group === 'where' ? whereApp(st) : null; // links that open an app here come first
|
|
1475
1484
|
return { st: st, i: i, info: info, bad: bad, blocked: blocked, pr: pr, group: group, tier: tierOf(info), app: app, unsuitable: unsuitable, worded: worded, sized: sized };
|
|
1476
1485
|
});
|
|
@@ -1883,6 +1892,8 @@
|
|
|
1883
1892
|
var np = U.el('div', 'pill focusable', nowPlayingLabel('movie', npId));
|
|
1884
1893
|
np.__onselect = function () { toggleNowPlaying('movie', _d.meta); np.textContent = nowPlayingLabel('movie', npId); };
|
|
1885
1894
|
row.appendChild(np);
|
|
1895
|
+
var mlp = libraryPill('movie', npId);
|
|
1896
|
+
if (mlp) { row.appendChild(mlp); }
|
|
1886
1897
|
var tp = trailerPill();
|
|
1887
1898
|
if (tp) { row.appendChild(tp); }
|
|
1888
1899
|
var mp = morePill();
|
package/js/view-home.js
CHANGED
|
@@ -295,7 +295,7 @@
|
|
|
295
295
|
return art;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
// ----- Local: a USB drive's folders and videos (see LocalMedia) -----
|
|
298
|
+
// ----- Local: a USB drive's (or a network folder's) folders and videos (see LocalMedia) -----
|
|
299
299
|
// One folder at a time, as a grid: its folders, then its videos (posters once matched to a
|
|
300
300
|
// title). OK on a folder opens it, BACK goes up (then to the top menu as on any tab); OK on
|
|
301
301
|
// a video plays it (a matched one through its title's page); long-press: match it by hand.
|
|
@@ -306,12 +306,12 @@
|
|
|
306
306
|
return null;
|
|
307
307
|
}
|
|
308
308
|
function localTitle(d) {
|
|
309
|
-
var name = LocalMedia.knownDrives().length > 1 ? 'USB · ' + d.label.replace(/^removable_/, '') : 'USB drive';
|
|
309
|
+
var name = d.dav ? '🌐 ' + d.label : LocalMedia.knownDrives().length > 1 ? 'USB · ' + d.label.replace(/^removable_/, '') : 'USB drive';
|
|
310
310
|
return [name].concat(_local.rel ? _local.rel.split('/') : []).join(' › ');
|
|
311
311
|
}
|
|
312
312
|
function localRows(rows) {
|
|
313
313
|
if (!LocalMedia.isRead()) { // (read when the tab opens, not at launch)
|
|
314
|
-
rows.appendChild(U.el('div', 'row-empty', 'Reading
|
|
314
|
+
rows.appendChild(U.el('div', 'row-empty', 'Reading your drives and folders…'));
|
|
315
315
|
LocalMedia.ensure().then(redrawLocal);
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
@@ -321,12 +321,12 @@
|
|
|
321
321
|
if (!localDrive()) { _local.root = ds.length === 1 ? ds[0].root : null; _local.rel = ''; _local.listing = null; _local.key = ''; }
|
|
322
322
|
var d = localDrive();
|
|
323
323
|
if (!d) { // several drives: one card each
|
|
324
|
-
rows.appendChild(buildGrid('USB drives', ds.map(function (x) {
|
|
325
|
-
var c = posterCard({ id: 'drive:' + x.root, name: '💾 ' + x.label.replace(/^removable_/, '') }, 'local');
|
|
324
|
+
rows.appendChild(buildGrid(ds.some(function (x) { return x.dav; }) ? 'Drives and network folders' : 'USB drives', ds.map(function (x) {
|
|
325
|
+
var c = posterCard({ id: 'drive:' + x.root, name: (x.dav ? '🌐 ' + x.label : '💾 ' + x.label.replace(/^removable_/, '')) }, 'local');
|
|
326
326
|
c.className += ' local-folder';
|
|
327
327
|
c.__onselect = function () { _local.root = x.root; _local.rel = ''; _local.listing = null; _local.key = ''; _local.focusRel = '__first'; renderHome(); };
|
|
328
328
|
c.__onlongpress = null;
|
|
329
|
-
c.__meta = { name: x.label, description: x.root };
|
|
329
|
+
c.__meta = { name: x.label, description: x.dav ? 'Network folder · ' + x.dav.url : x.root };
|
|
330
330
|
return c;
|
|
331
331
|
})));
|
|
332
332
|
return;
|
|
@@ -384,26 +384,27 @@
|
|
|
384
384
|
// drive stays as it was indexed before, if it was); while matching, the listing and the
|
|
385
385
|
// matches so far stay.
|
|
386
386
|
function confirmStopIndexing(d, st, after) {
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
var what = d.dav ? 'folder' : 'drive';
|
|
388
|
+
confirm(st.phase === 'matching' ? 'Stop matching this ' + what + '’s videos? The listing and what’s been matched so far are kept; the rest can be matched later (Continue matching).'
|
|
389
|
+
: 'Stop indexing this ' + what + '? It hasn’t been listed yet, so nothing new is kept: it stays as it was indexed before (if it was).',
|
|
389
390
|
'Stop', function () { LocalMedia.stopScan(d); after(); }, { noLabel: 'Keep going', plain: true });
|
|
390
391
|
}
|
|
391
392
|
V.confirmStopIndexing = confirmStopIndexing;
|
|
392
393
|
// The drive's index (so title pages know what's on it): read only when asked.
|
|
393
394
|
function indexCard(d) {
|
|
394
|
-
var st = LocalMedia.status(d), busy = st.state === 'scanning';
|
|
395
|
-
var busyName = st.phase === 'matching' ? '⏳ Matching ' + st.done + ' / ' + st.total : '⏳ Listing the
|
|
396
|
-
var c = posterCard({ id: 'index:' + d.root, name: busy ? busyName : st.state === 'none' ? '🔍 Index this
|
|
395
|
+
var st = LocalMedia.status(d), busy = st.state === 'scanning', what = d.dav ? 'folder' : 'drive';
|
|
396
|
+
var busyName = st.phase === 'matching' ? '⏳ Matching ' + st.done + ' / ' + st.total : '⏳ Listing the ' + what + '…';
|
|
397
|
+
var c = posterCard({ id: 'index:' + d.root, name: busy ? busyName : st.state === 'none' ? '🔍 Index this ' + what : st.left ? '🔍 Continue matching (' + st.left + ' left)' : '🔍 Index again' }, 'local');
|
|
397
398
|
c.className += ' local-folder';
|
|
398
399
|
c.__onlongpress = null;
|
|
399
|
-
c.__meta = { name: 'Index this
|
|
400
|
+
c.__meta = { name: 'Index this ' + what, description: (st.state === 'none' ? 'Not indexed yet. ' : st.state === 'failed' ? 'Indexing failed: ' + st.error + '. ' :
|
|
400
401
|
busy ? 'Indexing… (OK: stop) ' : st.videos + ' videos, ' + st.matched + ' matched to titles, indexed ' + U.dayLabel(st.at) + '. ') +
|
|
401
|
-
(LocalMedia.matchingAllowed() ? 'Indexing lists the
|
|
402
|
-
: 'Indexing lists the
|
|
402
|
+
(LocalMedia.matchingAllowed() ? 'Indexing lists the ' + what + '’s videos and matches them to titles, so their title pages offer them (“On your ' + (d.dav ? 'network folder' : 'USB drive') + '”).'
|
|
403
|
+
: 'Indexing lists the ' + what + '’s videos (matching them to titles is off: Settings › Content › USB drive).') };
|
|
403
404
|
c.__onselect = function () {
|
|
404
405
|
if (busy) { confirmStopIndexing(d, st, function () { renderHome(); }); return; }
|
|
405
406
|
if (st.left) {
|
|
406
|
-
pickList('Index this
|
|
407
|
+
pickList('Index this ' + what, [['more', 'Continue matching (' + st.left + ' titles left)'], ['again', 'Index again (list the ' + what + ' afresh)']], 'more', function (k) {
|
|
407
408
|
_local.focusRel = 'index:' + d.root;
|
|
408
409
|
if (k === 'more') { LocalMedia.continueMatching(d); } else { LocalMedia.scan(d); }
|
|
409
410
|
renderHome();
|
|
@@ -411,7 +412,7 @@
|
|
|
411
412
|
return;
|
|
412
413
|
}
|
|
413
414
|
_local.focusRel = 'index:' + d.root;
|
|
414
|
-
LocalMedia.scan(d).then(function () { var s2 = LocalMedia.status(d); U.toast(s2.state === 'failed' ? 'Indexing failed' : 'Indexed: ' + s2.videos + ' videos, ' + s2.matched + ' matched',
|
|
415
|
+
LocalMedia.scan(d).then(function () { var s2 = LocalMedia.status(d); U.toast(s2.state === 'failed' ? 'Indexing failed' + (s2.error ? ': ' + s2.error : '') : 'Indexed: ' + s2.videos + ' videos, ' + s2.matched + ' matched', 5000); });
|
|
415
416
|
renderHome();
|
|
416
417
|
};
|
|
417
418
|
return c;
|
|
@@ -677,7 +678,7 @@
|
|
|
677
678
|
var c = posterCard({ id: e.id, name: e.name || ('' + e.id).split('/').pop() }, 'local');
|
|
678
679
|
c.className += ' local-video';
|
|
679
680
|
c.__cwKey = showKey(e);
|
|
680
|
-
c.__meta = { name: e.name, description: (e.position ? 'Resume at ' + U.fmtTime(e.position) + (e.duration ? ' of ' + U.fmtTime(e.duration) : '') : 'Added, not started yet') + ' · on your USB drive' };
|
|
681
|
+
c.__meta = { name: e.name, description: (e.position ? 'Resume at ' + U.fmtTime(e.position) + (e.duration ? ' of ' + U.fmtTime(e.duration) : '') : 'Added, not started yet') + (/^local:\d+:@dav:/.test(e.id) ? ' · in your network folder' : ' · on your USB drive') };
|
|
681
682
|
c.__onselect = function () { LocalMedia.resumePlain(e, function () { renderHome(); }); };
|
|
682
683
|
c.__onlongpress = function () { continueActions(e, null, null, null, c); };
|
|
683
684
|
if (e.duration) { var p = U.el('div', 'prog'); p.style.width = Math.min(100, (e.position / e.duration * 100)) + '%'; c.appendChild(p); }
|
|
@@ -1035,6 +1036,7 @@
|
|
|
1035
1036
|
[e].concat(e._dupes || []).forEach(function (d) { // (the show's other episodes too)
|
|
1036
1037
|
Player.removeProgress(d.type, d.id);
|
|
1037
1038
|
if (typeof Trakt !== 'undefined' && Trakt.dismiss) { Trakt.dismiss(d.type, d.id); }
|
|
1039
|
+
if (typeof StremioSync !== 'undefined' && StremioSync.dismiss) { StremioSync.dismiss(d.type, d.id); } // (off your Stremio account's too)
|
|
1038
1040
|
});
|
|
1039
1041
|
}
|
|
1040
1042
|
remove.__onselect = function () {
|
|
@@ -1065,8 +1067,10 @@
|
|
|
1065
1067
|
showModal(overlay, details || watched);
|
|
1066
1068
|
}
|
|
1067
1069
|
|
|
1068
|
-
// Local progress merged with Trakt playback
|
|
1069
|
-
// place kept here that Trakt
|
|
1070
|
+
// Local progress merged with Trakt playback and your Stremio account's Continue Watching (when
|
|
1071
|
+
// connected), deduped, newest first; a place kept here that Trakt or the account has you
|
|
1072
|
+
// watching past since (another device) left out. A title both here and in the account: its
|
|
1073
|
+
// place from whichever is newer (the stream to resume it, this TV's).
|
|
1070
1074
|
// One card per show: its furthest episode (highest season, then episode), placed by
|
|
1071
1075
|
// the show's most recent activity. The others ride along as _dupes so Remove clears
|
|
1072
1076
|
// the whole show.
|
|
@@ -1075,6 +1079,17 @@
|
|
|
1075
1079
|
function continueEntries(byActivity) {
|
|
1076
1080
|
var local = Player.continueList(), traktOn = typeof Trakt !== 'undefined' && Trakt.isConnected();
|
|
1077
1081
|
if (traktOn && Trakt.watchedPast) { local = local.filter(function (e) { return !Trakt.watchedPast(e); }); }
|
|
1082
|
+
var stremioOn = typeof StremioSync !== 'undefined' && StremioSync.isConnected();
|
|
1083
|
+
if (stremioOn) {
|
|
1084
|
+
local = local.filter(function (e) { return !StremioSync.watchedPast(e); });
|
|
1085
|
+
var here = {};
|
|
1086
|
+
local.forEach(function (e, i) { here[e.type + ':' + e.id] = i; });
|
|
1087
|
+
StremioSync.continueList().forEach(function (s) {
|
|
1088
|
+
var i = here[s.type + ':' + s.id];
|
|
1089
|
+
if (i === undefined) { return; }
|
|
1090
|
+
if ((s.updated || 0) > (local[i].updated || 0) && s.position) { local[i] = Object.assign({}, local[i], { position: s.position, duration: s.duration || local[i].duration, updated: s.updated }); }
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1078
1093
|
var merged = local.slice();
|
|
1079
1094
|
if (traktOn) {
|
|
1080
1095
|
var seen = {};
|
|
@@ -1084,6 +1099,14 @@
|
|
|
1084
1099
|
if (!seen[k]) { seen[k] = 1; merged.push(e); }
|
|
1085
1100
|
});
|
|
1086
1101
|
}
|
|
1102
|
+
if (stremioOn) {
|
|
1103
|
+
var had = {};
|
|
1104
|
+
merged.forEach(function (e) { had[e.type + ':' + e.id] = 1; });
|
|
1105
|
+
StremioSync.continueList().forEach(function (e) {
|
|
1106
|
+
var k = e.type + ':' + e.id;
|
|
1107
|
+
if (!had[k]) { had[k] = 1; merged.push(e); }
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1087
1110
|
var list = onePerShow(merged); // (the most recent activity first)
|
|
1088
1111
|
return byActivity ? list : inYourOrder(list);
|
|
1089
1112
|
}
|
package/js/view-settings.js
CHANGED
|
@@ -179,6 +179,9 @@
|
|
|
179
179
|
wrap.appendChild(U.el('div', 'hint',
|
|
180
180
|
'The track in your preferred language plays on its own; with none, the second choice. The red key switches while watching. ' +
|
|
181
181
|
'Switching to it: Quick starts in your language at once. Safe is for files where Quick names your language but you hear another (the 2017 TV needs 10 seconds).'));
|
|
182
|
+
if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') {
|
|
183
|
+
wrap.appendChild(U.el('div', 'hint', '⚠ Under TizenBrew none of this applies: StremioK has no TV player there, and only a file’s first audio track plays. The sideloaded app can switch.'));
|
|
184
|
+
}
|
|
182
185
|
focusSettings();
|
|
183
186
|
}
|
|
184
187
|
|
|
@@ -382,6 +385,7 @@
|
|
|
382
385
|
['YouTube', 'Your YouTube channels, playlists and searches; YouTube in Search', 'youtube'],
|
|
383
386
|
['Streaming apps', 'Your apps (Prime Video, Netflix, …) that open a title\'s "where to watch" sources', 'appshortcuts'],
|
|
384
387
|
['USB drive', 'The Local tab: what\'s on your drive, matched to titles; hidden files', 'usb'],
|
|
388
|
+
['Network folders', 'Folders a NAS or computer shares over WebDAV, in the Local tab: their videos as sources', 'netfolders'],
|
|
385
389
|
['Media servers', 'Your Jellyfin or Emby server: its libraries on Home, its files as sources', 'mediaservers'],
|
|
386
390
|
['Import configuration file', 'Import addons, API keys & IPTV playlists', 'import'],
|
|
387
391
|
['Export configuration', 'Your addons, playlists, API keys and settings, to your phone', 'export']] },
|
|
@@ -444,6 +448,7 @@
|
|
|
444
448
|
else if (_settingsSection === 'storage') { settingsStorage(wrap); }
|
|
445
449
|
else if (_settingsSection === 'tvapps') { settingsTvApps(wrap); }
|
|
446
450
|
else if (_settingsSection === 'usb') { settingsUsb(wrap); }
|
|
451
|
+
else if (_settingsSection === 'netfolders') { settingsNetFolders(wrap); }
|
|
447
452
|
else if (_settingsSection === 'mediaservers') { settingsMediaServers(wrap); }
|
|
448
453
|
else if (_settingsSection === 'private') { settingsPrivate(wrap); }
|
|
449
454
|
else if (_settingsSection === 'appshortcuts') { settingsAppShortcuts(wrap); }
|
|
@@ -516,10 +521,12 @@
|
|
|
516
521
|
if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
|
|
517
522
|
// How StremioK was installed, and whether its YouTube service (channels, trailers) answers
|
|
518
523
|
if (typeof YTPlay !== 'undefined' && YTPlay.installLabel) {
|
|
519
|
-
|
|
524
|
+
// (and which video player plays: the TV's own, or the page's, as under TizenBrew)
|
|
525
|
+
var player = ' · Video player: ' + ((window.webapis && webapis.avplay) ? 'the TV’s own' : YTPlay.installMode() === 'tizenbrew' ? 'the page’s (TizenBrew has no TV player: one audio track)' : 'the browser’s');
|
|
526
|
+
var about = U.el('div', 'hint settings-about', 'Installed as: ' + YTPlay.installLabel() + player + ' · YouTube service: checking…');
|
|
520
527
|
wrap.appendChild(about);
|
|
521
528
|
YTPlay.isRunning().then(function (up) {
|
|
522
|
-
about.textContent = 'Installed as: ' + YTPlay.installLabel() + ' · YouTube service: ' +
|
|
529
|
+
about.textContent = 'Installed as: ' + YTPlay.installLabel() + player + ' · YouTube service: ' +
|
|
523
530
|
(up ? 'running' : YTPlay.installMode() === 'wgt' ? 'starts when needed' : 'not running');
|
|
524
531
|
});
|
|
525
532
|
}
|
|
@@ -632,7 +639,8 @@
|
|
|
632
639
|
var an = U.el('div', 'a-name', 'Import addons from your Stremio account');
|
|
633
640
|
an.appendChild(originBadge('stremio'));
|
|
634
641
|
acct.appendChild(an);
|
|
635
|
-
acct.appendChild(U.el('div', 'a-url', '
|
|
642
|
+
acct.appendChild(U.el('div', 'a-url', typeof StremioSync !== 'undefined' && StremioSync.isConnected() ? 'From the account connected in Integrations: tick the addons to add'
|
|
643
|
+
: 'Sign in on your phone with a QR code, then tick the addons to add (StremioK signs out straight after)'));
|
|
636
644
|
acct.__onselect = stremioImport;
|
|
637
645
|
wrap.appendChild(acct);
|
|
638
646
|
}
|
|
@@ -660,11 +668,53 @@
|
|
|
660
668
|
// Import addons from your Stremio account (js/stremio-account.js): a QR code of Stremio's
|
|
661
669
|
// sign-in link, asked until you approve on your phone; then the account's addons to tick
|
|
662
670
|
// (none ticked; yours already shown as such); the account signed out as soon as it's read.
|
|
671
|
+
// Connected (Settings › Integrations): its kept sign-in used, and kept.
|
|
663
672
|
function stremioImport() {
|
|
673
|
+
if (typeof StremioSync !== 'undefined' && StremioSync.isConnected() && !StremioSync.connectStatus().reconnect) {
|
|
674
|
+
U.spinner(true);
|
|
675
|
+
StremioAccount.addons(StremioSync.authKey()).then(function (list) { U.spinner(false); importPick(list); }, function (e) {
|
|
676
|
+
U.spinner(false);
|
|
677
|
+
U.toast('Couldn’t import: ' + ((e && e.message) || 'unknown'), 5000);
|
|
678
|
+
});
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
stremioSignIn('Import addons from your Stremio account', function (key, body, gone, fail) {
|
|
682
|
+
U.clear(body);
|
|
683
|
+
body.appendChild(U.el('div', 'tc-line', 'Reading your addons…'));
|
|
684
|
+
var read = StremioAccount.addons(key);
|
|
685
|
+
read.then(function () { StremioAccount.signOut(key); }, function () { StremioAccount.signOut(key); }); // (signed out as soon as it's read)
|
|
686
|
+
return read.then(function (list) {
|
|
687
|
+
if (gone()) { return; }
|
|
688
|
+
if (!list.length) { fail(new Error('your account has no addons StremioK can use')); return; }
|
|
689
|
+
closeModal();
|
|
690
|
+
importPick(list);
|
|
691
|
+
});
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
function importPick(list) {
|
|
695
|
+
if (!list.length) { U.toast('Your Stremio account has no addons StremioK can use', 5000); return; }
|
|
696
|
+
var mine = Stremio.getAddonUrls();
|
|
697
|
+
var items = list.map(function (x, i) {
|
|
698
|
+
var have = mine.indexOf(x.url) !== -1 || mine.indexOf(Stremio.normalizeUrl ? Stremio.normalizeUrl(x.url) : x.url) !== -1;
|
|
699
|
+
return { key: '' + i, label: x.name + ' · ' + shortHost(x.url), have: have };
|
|
700
|
+
});
|
|
701
|
+
pickMany('Your Stremio addons: tick the ones to add', items, { button: function (n) { return 'Import ' + n + ' addon' + (n === 1 ? '' : 's'); } }, function (keys) {
|
|
702
|
+
var n = 0, last = null;
|
|
703
|
+
keys.forEach(function (k) { var added = Stremio.addAddon(list[+k].url); if (added) { n++; last = added; if (Stremio.setAddonOrigin) { Stremio.setAddonOrigin(added, 'stremio'); } } });
|
|
704
|
+
clearCatalogCache();
|
|
705
|
+
refreshAddonRows(last);
|
|
706
|
+
U.toast('Imported ' + n + ' addon' + (n === 1 ? '' : 's'), 3000);
|
|
707
|
+
renderSettings();
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
// Stremio's sign-in box: a code and a QR code of its link, asked until it's approved on your
|
|
711
|
+
// phone; then signedIn(key, body, gone, fail) (gone(): the box closed meanwhile: the key is
|
|
712
|
+
// given up).
|
|
713
|
+
function stremioSignIn(title, signedIn) {
|
|
664
714
|
var existing = document.querySelector('.modal-overlay');
|
|
665
715
|
if (existing) { existing.parentNode.removeChild(existing); }
|
|
666
716
|
var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box');
|
|
667
|
-
box.appendChild(U.el('div', 'modal-msg',
|
|
717
|
+
box.appendChild(U.el('div', 'modal-msg', title));
|
|
668
718
|
var body = U.el('div', 'trakt-connect');
|
|
669
719
|
body.appendChild(U.el('div', 'tc-line', 'Asking Stremio for a code…'));
|
|
670
720
|
box.appendChild(body);
|
|
@@ -681,7 +731,7 @@
|
|
|
681
731
|
function fail(e) {
|
|
682
732
|
if (gone) { return; }
|
|
683
733
|
U.clear(body);
|
|
684
|
-
body.appendChild(U.el('div', 'tc-line', 'Couldn’t import: ' + ((e && e.message) || 'unknown')));
|
|
734
|
+
body.appendChild(U.el('div', 'tc-line', 'Couldn’t ' + (/^Import/.test(title) ? 'import' : 'connect') + ': ' + ((e && e.message) || 'unknown')));
|
|
685
735
|
}
|
|
686
736
|
StremioAccount.start().then(function (c) {
|
|
687
737
|
if (gone) { return; }
|
|
@@ -703,28 +753,7 @@
|
|
|
703
753
|
body.appendChild(U.el('div', 'tc-line small', 'Sign in to Stremio there and approve. Waiting…'));
|
|
704
754
|
return StremioAccount.wait(c.code, stopped).then(function (key) {
|
|
705
755
|
if (gone) { StremioAccount.signOut(key); return; }
|
|
706
|
-
|
|
707
|
-
body.appendChild(U.el('div', 'tc-line', 'Reading your addons…'));
|
|
708
|
-
var read = StremioAccount.addons(key);
|
|
709
|
-
read.then(function () { StremioAccount.signOut(key); }, function () { StremioAccount.signOut(key); }); // (signed out as soon as it's read)
|
|
710
|
-
return read.then(function (list) {
|
|
711
|
-
if (gone) { return; }
|
|
712
|
-
if (!list.length) { fail(new Error('your account has no addons StremioK can use')); return; }
|
|
713
|
-
var mine = Stremio.getAddonUrls();
|
|
714
|
-
var items = list.map(function (x, i) {
|
|
715
|
-
var have = mine.indexOf(x.url) !== -1 || mine.indexOf(Stremio.normalizeUrl ? Stremio.normalizeUrl(x.url) : x.url) !== -1;
|
|
716
|
-
return { key: '' + i, label: x.name + ' · ' + shortHost(x.url), have: have };
|
|
717
|
-
});
|
|
718
|
-
closeModal();
|
|
719
|
-
pickMany('Your Stremio addons: tick the ones to add', items, { button: function (n) { return 'Import ' + n + ' addon' + (n === 1 ? '' : 's'); } }, function (keys) {
|
|
720
|
-
var n = 0, last = null;
|
|
721
|
-
keys.forEach(function (k) { var added = Stremio.addAddon(list[+k].url); if (added) { n++; last = added; if (Stremio.setAddonOrigin) { Stremio.setAddonOrigin(added, 'stremio'); } } });
|
|
722
|
-
clearCatalogCache();
|
|
723
|
-
refreshAddonRows(last);
|
|
724
|
-
U.toast('Imported ' + n + ' addon' + (n === 1 ? '' : 's'), 3000);
|
|
725
|
-
renderSettings();
|
|
726
|
-
});
|
|
727
|
-
});
|
|
756
|
+
return signedIn(key, body, stopped, fail);
|
|
728
757
|
});
|
|
729
758
|
}).then(null, function (e) { if (!e || e.message !== 'stopped') { fail(e); } });
|
|
730
759
|
}
|
|
@@ -1473,6 +1502,13 @@
|
|
|
1473
1502
|
'Your watched marks and Continue Watching then sync with Trakt.'));
|
|
1474
1503
|
}
|
|
1475
1504
|
|
|
1505
|
+
// Your Stremio account, kept in step (js/stremio-sync.js)
|
|
1506
|
+
if (typeof StremioSync !== 'undefined' && typeof StremioAccount !== 'undefined') {
|
|
1507
|
+
wrap.appendChild(U.el('h2', null, 'Stremio account'));
|
|
1508
|
+
wrap.appendChild(stremioAccountRow());
|
|
1509
|
+
wrap.appendChild(U.el('div', 'hint', 'Connect your Stremio account (sign in on your phone): its Continue Watching, watched marks and Library then sync with StremioK, both ways.'));
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1476
1512
|
wrap.appendChild(U.el('div', 'hint',
|
|
1477
1513
|
'Keys are stored on this TV only. OMDb gives real IMDb per-episode ratings (used first when set); TMDB adds episode images & ratings.'));
|
|
1478
1514
|
focusSettings();
|
|
@@ -1557,6 +1593,52 @@
|
|
|
1557
1593
|
return r;
|
|
1558
1594
|
}
|
|
1559
1595
|
|
|
1596
|
+
// Your Stremio account: connected (who, when it last synced, OK for Sync now / Disconnect), or
|
|
1597
|
+
// not (OK to connect: Stremio's sign-in code, as the addon import).
|
|
1598
|
+
function stremioAccountRow() {
|
|
1599
|
+
var st = StremioSync.connectStatus(), r = U.el('div', 'addon-item focusable cfg-row');
|
|
1600
|
+
function two(x) { return (x < 10 ? '0' : '') + x; }
|
|
1601
|
+
var d = st.lastSync ? new Date(st.lastSync) : null;
|
|
1602
|
+
var bits = [];
|
|
1603
|
+
if (st.connected) {
|
|
1604
|
+
bits.push(d ? 'Last synced ' + (U.dayLabel ? U.dayLabel(st.lastSync) + ' ' : '') + two(d.getHours()) + ':' + two(d.getMinutes()) : 'Not synced yet');
|
|
1605
|
+
if (st.pending) { bits.push(st.pending + ' change' + (st.pending === 1 ? '' : 's') + ' waiting'); }
|
|
1606
|
+
if (st.err) { bits.push('⚠ ' + st.err); }
|
|
1607
|
+
}
|
|
1608
|
+
r.appendChild(U.el('div', 'a-name', 'Stremio account' + (st.connected && st.user ? ': ' + st.user : '')));
|
|
1609
|
+
r.appendChild(U.el('div', 'a-url', st.connected && st.reconnect ? 'Its sign-in no longer works — press OK to connect again'
|
|
1610
|
+
: st.connected ? bits.join(' · ') + ' · OK for options' : 'Not connected — press OK to connect'));
|
|
1611
|
+
r.__onselect = function () {
|
|
1612
|
+
if (!st.connected || st.reconnect) { stremioConnect(); return; }
|
|
1613
|
+
pickList('Stremio account', [['now', 'Sync now'], ['off', 'Disconnect']], null, function (v) {
|
|
1614
|
+
if (v === 'now') { U.toast('Syncing with your Stremio account…'); StremioSync.sync().then(function () { markHomeDirty(); renderSettings(); }); }
|
|
1615
|
+
else if (v === 'off') {
|
|
1616
|
+
confirm('Disconnect your Stremio account?', 'Disconnect', function () {
|
|
1617
|
+
StremioSync.disconnect();
|
|
1618
|
+
U.toast('Stremio account disconnected');
|
|
1619
|
+
markHomeDirty();
|
|
1620
|
+
renderSettings();
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
};
|
|
1625
|
+
return r;
|
|
1626
|
+
}
|
|
1627
|
+
// Stremio's sign-in code (a QR code): approved on your phone, the key kept (StremioSync.connect).
|
|
1628
|
+
function stremioConnect() {
|
|
1629
|
+
stremioSignIn('Connect your Stremio account', function (key, body, gone) {
|
|
1630
|
+
U.clear(body);
|
|
1631
|
+
body.appendChild(U.el('div', 'tc-line', 'Connecting…'));
|
|
1632
|
+
return StremioSync.connect(key).then(function (user) {
|
|
1633
|
+
if (gone()) { return; }
|
|
1634
|
+
U.clear(body);
|
|
1635
|
+
body.appendChild(U.el('div', 'tc-line', '✓ Connected' + (user ? ' as ' + user : '') + ': syncing'));
|
|
1636
|
+
markHomeDirty();
|
|
1637
|
+
setTimeout(function () { if (isModalOpen()) { onModalClose(null); closeModal(); renderSettings(); } }, 1500);
|
|
1638
|
+
});
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1560
1642
|
// Device-code connect overlay: shows the code + URL, polls, updates on success.
|
|
1561
1643
|
function traktConnect() {
|
|
1562
1644
|
var existing = document.querySelector('.modal-overlay');
|
|
@@ -1957,6 +2039,113 @@
|
|
|
1957
2039
|
return st.videos + ' video' + (st.videos === 1 ? '' : 's') + ', ' + st.matched + ' matched to titles' + (st.truncated ? ' (a very large drive: only part of it)' : '') +
|
|
1958
2040
|
(st.left ? ', ' + st.left + ' titles left to match' : '') + ' · indexed ' + U.dayLabel(st.at) + ' ' + new Date(st.at).toTimeString().slice(0, 5);
|
|
1959
2041
|
}
|
|
2042
|
+
// ---- Network folders (WebDAV): NetFolders ----
|
|
2043
|
+
var _netListening = false;
|
|
2044
|
+
function settingsNetFolders(wrap) {
|
|
2045
|
+
wrap.appendChild(U.el('h2', null, 'Network folders'));
|
|
2046
|
+
if (typeof NetFolders === 'undefined' || typeof LocalMedia === 'undefined') { focusSettings(); return; }
|
|
2047
|
+
if (!_netListening) {
|
|
2048
|
+
_netListening = true;
|
|
2049
|
+
LocalMedia.onChange(function (what) {
|
|
2050
|
+
if (_settingsSection !== 'netfolders' || /\bhidden\b/.test(scr('settings').className || '') || isModalOpen()) { return; }
|
|
2051
|
+
if (what === 'status' || what === 'matches' || what === 'index') {
|
|
2052
|
+
var rows = scr('settings').querySelectorAll('.settings-wrap .addon-item');
|
|
2053
|
+
for (var i = 0; i < rows.length; i++) { if (rows[i].__netFolder) { rows[i].querySelector('.a-url').textContent = netFolderLine(rows[i].__netFolder); } }
|
|
2054
|
+
}
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2057
|
+
var add = U.el('div', 'addon-item focusable cfg-row');
|
|
2058
|
+
add.appendChild(U.el('div', 'a-name', '+ Add a network folder'));
|
|
2059
|
+
add.appendChild(U.el('div', 'a-url', 'Its WebDAV address, then the user name and password it asks for, if any'));
|
|
2060
|
+
add.__onselect = function () { askNetAddress(''); };
|
|
2061
|
+
wrap.appendChild(add);
|
|
2062
|
+
var focus = null;
|
|
2063
|
+
NetFolders.all().forEach(function (f) {
|
|
2064
|
+
var r = U.el('div', 'addon-item focusable cfg-row');
|
|
2065
|
+
r.__netFolder = f;
|
|
2066
|
+
r.appendChild(U.el('div', 'a-name', '🌐 ' + f.name + (f.off ? ' · Off' : '')));
|
|
2067
|
+
r.appendChild(U.el('div', 'a-url', netFolderLine(f)));
|
|
2068
|
+
r.__onselect = function () {
|
|
2069
|
+
var d = NetFolders.driveOf(f), st = LocalMedia.status(d);
|
|
2070
|
+
if (!f.off && st.state === 'scanning') { V.confirmStopIndexing(d, st, renderSettings); return; }
|
|
2071
|
+
var opts = f.off ? [['on', 'Turn on']] : [['off', 'Turn off'], ['index', st.left ? 'Continue matching (' + st.left + ' titles left)' : 'Index again']];
|
|
2072
|
+
pickList(f.name, opts.concat([['remove', 'Remove']]), null, function (v) {
|
|
2073
|
+
_focusChild = 'nf:' + f.id;
|
|
2074
|
+
if (v === 'on' || v === 'off') {
|
|
2075
|
+
NetFolders.setOn(f.id, v === 'on');
|
|
2076
|
+
markHomeDirty();
|
|
2077
|
+
U.toast('“' + f.name + '” ' + (v === 'on' ? 'on' : 'off'));
|
|
2078
|
+
renderSettings();
|
|
2079
|
+
} else if (v === 'index') {
|
|
2080
|
+
(st.left ? LocalMedia.continueMatching(d) : LocalMedia.scan(d)).then(function () {
|
|
2081
|
+
var s2 = LocalMedia.status(d);
|
|
2082
|
+
U.toast(s2.state === 'failed' ? 'Indexing failed' + (s2.error ? ': ' + s2.error : '') : 'Indexed: ' + s2.videos + ' videos, ' + s2.matched + ' matched', 5000);
|
|
2083
|
+
});
|
|
2084
|
+
renderSettings();
|
|
2085
|
+
} else if (v === 'remove') {
|
|
2086
|
+
confirm('Remove “' + f.name + '”? Its index goes too; the folder itself isn’t touched.', 'Remove', function () { NetFolders.remove(f.id); markHomeDirty(); renderSettings(); });
|
|
2087
|
+
}
|
|
2088
|
+
});
|
|
2089
|
+
};
|
|
2090
|
+
if (_focusChild === 'nf:' + f.id) { focus = r; }
|
|
2091
|
+
wrap.appendChild(r);
|
|
2092
|
+
});
|
|
2093
|
+
wrap.appendChild(U.el('div', 'hint', 'A NAS (Synology, QNAP), Nextcloud, or a computer running rclone (rclone serve webdav). Home › Local shows each folder; its videos play as they are (nothing converted), so the TV must play their format.'));
|
|
2094
|
+
if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
|
|
2095
|
+
}
|
|
2096
|
+
function netFolderLine(f) {
|
|
2097
|
+
if (f.off) { return f.url + ' · its sources set aside, its index kept'; }
|
|
2098
|
+
var st = LocalMedia.status(NetFolders.driveOf(f));
|
|
2099
|
+
return f.url + (f.user ? ' · as ' + f.user : '') + (f.cert ? ' · its certificate trusted' : '') + ' · ' + usbDriveLine(st).replace('listing the drive', 'listing the folder').replace('a very large drive', 'a very large folder');
|
|
2100
|
+
}
|
|
2101
|
+
function askNetAddress(value) {
|
|
2102
|
+
App.openEntry({
|
|
2103
|
+
title: 'Network folder: address',
|
|
2104
|
+
hint: 'Its WebDAV address, like http://192.168.0.50:8080/media (https:// too). RETURN cancels.',
|
|
2105
|
+
value: value || 'http://', placeholder: 'http://192.168.0.50:8080/media', phone: 'webdav',
|
|
2106
|
+
validate: function (v) { return NetFolders.addressProblem(v); },
|
|
2107
|
+
onConfirm: function (url) {
|
|
2108
|
+
App.back();
|
|
2109
|
+
App.openEntry({
|
|
2110
|
+
title: 'Network folder: user name', hint: 'The user name it asks for; leave it empty if it asks for none. RETURN cancels.', value: '', placeholder: 'user name',
|
|
2111
|
+
validate: function () { return null; },
|
|
2112
|
+
onConfirm: function (user) {
|
|
2113
|
+
App.back();
|
|
2114
|
+
if (!('' + user).trim()) { netProbe(url, '', '', ''); return; }
|
|
2115
|
+
App.openEntry({
|
|
2116
|
+
title: 'Network folder: password', hint: 'Its password (kept on the TV, sent only to that folder). RETURN cancels.', value: '', placeholder: 'password', secret: true,
|
|
2117
|
+
validate: function () { return null; },
|
|
2118
|
+
onConfirm: function (pass) { App.back(); netProbe(url, ('' + user).trim(), '' + pass, ''); }
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
// Ask the folder with that sign-in; a certificate it made itself: asked about first.
|
|
2126
|
+
function netProbe(url, user, pass, cert) {
|
|
2127
|
+
U.spinner(true, 'Asking the folder…');
|
|
2128
|
+
NetFolders.probe(url, user, pass, cert).then(function (p) {
|
|
2129
|
+
U.spinner(false);
|
|
2130
|
+
var f;
|
|
2131
|
+
try { f = NetFolders.add(p); } catch (e) { U.toast(e.message, 5000); return; }
|
|
2132
|
+
markHomeDirty();
|
|
2133
|
+
_settingsSection = 'netfolders';
|
|
2134
|
+
_focusChild = 'nf:' + f.id;
|
|
2135
|
+
renderSettings();
|
|
2136
|
+
U.toast('✓ Added “' + f.name + '”: Home › Local shows it', 5000);
|
|
2137
|
+
}, function (e) {
|
|
2138
|
+
U.spinner(false);
|
|
2139
|
+
if (e && e.why === 'untrusted' && e.cert && !cert) {
|
|
2140
|
+
confirm('“' + url + '”: trust this certificate? It isn’t from a known authority (one the folder made itself?)' + (e.name ? ', for ' + e.name : '') + (e.until ? ', until ' + e.until : '') +
|
|
2141
|
+
'. Its fingerprint (SHA-256): ' + e.fp + '. StremioK then accepts this certificate only, for this folder.', 'Trust this certificate', function () { netProbe(url, user, pass, e.cert); }, { noLabel: 'Cancel', plain: true });
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
U.toast((e && e.message) || 'It failed', 7000);
|
|
2145
|
+
if (_settingsSection === 'netfolders') { renderSettings(); }
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
|
|
1960
2149
|
function settingsUsb(wrap) {
|
|
1961
2150
|
wrap.appendChild(U.el('h2', null, 'USB drive'));
|
|
1962
2151
|
if (typeof LocalMedia === 'undefined' || !LocalMedia.available()) {
|
|
@@ -1984,7 +2173,7 @@
|
|
|
1984
2173
|
focusSettings();
|
|
1985
2174
|
return;
|
|
1986
2175
|
}
|
|
1987
|
-
var ds = LocalMedia.knownDrives(), first = null;
|
|
2176
|
+
var ds = LocalMedia.knownDrives().filter(function (d) { return !d.dav; }), first = null; // (network folders: their own page)
|
|
1988
2177
|
if (!ds.length) { wrap.appendChild(U.el('div', 'hint', 'No USB drive plugged in.')); }
|
|
1989
2178
|
ds.forEach(function (d) {
|
|
1990
2179
|
var r = U.el('div', 'addon-item focusable');
|
|
@@ -2047,6 +2236,7 @@
|
|
|
2047
2236
|
if (key === 'stremiok.homecache') { return { name: 'Home’s saved rows' }; }
|
|
2048
2237
|
if (key === 'stremiok.trakt.watched') { return { name: 'Trakt watched history' }; }
|
|
2049
2238
|
if (key === 'stremiok.media.watched') { return { name: 'Media servers’ watched marks' }; }
|
|
2239
|
+
if (key === 'stremiok.stremio.items') { return { name: 'Your Stremio account’s library' }; }
|
|
2050
2240
|
if ((m = key.match(/^stremiok\.iptv\.cache\.(.+)$/))) {
|
|
2051
2241
|
var p = (typeof IPTV !== 'undefined' ? IPTV.getPlaylists() : []).filter(function (x) { return x.id === m[1]; })[0];
|
|
2052
2242
|
return p ? { name: 'IPTV playlist copy: ' + (p.name || (('' + p.url).match(/^[a-z]+:\/\/(?:[^\/@]*@)?([^\/?#:]+)/i) || [])[1] || 'a playlist') }
|
package/js/ytplay.js
CHANGED
|
@@ -87,7 +87,7 @@ var YTPlay = (function () {
|
|
|
87
87
|
var cc = opts && opts.cc ? opts.cc.map(function (c) { return c.ch + (c.lang ? '-' + c.lang : ''); }).join(',') : '';
|
|
88
88
|
return ensureService().then(entryAuth).then(function (a) {
|
|
89
89
|
var q = '/live/open?u=' + encodeURIComponent(url) + (h && h.ua ? '&ua=' + encodeURIComponent(h.ua) : '') + (h && h.ref ? '&ref=' + encodeURIComponent(h.ref) : '') + (h && h.cookie ? '&cookie=' + encodeURIComponent(h.cookie) : '') + (force ? '&force=1' : '') +
|
|
90
|
-
(force && opts && opts.fix === false ? '&fix=0' : '') + (force && cc ? '&cc=' + encodeURIComponent(cc) : '') + (force && opts && opts.film ? '&film=1' : '');
|
|
90
|
+
(force && opts && opts.fix === false ? '&fix=0' : '') + (force && cc ? '&cc=' + encodeURIComponent(cc) : '') + (force && opts && opts.film ? '&film=1' : '') + (force && opts && opts.raw ? '&raw=1' : '');
|
|
91
91
|
return U.getJSON(PROXY + q + a.q, force ? 5000 : 30000, 65536, cancel || null, a.h);
|
|
92
92
|
});
|
|
93
93
|
}
|