stremiok 2.3.1 → 2.3.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/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 USB drives…'));
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
- confirm(st.phase === 'matching' ? 'Stop matching this drive’s videos? The listing and what’s been matched so far are kept; the rest can be matched later (Continue matching).'
388
- : 'Stop indexing this drive? It hasn’t been listed yet, so nothing new is kept: it stays as it was indexed before (if it was).',
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 drive…';
396
- var c = posterCard({ id: 'index:' + d.root, name: busy ? busyName : st.state === 'none' ? '🔍 Index this drive' : st.left ? '🔍 Continue matching (' + st.left + ' left)' : '🔍 Index again' }, 'local');
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 drive', description: (st.state === 'none' ? 'Not indexed yet. ' : st.state === 'failed' ? 'Indexing failed: ' + st.error + '. ' :
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 drive’s videos and matches them to titles, so their title pages offer them (“On your USB drive”).'
402
- : 'Indexing lists the drive’s videos (matching them to titles is off: Settings › Content › USB drive).') };
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 drive', [['more', 'Continue matching (' + st.left + ' titles left)'], ['again', 'Index again (list the drive afresh)']], 'more', function (k) {
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', 4000); });
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); }
@@ -1680,6 +1681,10 @@
1680
1681
  var built = [];
1681
1682
  for (var i = from; i < to; i++) {
1682
1683
  var c = cats[i];
1684
+ if (Stremio.getPrefs().watchedCards === 'hide' && !c.loading) { // (Settings › Appearance › Watched titles: Hide)
1685
+ c = copyCat(c, c.metas.filter(function (m) { return !V.watchedHidden(m, c.type); }));
1686
+ if (!c.metas.length) { continue; }
1687
+ }
1683
1688
  var row = buildRow(c.name, c.metas.slice(0, ROW_FIRST).map(function (m) { return posterCard(m, c.type); }));
1684
1689
  if (c.metas.length > ROW_FIRST) { lateCards(row, c); }
1685
1690
  if (c.loading) { row.className += ' row-loading'; row.appendChild(U.el('div', 'row-empty', 'Loading…')); } // (its place kept: nothing to focus)
@@ -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
 
@@ -234,6 +237,10 @@
234
237
  get: function () { return { posterRatings: Stremio.getPrefs().posterRatings ? 'on' : 'off' }; },
235
238
  set: function (cfg) { Stremio.setPref('posterRatings', cfg.posterRatings === 'on'); markHomeDirty(); }
236
239
  }));
240
+ wrap.appendChild(subPickRow('Watched titles', [['show', 'Show'], ['dim', 'Dim'], ['hide', 'Hide']], 'watchedCards', {
241
+ get: function () { return { watchedCards: Stremio.getPrefs().watchedCards }; },
242
+ set: function (cfg) { Stremio.setPref('watchedCards', cfg.watchedCards); markHomeDirty(); } // (Home and Discover drawn again with it)
243
+ }));
237
244
  wrap.appendChild(subPickRow('Hide spoilers', [['off', 'Off'], ['pictures', 'Pictures'], ['all', 'Pictures and synopses']], 'spoilers', {
238
245
  get: function () { return { spoilers: Stremio.getPrefs().spoilers }; },
239
246
  set: function (cfg) { Stremio.setPref('spoilers', cfg.spoilers); }
@@ -378,6 +385,7 @@
378
385
  ['YouTube', 'Your YouTube channels, playlists and searches; YouTube in Search', 'youtube'],
379
386
  ['Streaming apps', 'Your apps (Prime Video, Netflix, …) that open a title\'s "where to watch" sources', 'appshortcuts'],
380
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'],
381
389
  ['Media servers', 'Your Jellyfin or Emby server: its libraries on Home, its files as sources', 'mediaservers'],
382
390
  ['Import configuration file', 'Import addons, API keys & IPTV playlists', 'import'],
383
391
  ['Export configuration', 'Your addons, playlists, API keys and settings, to your phone', 'export']] },
@@ -440,6 +448,7 @@
440
448
  else if (_settingsSection === 'storage') { settingsStorage(wrap); }
441
449
  else if (_settingsSection === 'tvapps') { settingsTvApps(wrap); }
442
450
  else if (_settingsSection === 'usb') { settingsUsb(wrap); }
451
+ else if (_settingsSection === 'netfolders') { settingsNetFolders(wrap); }
443
452
  else if (_settingsSection === 'mediaservers') { settingsMediaServers(wrap); }
444
453
  else if (_settingsSection === 'private') { settingsPrivate(wrap); }
445
454
  else if (_settingsSection === 'appshortcuts') { settingsAppShortcuts(wrap); }
@@ -512,10 +521,12 @@
512
521
  if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
513
522
  // How StremioK was installed, and whether its YouTube service (channels, trailers) answers
514
523
  if (typeof YTPlay !== 'undefined' && YTPlay.installLabel) {
515
- var about = U.el('div', 'hint settings-about', 'Installed as: ' + YTPlay.installLabel() + ' · YouTube service: checking…');
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…');
516
527
  wrap.appendChild(about);
517
528
  YTPlay.isRunning().then(function (up) {
518
- about.textContent = 'Installed as: ' + YTPlay.installLabel() + ' · YouTube service: ' +
529
+ about.textContent = 'Installed as: ' + YTPlay.installLabel() + player + ' · YouTube service: ' +
519
530
  (up ? 'running' : YTPlay.installMode() === 'wgt' ? 'starts when needed' : 'not running');
520
531
  });
521
532
  }
@@ -1629,16 +1640,24 @@
1629
1640
  }
1630
1641
  var focus = null;
1631
1642
  // (each server with the module it's from: Jellyfin's for Jellyfin and Emby, Plex's)
1632
- var all = (have ? Jellyfin.servers().map(function (s) { return { srv: s, mod: Jellyfin, kind: Jellyfin.kindName(s) }; }) : [])
1633
- .concat(hasPlex ? Plex.servers().map(function (s) { return { srv: s, mod: Plex, kind: 'Plex' }; }) : []);
1643
+ var all = (have ? Jellyfin.allServers().map(function (s) { return { srv: s, mod: Jellyfin, kind: Jellyfin.kindName(s) }; }) : [])
1644
+ .concat(hasPlex ? Plex.allServers().map(function (s) { return { srv: s, mod: Plex, kind: 'Plex' }; }) : []);
1634
1645
  all.forEach(function (x) {
1635
1646
  var srv = x.srv, mod = x.mod;
1636
1647
  var r = U.el('div', 'addon-item focusable cfg-row'), libs = mod.libraries(srv);
1637
- r.appendChild(U.el('div', 'a-name', srv.name + ' · ' + x.kind + ' ' + srv.version));
1638
- r.appendChild(U.el('div', 'a-url', srv.url + (srv.user ? ' · signed in as ' + srv.user : '') + (libs.length ? ' · ' + libs.map(function (l) { return l.name; }).join(', ') : '')));
1648
+ r.appendChild(U.el('div', 'a-name', srv.name + ' · ' + x.kind + ' ' + srv.version + (srv.off ? ' · Off' : '')));
1649
+ r.appendChild(U.el('div', 'a-url', srv.url + (srv.user ? ' · signed in as ' + srv.user : '') + (srv.off ? ' · its rows, sources and watched marks set aside' : libs.length ? ' · ' + libs.map(function (l) { return l.name; }).join(', ') : '')));
1639
1650
  r.__onselect = function () {
1640
- pickList(srv.name, [['reload', 'Reload'], ['remove', 'Sign out and remove']], null, function (v) {
1641
- if (v === 'reload') {
1651
+ var opts = srv.off ? [['on', 'Turn on']] : [['off', 'Turn off'], ['reload', 'Reload']];
1652
+ pickList(srv.name, opts.concat([['remove', 'Sign out and remove']]), null, function (v) {
1653
+ if (v === 'on' || v === 'off') {
1654
+ mod.setOn(srv.id, v === 'on');
1655
+ markHomeDirty();
1656
+ U.toast('“' + srv.name + '” ' + (v === 'on' ? 'on' : 'off'));
1657
+ _focusChild = 'jf:' + srv.id;
1658
+ renderSettings();
1659
+ if (v === 'on') { setTimeout(function () { if (_settingsSection === 'mediaservers') { _focusChild = 'jf:' + srv.id; renderSettings(); } }, 1500); } // (its libraries, once read)
1660
+ } else if (v === 'reload') {
1642
1661
  mod.reload(srv.id);
1643
1662
  markHomeDirty();
1644
1663
  U.toast('Reading “' + srv.name + '” again…');
@@ -1651,6 +1670,12 @@
1651
1670
  if (_focusChild === 'jf:' + srv.id) { focus = r; }
1652
1671
  wrap.appendChild(r);
1653
1672
  });
1673
+ if (all.length) {
1674
+ wrap.appendChild(subPickRow('Wait for a server', SERVER_WAITS, 'serverWait', {
1675
+ get: function () { return { serverWait: '' + Stremio.getPrefs().serverWait }; },
1676
+ set: function (cfg) { Stremio.setPref('serverWait', +cfg.serverWait || 0); }
1677
+ }));
1678
+ }
1654
1679
  wrap.appendChild(U.el('div', 'hint', 'Jellyfin 10.9 or newer, Emby 4.7 or newer, Plex. Their files play as they are (nothing converted), so the TV must play their format.'));
1655
1680
  if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
1656
1681
  }
@@ -1819,6 +1844,7 @@
1819
1844
  var SKIP_CHOICES = [['0', 'Ask (a Skip button)'], ['5', 'After 5 seconds'], ['10', 'After 10 seconds'], ['15', 'After 15 seconds'], ['30', 'After 30 seconds']];
1820
1845
  // Settings › Addons: how long an addon's answer is waited for (an addon that sleeps when
1821
1846
  // unused fails the first time while it wakes up).
1847
+ var SERVER_WAITS = [['0', 'Normal (20 s)'], ['45', '45 seconds'], ['90', '90 seconds'], ['180', '180 seconds']]; // (a media server's answer)
1822
1848
  var ADDON_WAITS = [['0', 'Normal (12 s; sources 15, search 25)'], ['20', '20 seconds'], ['30', '30 seconds'], ['45', '45 seconds'], ['60', '60 seconds']];
1823
1849
  var NEXT_CHOICES = [['0', 'Ask'], ['5', 'After 5 seconds'], ['10', 'After 10 seconds'], ['15', 'After 15 seconds'], ['30', 'After 30 seconds']];
1824
1850
  // Seeking & buffering: how far LEFT / RIGHT jump; a bigger buffer for slow connections; how
@@ -1938,6 +1964,113 @@
1938
1964
  return st.videos + ' video' + (st.videos === 1 ? '' : 's') + ', ' + st.matched + ' matched to titles' + (st.truncated ? ' (a very large drive: only part of it)' : '') +
1939
1965
  (st.left ? ', ' + st.left + ' titles left to match' : '') + ' · indexed ' + U.dayLabel(st.at) + ' ' + new Date(st.at).toTimeString().slice(0, 5);
1940
1966
  }
1967
+ // ---- Network folders (WebDAV): NetFolders ----
1968
+ var _netListening = false;
1969
+ function settingsNetFolders(wrap) {
1970
+ wrap.appendChild(U.el('h2', null, 'Network folders'));
1971
+ if (typeof NetFolders === 'undefined' || typeof LocalMedia === 'undefined') { focusSettings(); return; }
1972
+ if (!_netListening) {
1973
+ _netListening = true;
1974
+ LocalMedia.onChange(function (what) {
1975
+ if (_settingsSection !== 'netfolders' || /\bhidden\b/.test(scr('settings').className || '') || isModalOpen()) { return; }
1976
+ if (what === 'status' || what === 'matches' || what === 'index') {
1977
+ var rows = scr('settings').querySelectorAll('.settings-wrap .addon-item');
1978
+ for (var i = 0; i < rows.length; i++) { if (rows[i].__netFolder) { rows[i].querySelector('.a-url').textContent = netFolderLine(rows[i].__netFolder); } }
1979
+ }
1980
+ });
1981
+ }
1982
+ var add = U.el('div', 'addon-item focusable cfg-row');
1983
+ add.appendChild(U.el('div', 'a-name', '+ Add a network folder'));
1984
+ add.appendChild(U.el('div', 'a-url', 'Its WebDAV address, then the user name and password it asks for, if any'));
1985
+ add.__onselect = function () { askNetAddress(''); };
1986
+ wrap.appendChild(add);
1987
+ var focus = null;
1988
+ NetFolders.all().forEach(function (f) {
1989
+ var r = U.el('div', 'addon-item focusable cfg-row');
1990
+ r.__netFolder = f;
1991
+ r.appendChild(U.el('div', 'a-name', '🌐 ' + f.name + (f.off ? ' · Off' : '')));
1992
+ r.appendChild(U.el('div', 'a-url', netFolderLine(f)));
1993
+ r.__onselect = function () {
1994
+ var d = NetFolders.driveOf(f), st = LocalMedia.status(d);
1995
+ if (!f.off && st.state === 'scanning') { V.confirmStopIndexing(d, st, renderSettings); return; }
1996
+ var opts = f.off ? [['on', 'Turn on']] : [['off', 'Turn off'], ['index', st.left ? 'Continue matching (' + st.left + ' titles left)' : 'Index again']];
1997
+ pickList(f.name, opts.concat([['remove', 'Remove']]), null, function (v) {
1998
+ _focusChild = 'nf:' + f.id;
1999
+ if (v === 'on' || v === 'off') {
2000
+ NetFolders.setOn(f.id, v === 'on');
2001
+ markHomeDirty();
2002
+ U.toast('“' + f.name + '” ' + (v === 'on' ? 'on' : 'off'));
2003
+ renderSettings();
2004
+ } else if (v === 'index') {
2005
+ (st.left ? LocalMedia.continueMatching(d) : LocalMedia.scan(d)).then(function () {
2006
+ var s2 = LocalMedia.status(d);
2007
+ U.toast(s2.state === 'failed' ? 'Indexing failed' + (s2.error ? ': ' + s2.error : '') : 'Indexed: ' + s2.videos + ' videos, ' + s2.matched + ' matched', 5000);
2008
+ });
2009
+ renderSettings();
2010
+ } else if (v === 'remove') {
2011
+ confirm('Remove “' + f.name + '”? Its index goes too; the folder itself isn’t touched.', 'Remove', function () { NetFolders.remove(f.id); markHomeDirty(); renderSettings(); });
2012
+ }
2013
+ });
2014
+ };
2015
+ if (_focusChild === 'nf:' + f.id) { focus = r; }
2016
+ wrap.appendChild(r);
2017
+ });
2018
+ 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.'));
2019
+ if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
2020
+ }
2021
+ function netFolderLine(f) {
2022
+ if (f.off) { return f.url + ' · its sources set aside, its index kept'; }
2023
+ var st = LocalMedia.status(NetFolders.driveOf(f));
2024
+ 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');
2025
+ }
2026
+ function askNetAddress(value) {
2027
+ App.openEntry({
2028
+ title: 'Network folder: address',
2029
+ hint: 'Its WebDAV address, like http://192.168.0.50:8080/media (https:// too). RETURN cancels.',
2030
+ value: value || 'http://', placeholder: 'http://192.168.0.50:8080/media', phone: 'webdav',
2031
+ validate: function (v) { return NetFolders.addressProblem(v); },
2032
+ onConfirm: function (url) {
2033
+ App.back();
2034
+ App.openEntry({
2035
+ 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',
2036
+ validate: function () { return null; },
2037
+ onConfirm: function (user) {
2038
+ App.back();
2039
+ if (!('' + user).trim()) { netProbe(url, '', '', ''); return; }
2040
+ App.openEntry({
2041
+ title: 'Network folder: password', hint: 'Its password (kept on the TV, sent only to that folder). RETURN cancels.', value: '', placeholder: 'password', secret: true,
2042
+ validate: function () { return null; },
2043
+ onConfirm: function (pass) { App.back(); netProbe(url, ('' + user).trim(), '' + pass, ''); }
2044
+ });
2045
+ }
2046
+ });
2047
+ }
2048
+ });
2049
+ }
2050
+ // Ask the folder with that sign-in; a certificate it made itself: asked about first.
2051
+ function netProbe(url, user, pass, cert) {
2052
+ U.spinner(true, 'Asking the folder…');
2053
+ NetFolders.probe(url, user, pass, cert).then(function (p) {
2054
+ U.spinner(false);
2055
+ var f;
2056
+ try { f = NetFolders.add(p); } catch (e) { U.toast(e.message, 5000); return; }
2057
+ markHomeDirty();
2058
+ _settingsSection = 'netfolders';
2059
+ _focusChild = 'nf:' + f.id;
2060
+ renderSettings();
2061
+ U.toast('✓ Added “' + f.name + '”: Home › Local shows it', 5000);
2062
+ }, function (e) {
2063
+ U.spinner(false);
2064
+ if (e && e.why === 'untrusted' && e.cert && !cert) {
2065
+ 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 : '') +
2066
+ '. 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 });
2067
+ return;
2068
+ }
2069
+ U.toast((e && e.message) || 'It failed', 7000);
2070
+ if (_settingsSection === 'netfolders') { renderSettings(); }
2071
+ });
2072
+ }
2073
+
1941
2074
  function settingsUsb(wrap) {
1942
2075
  wrap.appendChild(U.el('h2', null, 'USB drive'));
1943
2076
  if (typeof LocalMedia === 'undefined' || !LocalMedia.available()) {
@@ -1965,7 +2098,7 @@
1965
2098
  focusSettings();
1966
2099
  return;
1967
2100
  }
1968
- var ds = LocalMedia.knownDrives(), first = null;
2101
+ var ds = LocalMedia.knownDrives().filter(function (d) { return !d.dav; }), first = null; // (network folders: their own page)
1969
2102
  if (!ds.length) { wrap.appendChild(U.el('div', 'hint', 'No USB drive plugged in.')); }
1970
2103
  ds.forEach(function (d) {
1971
2104
  var r = U.el('div', 'addon-item focusable');
@@ -2027,6 +2160,7 @@
2027
2160
  var m;
2028
2161
  if (key === 'stremiok.homecache') { return { name: 'Home’s saved rows' }; }
2029
2162
  if (key === 'stremiok.trakt.watched') { return { name: 'Trakt watched history' }; }
2163
+ if (key === 'stremiok.media.watched') { return { name: 'Media servers’ watched marks' }; }
2030
2164
  if ((m = key.match(/^stremiok\.iptv\.cache\.(.+)$/))) {
2031
2165
  var p = (typeof IPTV !== 'undefined' ? IPTV.getPlaylists() : []).filter(function (x) { return x.id === m[1]; })[0];
2032
2166
  return p ? { name: 'IPTV playlist copy: ' + (p.name || (('' + p.url).match(/^[a-z]+:\/\/(?:[^\/@]*@)?([^\/?#:]+)/i) || [])[1] || 'a playlist') }
package/js/views.js CHANGED
@@ -13,7 +13,7 @@ var Views = (function (V) {
13
13
  leaveScreen: function (name) { var f = { detail: V.leaveDetail, discover: V.leaveDiscover, search: V.leaveSearch }[name]; if (f) { f(); } }, backInLocal: V.backInLocal, setHomeTab: V.setHomeTab,
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
- homeDirty: V.homeDirty, refreshHomeIfStale: V.refreshHomeIfStale, alertNewEpisodes: V.alertNewEpisodes, previewTiles: V.previewTiles, withShowInfo: V.withShowInfo,
16
+ homeDirty: V.homeDirty, watchedChanged: V.watchedChanged, refreshHomeIfStale: V.refreshHomeIfStale, alertNewEpisodes: V.alertNewEpisodes, previewTiles: V.previewTiles, withShowInfo: V.withShowInfo,
17
17
  isModalOpen: V.isModalOpen, closeModal: V.closeModal, confirm: V.confirm, moveKey: V.moveKey, playKey: V.playKey, availableTabs: V.availableTabs,
18
18
  menuItems: V.menuItems, menuOrder: V.menuOrder, moveMenuItem: V.moveMenuItem
19
19
  };
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
  }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "stremiok",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "StremioK streaming client for Tizen 3.0+ Samsung TVs (TizenBrew app module).",
5
5
  "packageType": "app",
6
6
  "appName": "StremioK",
7
- "appPath": "index.html",
7
+ "appPath": "tizenbrew.html",
8
8
  "serviceFile": "service/index.js",
9
9
  "files": [
10
10
  "index.html",
11
+ "tizenbrew.html",
11
12
  "css",
12
13
  "js",
13
14
  "service",