stremiok 2.3.6 → 2.3.8
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 +22 -0
- package/README.md +6 -3
- package/config.xml +2 -1
- package/css/style.css +1 -0
- package/index.html +43 -43
- package/js/lang/ar.js +61 -3
- package/js/lang/ca.js +2030 -0
- package/js/lang/de.js +61 -3
- package/js/lang/es.js +61 -3
- package/js/lang/fi.js +61 -3
- package/js/lang/fr.js +61 -3
- package/js/lang/he.js +61 -3
- package/js/lang/hi.js +61 -3
- package/js/lang/it.js +61 -3
- package/js/lang/ja.js +61 -3
- package/js/lang/ko.js +61 -3
- package/js/lang/languages.js +1 -0
- package/js/lang/pl.js +61 -3
- package/js/lang/pt-BR.js +61 -3
- package/js/lang/ru.js +61 -3
- package/js/lang/tr.js +61 -3
- package/js/lang/zh-CN.js +61 -3
- package/js/local.js +63 -18
- package/js/netfolders.js +76 -8
- package/js/player-audio.js +16 -8
- package/js/player-controls.js +68 -0
- package/js/player-core.js +98 -8
- package/js/player-lang.js +16 -0
- package/js/player-store.js +7 -2
- package/js/player-subs.js +267 -17
- package/js/plugins.js +43 -7
- package/js/stremio.js +54 -6
- package/js/view-core.js +2 -2
- package/js/view-detail.js +10 -3
- package/js/view-settings.js +167 -15
- package/js/ytplay.js +39 -6
- package/package.json +1 -1
- package/service/index.js +1660 -57
- package/tizenbrew.html +1 -1
package/js/view-detail.js
CHANGED
|
@@ -2119,19 +2119,26 @@
|
|
|
2119
2119
|
// how.converted: played converted by the streaming server, so its formats aren't learned
|
|
2120
2120
|
// (they didn't play on the TV); Played before and the kept source still are.
|
|
2121
2121
|
function learnFor(st, how) {
|
|
2122
|
-
var info = Stremio.streamInfo(st)
|
|
2122
|
+
var info = Stremio.streamInfo(st);
|
|
2123
|
+
// (the formats learned: the file's own, its header read by then — the player's
|
|
2124
|
+
// formatInfo, corrected by it — else as its name says)
|
|
2125
|
+
function fkeysOf(playing) {
|
|
2126
|
+
if (how && how.converted) { return []; }
|
|
2127
|
+
var p = playing || ctx, fi = p && p.stream === st && p.formatInfo && p.formatInfo.fromFile ? p.formatInfo : info;
|
|
2128
|
+
return Stremio.formatKeys(fi);
|
|
2129
|
+
}
|
|
2123
2130
|
return {
|
|
2124
2131
|
// (private viewing: nothing about this playback remembered or forgotten — its own
|
|
2125
2132
|
// flag, set when it started, see player-store; what plays on this TV is still learned)
|
|
2126
2133
|
// (playing: the playback it's about, as it is now — another source's is a copy)
|
|
2127
2134
|
onStarted: function (err, playing) {
|
|
2128
|
-
Stremio.recordFormats(
|
|
2135
|
+
Stremio.recordFormats(fkeysOf(playing), true);
|
|
2129
2136
|
if ((playing || ctx || {}).private) { return; }
|
|
2130
2137
|
if (remembers) { rememberPlayed(titleId, st, info); Stremio.keepSource(vtype, videoId, st); } // (kept: listed when its addon is late, see Stremio.keptSources)
|
|
2131
2138
|
if (series && st._addon) { rememberSeriesSource(titleId, st); }
|
|
2132
2139
|
},
|
|
2133
2140
|
onFailed: function (err, playing) {
|
|
2134
|
-
Stremio.recordFormats(
|
|
2141
|
+
Stremio.recordFormats(fkeysOf(playing), false, err, fileIdentity(st));
|
|
2135
2142
|
if (remembers && !(playing || ctx || {}).private) { forgetPlayed(titleId, st, info); Stremio.forgetSource(vtype, videoId, st); }
|
|
2136
2143
|
if (page) { page.directFailed = true; } // (played straight away and failed: its source list next)
|
|
2137
2144
|
}
|
package/js/view-settings.js
CHANGED
|
@@ -942,10 +942,11 @@
|
|
|
942
942
|
if (imported.tmdb) { parts.push(U.t('TMDB key')); }
|
|
943
943
|
if (imported.mdblist) { parts.push(U.t('MDBList key')); }
|
|
944
944
|
if (imported.settings) { parts.push(U.t('your settings')); }
|
|
945
|
+
if (imported.history) { parts.push(U.t('your history')); }
|
|
945
946
|
if (imported.addons || imported.playlists) { clearCatalogCache(); }
|
|
946
947
|
var message = parts.length ? U.t('Imported: {what}', { what: parts.join(', ') }) : U.t('Nothing imported');
|
|
947
948
|
if (parsed.ignored) { message += ' ' + U.t('({n} ignored)', { n: parsed.ignored }); }
|
|
948
|
-
if (imported.settings) { // (every part of StremioK reads them afresh)
|
|
949
|
+
if (imported.settings || imported.history) { // (every part of StremioK reads them afresh)
|
|
949
950
|
U.toast(message + '. StremioK starts again with them…', 4000);
|
|
950
951
|
setTimeout(function () { try { window.location.reload(); } catch (e) {} }, 2500);
|
|
951
952
|
return;
|
|
@@ -954,7 +955,27 @@
|
|
|
954
955
|
renderSettings();
|
|
955
956
|
});
|
|
956
957
|
}
|
|
957
|
-
//
|
|
958
|
+
// A USB drive to save to or read from (the only one, else picked): then(drive). None: said so.
|
|
959
|
+
function usbDrive(then) {
|
|
960
|
+
if (typeof LocalMedia === 'undefined' || !LocalMedia.drives) { U.toast(U.t('No USB drive found'), 3000); return; }
|
|
961
|
+
LocalMedia.drives().then(function (list) {
|
|
962
|
+
var usb = (list || []).filter(function (d) { return /^\/opt\/media\/[^\/]+$/.test(d.root || ''); });
|
|
963
|
+
if (!usb.length) { U.toast(U.t('No USB drive found'), 3000); return; }
|
|
964
|
+
if (usb.length === 1) { then(usb[0]); return; }
|
|
965
|
+
pickList(U.t('Which USB drive?'), usb.map(function (d) { return [d.root, d.label || d.root]; }), null, function (root) {
|
|
966
|
+
then(usb.filter(function (d) { return d.root === root; })[0]);
|
|
967
|
+
});
|
|
968
|
+
}, function () { U.toast(U.t('No USB drive found'), 3000); });
|
|
969
|
+
}
|
|
970
|
+
// Written to a drive's StremioK folder (the service: YTPlay.bakWrite), said so.
|
|
971
|
+
function saveToDrive(d, kind, text) {
|
|
972
|
+
U.toast(U.t('Saving to {drive}…', { drive: d.label || d.root }), 3000);
|
|
973
|
+
YTPlay.bakWrite(d.root, kind, text).then(function (r) {
|
|
974
|
+
U.toast(U.t('Saved to {drive}: {file}. Wait a few seconds before you take the drive out.', { drive: d.label || d.root, file: r && r.file || 'StremioK' }), 6000);
|
|
975
|
+
}, function (e) { U.toast(U.t('Couldn’t save to the drive: {why}', { why: U.problem(e) }), 6000); });
|
|
976
|
+
}
|
|
977
|
+
function canUseDrives() { return typeof YTPlay !== 'undefined' && YTPlay.bakWrite && YTPlay.installMode() !== 'browser'; }
|
|
978
|
+
// Settings › Content › Export configuration: what goes in, ticked at first (not your history), given to your
|
|
958
979
|
// phone (V.phoneGive) as the file Import configuration file reads (Stremio.exportSetup).
|
|
959
980
|
function settingsExport(wrap) {
|
|
960
981
|
wrap.appendChild(U.el('h2', null, U.t('Export configuration')));
|
|
@@ -964,12 +985,25 @@
|
|
|
964
985
|
row.__onselect = function () {
|
|
965
986
|
var groups = Stremio.exportGroups();
|
|
966
987
|
pickMany(U.t('Tick what to export'), groups.map(function (g) { return { key: g.key, label: g.label }; }),
|
|
967
|
-
{ on: groups.map(function (g) { return g.key; }), button: function (n) { return U.t('Export {n}', { n: n }); } }, function (keys) {
|
|
988
|
+
{ on: groups.filter(function (g) { return !g.off; }).map(function (g) { return g.key; }), button: function (n) { return U.t('Export {n}', { n: n }); } }, function (keys) {
|
|
968
989
|
V.phoneGive(U.t('Export configuration'), Stremio.exportSetup(keys, appVersion()),
|
|
969
|
-
U.t('It holds your addon links, playlist logins, API keys and MAC addresses: keep the file private. Not in it: your Trakt sign-in
|
|
990
|
+
U.t('It holds your addon links, playlist logins, API keys and MAC addresses: keep the file private. Not in it: your Trakt sign-in.'));
|
|
970
991
|
});
|
|
971
992
|
};
|
|
972
993
|
wrap.appendChild(row);
|
|
994
|
+
if (canUseDrives()) { // (the same file on a USB drive, for when the phone's page can't be reached)
|
|
995
|
+
var usb = U.el('div', 'addon-item focusable add-row');
|
|
996
|
+
usb.appendChild(U.el('div', 'a-name', U.t('⇩ Save to a USB drive')));
|
|
997
|
+
usb.appendChild(U.el('div', 'a-url', U.t('The same file, in a StremioK folder on the drive (the last one replaced)')));
|
|
998
|
+
usb.__onselect = function () {
|
|
999
|
+
var groups = Stremio.exportGroups();
|
|
1000
|
+
pickMany(U.t('Tick what to export'), groups.map(function (g) { return { key: g.key, label: g.label }; }),
|
|
1001
|
+
{ on: groups.filter(function (g) { return !g.off; }).map(function (g) { return g.key; }), button: function (n) { return U.t('Export {n}', { n: n }); } }, function (keys) {
|
|
1002
|
+
usbDrive(function (d) { saveToDrive(d, 'backup', Stremio.exportSetup(keys, appVersion())); });
|
|
1003
|
+
});
|
|
1004
|
+
};
|
|
1005
|
+
wrap.appendChild(usb);
|
|
1006
|
+
}
|
|
973
1007
|
wrap.appendChild(U.el('div', 'hint', U.t('To restore it (after a reinstall, or on another TV): Import configuration file › ▣ From your phone, then choose the file there (or paste it).')));
|
|
974
1008
|
focusSettings();
|
|
975
1009
|
}
|
|
@@ -997,7 +1031,7 @@
|
|
|
997
1031
|
// you're on stays: back to Settings only from this entry, still showing)
|
|
998
1032
|
var entry = scr('addaddon'), mine = ++_importGen;
|
|
999
1033
|
function here() { return mine === _importGen && !/\bhidden\b/.test(entry.className); }
|
|
1000
|
-
U.getText(v, 15000,
|
|
1034
|
+
U.getText(v, 15000, 1536 * 1024).then(function (text) { // (a list of URLs and keys, your history too: 1.5 MB at most)
|
|
1001
1035
|
importText(text, here);
|
|
1002
1036
|
}, function (err) {
|
|
1003
1037
|
if (!here()) { return; }
|
|
@@ -1012,6 +1046,22 @@
|
|
|
1012
1046
|
});
|
|
1013
1047
|
};
|
|
1014
1048
|
wrap.appendChild(listRow);
|
|
1049
|
+
if (canUseDrives()) { // (a backup Export configuration saved on a USB drive)
|
|
1050
|
+
var fromUsb = U.el('div', 'addon-item focusable add-row');
|
|
1051
|
+
fromUsb.appendChild(U.el('div', 'a-name', U.t('⇧ Restore from a USB drive')));
|
|
1052
|
+
fromUsb.appendChild(U.el('div', 'a-url', U.t('A backup saved there: StremioK/stremiok-backup.txt')));
|
|
1053
|
+
fromUsb.__onselect = function () {
|
|
1054
|
+
usbDrive(function (d) {
|
|
1055
|
+
YTPlay.bakRead(d.root).then(function (r) {
|
|
1056
|
+
++_importGen;
|
|
1057
|
+
importText(r && typeof r.text === 'string' ? r.text : '', function () { return false; });
|
|
1058
|
+
}, function (e) {
|
|
1059
|
+
U.toast(/HTTP 404/.test((e && e.message) || '') ? U.t('No backup on {drive}', { drive: d.label || d.root }) : U.t('Couldn’t read the drive: {why}', { why: U.problem(e) }), 5000);
|
|
1060
|
+
});
|
|
1061
|
+
});
|
|
1062
|
+
};
|
|
1063
|
+
wrap.appendChild(fromUsb);
|
|
1064
|
+
}
|
|
1015
1065
|
wrap.appendChild(U.el('div', 'hint',
|
|
1016
1066
|
U.t('Accepted lines: addon URLs, M3U/M3U8 URLs, and OMDb, TMDB or MDBList API keys.')));
|
|
1017
1067
|
focusSettings();
|
|
@@ -1787,7 +1837,7 @@
|
|
|
1787
1837
|
var pr = U.el('div', 'addon-item focusable cfg-row');
|
|
1788
1838
|
pr.appendChild(U.el('div', 'a-name', ' ' + (p.on ? '✓ ' : '○ ') + p.name + (p.version ? ' ' + p.version : '')));
|
|
1789
1839
|
var kinds = p.types.map(function (t) { return t === 'tv' ? U.t('Series') : U.t('Movies'); }).join(', ');
|
|
1790
|
-
pr.appendChild(U.el('div', 'a-url', ' ' + kinds + ' · ' + (p.on ? U.t('On') : U.t('Off')) + ' · ' + (p.on ? U.t('OK to turn off') : U.t('OK to turn on'))));
|
|
1840
|
+
pr.appendChild(U.el('div', 'a-url', ' ' + kinds + ' · ' + (p.on ? U.t('On') : U.t('Off')) + (p.authorOff ? ' · ' + U.t('off in its repository (often broken)') : '') + ' · ' + (p.on ? U.t('OK to turn off') : U.t('OK to turn on'))));
|
|
1791
1841
|
pr.__onselect = function () { _focusChild = 'pp:' + r.id + '.' + p.id; Plugins.setPlugin(r.id, p.id, !p.on); renderSettings(); };
|
|
1792
1842
|
if (_focusChild === 'pp:' + r.id + '.' + p.id) { focus = pr; }
|
|
1793
1843
|
wrap.appendChild(pr);
|
|
@@ -2011,6 +2061,7 @@
|
|
|
2011
2061
|
wrap.appendChild(subPickRow(U.t('Edge'), plain(Player.SUB_EDGES), 'edge'));
|
|
2012
2062
|
wrap.appendChild(subPickRow(U.t('Position'), plain(Player.SUB_POSITIONS), 'pos'));
|
|
2013
2063
|
wrap.appendChild(subPickRow(U.t('Font'), Player.SUB_FONTS, 'font'));
|
|
2064
|
+
wrap.appendChild(subPickRow(U.t('The file\'s colors'), SUB_ONLY, 'fileColors')); // (a file's own colors instead of Color: player-subs' drawCues)
|
|
2014
2065
|
focusSettings();
|
|
2015
2066
|
}
|
|
2016
2067
|
|
|
@@ -2026,14 +2077,16 @@
|
|
|
2026
2077
|
var RECONNECTS = [['off', U.t('Off')], ['few', U.t('A few times (3 in 5 minutes)')], ['always', U.t('Keep trying')]];
|
|
2027
2078
|
// (an HLS source through the service, with its own headers on every piece: see player-core's viaService)
|
|
2028
2079
|
var HLS_ROUTES = [['off', U.t('Off')], ['headers', U.t('Sources that need headers')], ['all', U.t('All HLS sources')]];
|
|
2080
|
+
var FILE_INFOS = [['usb', U.t('USB drives only')], ['all', U.t('All files')], ['off', U.t('Off')]];
|
|
2029
2081
|
function settingsSeeking(wrap) {
|
|
2030
2082
|
wrap.appendChild(U.el('h2', null, U.t('Seeking & buffering')));
|
|
2031
|
-
var store = { get: function () { var c = Player.playerCfg(); return { seek: '' + c.seek, buffer: c.buffer, reconnect: c.reconnect, hls: c.hls }; },
|
|
2032
|
-
set: function (cfg) { Player.setPlayerCfg({ seek: +cfg.seek || 10, buffer: cfg.buffer, reconnect: cfg.reconnect, hls: cfg.hls }); } };
|
|
2083
|
+
var store = { get: function () { var c = Player.playerCfg(); return { seek: '' + c.seek, buffer: c.buffer, reconnect: c.reconnect, hls: c.hls, fileInfo: c.fileInfo }; },
|
|
2084
|
+
set: function (cfg) { Player.setPlayerCfg({ seek: +cfg.seek || 10, buffer: cfg.buffer, reconnect: cfg.reconnect, hls: cfg.hls, fileInfo: cfg.fileInfo }); } };
|
|
2033
2085
|
wrap.appendChild(subPickRow(U.t('Seek step'), [['5', '5 s'], ['10', '10 s'], ['15', '15 s'], ['30', '30 s']], 'seek', store));
|
|
2034
2086
|
wrap.appendChild(subPickRow(U.t('Buffer'), [['normal', U.t('Normal (the TV’s own)')], ['more', U.t('More')], ['most', U.t('Most')]], 'buffer', store));
|
|
2035
2087
|
wrap.appendChild(subPickRow(U.t('Reconnect live channels'), RECONNECTS, 'reconnect', store));
|
|
2036
2088
|
wrap.appendChild(subPickRow(U.t('HLS through StremioK’s service'), HLS_ROUTES, 'hls', store));
|
|
2089
|
+
wrap.appendChild(subPickRow(U.t('Read the file’s details'), FILE_INFOS, 'fileInfo', store)); // (its codec, HDR, tracks and their names: player-core's fileInfoAsk)
|
|
2037
2090
|
wrap.appendChild(U.el('div', 'hint', 'Seek step: FF / REW jump three. Buffer: More or Most starts slower but stops less on a slow connection. Reconnect: a live channel that drops opens again (BACK stops it). HLS through StremioK’s service: for a host that wants headers the TV’s player can’t send; a step more before it starts.'));
|
|
2038
2091
|
focusSettings();
|
|
2039
2092
|
}
|
|
@@ -2074,6 +2127,20 @@
|
|
|
2074
2127
|
clear.__onselect = function () { U.clearLog(); renderSettings(); };
|
|
2075
2128
|
wrap.appendChild(clear);
|
|
2076
2129
|
}
|
|
2130
|
+
var send = U.el('div', 'addon-item focusable');
|
|
2131
|
+
send.appendChild(U.el('div', 'a-name', U.t('⇧ Send to your phone')));
|
|
2132
|
+
send.appendChild(U.el('div', 'a-url', U.t('These logs and Startup, with StremioK’s version and the TV’s, as a text file to attach to a report')));
|
|
2133
|
+
send.__onselect = function () {
|
|
2134
|
+
V.phoneGive(U.t('Send the logs to your phone'), logsText(), U.t('Keys and passwords are masked; still, look it over before sharing it publicly.'), 'logs');
|
|
2135
|
+
};
|
|
2136
|
+
wrap.appendChild(send);
|
|
2137
|
+
if (canUseDrives()) {
|
|
2138
|
+
var toUsb = U.el('div', 'addon-item focusable');
|
|
2139
|
+
toUsb.appendChild(U.el('div', 'a-name', U.t('⇩ Save to a USB drive')));
|
|
2140
|
+
toUsb.appendChild(U.el('div', 'a-url', U.t('The same text file, in a StremioK folder on the drive')));
|
|
2141
|
+
toUsb.__onselect = function () { usbDrive(function (d) { saveToDrive(d, 'logs', logsText()); }); };
|
|
2142
|
+
wrap.appendChild(toUsb);
|
|
2143
|
+
}
|
|
2077
2144
|
startupLines(wrap);
|
|
2078
2145
|
focusSettings();
|
|
2079
2146
|
}
|
|
@@ -2156,8 +2223,12 @@
|
|
|
2156
2223
|
}
|
|
2157
2224
|
var add = U.el('div', 'addon-item focusable cfg-row');
|
|
2158
2225
|
add.appendChild(U.el('div', 'a-name', U.t('+ Add a network folder')));
|
|
2159
|
-
add.appendChild(U.el('div', 'a-url', U.t('
|
|
2160
|
-
add.__onselect = function () {
|
|
2226
|
+
add.appendChild(U.el('div', 'a-url', U.t('A WebDAV folder, a Windows / NAS share (SMB) or a media server (DLNA)')));
|
|
2227
|
+
add.__onselect = function () {
|
|
2228
|
+
pickList(U.t('Add a network folder'), [['dav', U.t('WebDAV folder (http:// or https://)')], ['smb', U.t('Windows / NAS share (SMB)')], ['dlna', U.t('Media server on your network (DLNA)')]], null, function (k) {
|
|
2229
|
+
if (k === 'smb') { askSmbHost(''); } else if (k === 'dlna') { findDlna(); } else { askNetAddress(''); }
|
|
2230
|
+
});
|
|
2231
|
+
};
|
|
2161
2232
|
wrap.appendChild(add);
|
|
2162
2233
|
var focus = null;
|
|
2163
2234
|
NetFolders.all().forEach(function (f) {
|
|
@@ -2190,13 +2261,13 @@
|
|
|
2190
2261
|
if (_focusChild === 'nf:' + f.id) { focus = r; }
|
|
2191
2262
|
wrap.appendChild(r);
|
|
2192
2263
|
});
|
|
2193
|
-
wrap.appendChild(U.el('div', 'hint', 'A NAS (Synology, QNAP), Nextcloud,
|
|
2264
|
+
wrap.appendChild(U.el('div', 'hint', 'A NAS (Synology, QNAP), Nextcloud, a Windows share or rclone (rclone serve webdav). Home › Local shows each folder; its videos play as they are (nothing converted), so the TV must play their format.'));
|
|
2194
2265
|
if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
|
|
2195
2266
|
}
|
|
2196
2267
|
function netFolderLine(f) {
|
|
2197
2268
|
if (f.off) { return f.url + ' · ' + U.t('its sources set aside, its index kept'); }
|
|
2198
2269
|
var st = LocalMedia.status(NetFolders.driveOf(f));
|
|
2199
|
-
return f.url + (f.user ? ' · ' + U.t('as {user}', { user: f.user }) : '') + (f.cert ? ' · ' + U.t('its certificate trusted') : '') + ' · ' + usbDriveLine(st, true);
|
|
2270
|
+
return (NetFolders.isDlna(f) ? 'DLNA · ' + ((('' + f.control).match(/^https?:\/\/([^\/]+)/) || [])[1] || '') : f.url) + (f.user ? ' · ' + U.t('as {user}', { user: f.user }) : '') + (f.cert ? ' · ' + U.t('its certificate trusted') : '') + ' · ' + usbDriveLine(st, true);
|
|
2200
2271
|
}
|
|
2201
2272
|
function askNetAddress(value) {
|
|
2202
2273
|
App.openEntry({
|
|
@@ -2222,10 +2293,61 @@
|
|
|
2222
2293
|
}
|
|
2223
2294
|
});
|
|
2224
2295
|
}
|
|
2296
|
+
// A Windows / NAS share: its server, a user name (none: a guest) and password, then one of
|
|
2297
|
+
// its shares to pick (the server's own list).
|
|
2298
|
+
function askSmbHost(value) {
|
|
2299
|
+
App.openEntry({
|
|
2300
|
+
title: U.t('Share: the server'),
|
|
2301
|
+
hint: U.t('Its name or address on your network, like 192.168.0.50 or nas.local. RETURN cancels.'),
|
|
2302
|
+
value: value || '', placeholder: '192.168.0.50',
|
|
2303
|
+
validate: function (v) { return NetFolders.smbHostOf(v) ? null : U.t('A name or address on your network, like 192.168.0.50'); },
|
|
2304
|
+
onConfirm: function (v) {
|
|
2305
|
+
var host = NetFolders.smbHostOf(v);
|
|
2306
|
+
App.back();
|
|
2307
|
+
App.openEntry({
|
|
2308
|
+
title: U.t('Share: user name'), hint: U.t('Its user name (DOMAIN\\name for a domain); leave it empty to go in as a guest. RETURN cancels.'), value: '', placeholder: U.t('user name'),
|
|
2309
|
+
validate: function () { return null; },
|
|
2310
|
+
onConfirm: function (user) {
|
|
2311
|
+
App.back();
|
|
2312
|
+
user = ('' + user).trim();
|
|
2313
|
+
if (!user) { smbShares(host, '', ''); return; }
|
|
2314
|
+
App.openEntry({
|
|
2315
|
+
title: U.t('Share: password'), hint: U.t('Its password (kept on the TV, sent only to that server). RETURN cancels.'), value: '', placeholder: U.t('password'), secret: true,
|
|
2316
|
+
validate: function () { return null; },
|
|
2317
|
+
onConfirm: function (pass) { App.back(); smbShares(host, user, '' + pass); }
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2324
|
+
// The media servers on your network, looked for now (a few seconds), one to pick: added as a
|
|
2325
|
+
// network folder (none added unasked).
|
|
2326
|
+
function findDlna() {
|
|
2327
|
+
U.spinner(true, U.t('Looking for media servers on your network…'));
|
|
2328
|
+
NetFolders.discover().then(function (list) {
|
|
2329
|
+
U.spinner(false);
|
|
2330
|
+
if (!list.length) { U.toast(U.t('No media server answered (or all are added already)'), 6000); return; }
|
|
2331
|
+
pickList(U.t('Media servers: pick one'), list.map(function (x, i) { return ['' + i, x.name + ' · ' + (('' + x.control).match(/^https?:\/\/([^\/:]+)/) || [])[1]]; }), null, function (i) {
|
|
2332
|
+
var srv = list[+i];
|
|
2333
|
+
netProbe('', '', '', '', 'dlna', srv);
|
|
2334
|
+
});
|
|
2335
|
+
}, function (e) { U.spinner(false); U.toast((e && e.message) || U.t('It failed'), 7000); });
|
|
2336
|
+
}
|
|
2337
|
+
function smbShares(host, user, pass) {
|
|
2338
|
+
U.spinner(true, U.t('Asking the server for its shares…'));
|
|
2339
|
+
NetFolders.shares(host, user, pass).then(function (list) {
|
|
2340
|
+
U.spinner(false);
|
|
2341
|
+
if (!list.length) { U.toast(U.t('It lists no shares you can open'), 6000); return; }
|
|
2342
|
+
pickList(U.t('Its shares: pick one'), list.map(function (x) { return [x.name, x.name + (x.remark ? ' · ' + x.remark : '')]; }), null, function (name) {
|
|
2343
|
+
netProbe('smb://' + host + '/' + name + '/', user, pass, '', 'smb');
|
|
2344
|
+
});
|
|
2345
|
+
}, function (e) { U.spinner(false); U.toast((e && e.message) || U.t('It failed'), 7000); });
|
|
2346
|
+
}
|
|
2225
2347
|
// Ask the folder with that sign-in; a certificate it made itself: asked about first.
|
|
2226
|
-
function netProbe(url, user, pass, cert) {
|
|
2348
|
+
function netProbe(url, user, pass, cert, kind, server) {
|
|
2227
2349
|
U.spinner(true, U.t('Asking the folder…'));
|
|
2228
|
-
NetFolders.probe(url, user, pass, cert).then(function (p) {
|
|
2350
|
+
NetFolders.probe(url, user, pass, cert, kind, server).then(function (p) {
|
|
2229
2351
|
U.spinner(false);
|
|
2230
2352
|
var f;
|
|
2231
2353
|
try { f = NetFolders.add(p); } catch (e) { U.toast(e.message, 5000); return; }
|
|
@@ -2447,6 +2569,36 @@
|
|
|
2447
2569
|
STARTUP_STEPS.forEach(function (st) { if (m && typeof m[st[0]] === 'number') { parts.push(st[1] + ' ' + (m[st[0]] / 1000).toFixed(1) + ' s'); } });
|
|
2448
2570
|
return parts.join(' · ');
|
|
2449
2571
|
}
|
|
2572
|
+
// Settings › Diagnostics › Logs › Send to your phone: the logs (masked as they are in the list),
|
|
2573
|
+
// Startup, StremioK's version and how it's installed, and the TV (its browser, which names its
|
|
2574
|
+
// Tizen version; model and firmware where the TV says), as plain text in English.
|
|
2575
|
+
function logsText() {
|
|
2576
|
+
function two(n) { return (n < 10 ? '0' : '') + n; }
|
|
2577
|
+
function when(t) { var d = new Date(t); return d.getFullYear() + '-' + two(d.getMonth() + 1) + '-' + two(d.getDate()) + ' ' + two(d.getHours()) + ':' + two(d.getMinutes()) + ':' + two(d.getSeconds()); }
|
|
2578
|
+
// (the model: Samsung's productinfo (config.xml's productinfo privilege), else Tizen's own system info)
|
|
2579
|
+
var tv = [], pi = window.webapis && webapis.productinfo, model = '', ver = '';
|
|
2580
|
+
function cap(k) { try { return typeof tizen !== 'undefined' && tizen.systeminfo && tizen.systeminfo.getCapability ? '' + (tizen.systeminfo.getCapability(k) || '') : ''; } catch (e) { return ''; } }
|
|
2581
|
+
try { model = pi && pi.getRealModel ? pi.getRealModel() : pi && pi.getModel ? pi.getModel() : ''; } catch (e) { model = ''; }
|
|
2582
|
+
if (!model) { model = cap('http://tizen.org/system/model_name'); }
|
|
2583
|
+
if (model) { tv.push('Model: ' + model); }
|
|
2584
|
+
try { if (pi && pi.getFirmware) { tv.push('Firmware: ' + pi.getFirmware()); } } catch (e2) {}
|
|
2585
|
+
ver = cap('http://tizen.org/feature/platform.version');
|
|
2586
|
+
var tz = ver ? [ver, ver] : /Tizen (\d+(?:\.\d+)*)/.exec(navigator.userAgent || '');
|
|
2587
|
+
var lines = ['StremioK logs', 'StremioK ' + (appVersion() || '?') + ' · Installed as: ' + (typeof YTPlay !== 'undefined' && YTPlay.installLabel ? YTPlay.installLabel() : '?') +
|
|
2588
|
+
' · Video player: ' + ((window.webapis && webapis.avplay) ? 'the TV’s own' : 'the page’s'),
|
|
2589
|
+
'TV: ' + (tz ? 'Tizen ' + tz[1] : 'not a Tizen TV') + (tv.length ? ' · ' + tv.join(' · ') : ''),
|
|
2590
|
+
'Browser: ' + (navigator.userAgent || '?'), 'Sent: ' + when(Date.now()), ''];
|
|
2591
|
+
var now = U.startupMarks ? startupText(U.startupMarks()) : '', before = U.startupMarks ? startupText(U.startupMarks(true)) : '';
|
|
2592
|
+
lines.push('Startup');
|
|
2593
|
+
lines.push(' This launch: ' + (now || '—'));
|
|
2594
|
+
lines.push(' Launch before: ' + (before || '—'));
|
|
2595
|
+
lines.push('');
|
|
2596
|
+
var list = (U.logEntries ? U.logEntries() : []).slice().reverse(); // (the file reads oldest first, as they happened; the page shows the newest first)
|
|
2597
|
+
lines.push('Logs (' + list.length + ', oldest first)');
|
|
2598
|
+
list.forEach(function (e) { lines.push(when(e.t) + ' ' + e.src + (e.n > 1 ? ' ×' + e.n : '') + ' ' + e.msg); });
|
|
2599
|
+
if (!list.length) { lines.push(' (none since StremioK started)'); }
|
|
2600
|
+
return lines.join('\n') + '\n';
|
|
2601
|
+
}
|
|
2450
2602
|
function startupLines(wrap) {
|
|
2451
2603
|
if (!U.startupMarks) { return; }
|
|
2452
2604
|
var now = startupText(U.startupMarks()), before = startupText(U.startupMarks(true));
|
|
@@ -2609,7 +2761,7 @@
|
|
|
2609
2761
|
list: function () {
|
|
2610
2762
|
return Promise.resolve(V.menuOrder().map(function (k) {
|
|
2611
2763
|
var t = (V.HOME_TABS || []).filter(function (x) { return x.key === k; })[0];
|
|
2612
|
-
return { key: k, name: MENU_FIXED[k] || (t ? t.label : k) + (k === 'local' ? ' ' + U.t('(with a USB drive
|
|
2764
|
+
return { key: k, name: MENU_FIXED[k] || (t ? t.label : k) + (k === 'local' ? ' ' + U.t('(with a USB drive or network folder)') : k === 'guide' ? ' ' + U.t('(once a TV guide is read)') : '') };
|
|
2613
2765
|
}));
|
|
2614
2766
|
},
|
|
2615
2767
|
keyOf: function (x) { return x.key; },
|
package/js/ytplay.js
CHANGED
|
@@ -53,23 +53,43 @@ var YTPlay = (function () {
|
|
|
53
53
|
// An export (a configuration file) given to the phone: a one-time page to copy or download it
|
|
54
54
|
// -> { url, token } (polled like an entry: { seen }; closed with entryClose). POSTed: the token,
|
|
55
55
|
// or the guide ticket (the page's POST carries an Origin the header alone doesn't pass).
|
|
56
|
-
|
|
56
|
+
// kind: 'logs' for Settings › Diagnostics › Logs › Send to your phone (its own page and file name).
|
|
57
|
+
function entryGive(text, kind) {
|
|
57
58
|
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
58
59
|
return ensureService().then(entryAuth).then(function (a) {
|
|
59
60
|
return (a.q ? Promise.resolve(a.q) : ticketOf(a)).then(function (cred) {
|
|
60
|
-
|
|
61
|
+
var q = (cred ? cred.replace(/^&/, '') : '') + (kind === 'logs' ? (cred ? '&' : '') + 'kind=logs' : '');
|
|
62
|
+
return U.postJSON(PROXY + '/entry/give' + (q ? '?' + q : ''), text, 10000, 65536, a.h);
|
|
61
63
|
});
|
|
62
64
|
});
|
|
63
65
|
}
|
|
66
|
+
// A backup (kind 'backup') or the logs ('logs') written to a USB drive (its mount point,
|
|
67
|
+
// /opt/media/…), into its StremioK folder: -> { file, size }. POSTed as entryGive is.
|
|
68
|
+
function bakWrite(drive, kind, text) {
|
|
69
|
+
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
70
|
+
return ensureService().then(entryAuth).then(function (a) {
|
|
71
|
+
return (a.q ? Promise.resolve(a.q) : ticketOf(a)).then(function (cred) {
|
|
72
|
+
var q = 'drive=' + encodeURIComponent(drive) + '&kind=' + (kind === 'logs' ? 'logs' : 'backup') + (cred ? '&' + cred.replace(/^&/, '') : '');
|
|
73
|
+
return U.postJSON(PROXY + '/bak/write?' + q, text, 20000, 4096, a.h);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// The backup on a USB drive -> { text, at }; rejects when there's none.
|
|
78
|
+
function bakRead(drive) {
|
|
79
|
+
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
80
|
+
return ensureService().then(entryAuth).then(function (a) {
|
|
81
|
+
return U.getJSON(PROXY + '/bak/read?drive=' + encodeURIComponent(drive) + a.q, 15000, 3 * 1048576, null, a.h);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
64
84
|
function entryOpen(what) {
|
|
65
85
|
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/open?what=' + encodeURIComponent(what || 'link') + a.q, 8000, undefined, null, a.h); });
|
|
66
86
|
}
|
|
67
87
|
function entryPoll(token) {
|
|
68
|
-
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/poll?t=' + encodeURIComponent(token) + a.q, 5000,
|
|
88
|
+
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/poll?t=' + encodeURIComponent(token) + a.q, 5000, 4194304, null, a.h); })
|
|
69
89
|
.then(function (r) { return (r && typeof r.text === 'string') ? r.text : null; });
|
|
70
90
|
}
|
|
71
91
|
function entrySeen(token) { // (an export's page: kept open by asking, and whether the phone has opened it)
|
|
72
|
-
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/poll?t=' + encodeURIComponent(token) + a.q, 5000,
|
|
92
|
+
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/poll?t=' + encodeURIComponent(token) + a.q, 5000, 4194304, null, a.h); })
|
|
73
93
|
.then(function (r) { return !!(r && r.seen); });
|
|
74
94
|
}
|
|
75
95
|
function entryClose(token) {
|
|
@@ -98,13 +118,26 @@ var YTPlay = (function () {
|
|
|
98
118
|
return U.getJSON(PROXY + '/live/file?u=' + encodeURIComponent(url) + headerQuery(h) + (lan ? '&lan=1' : '') + a.q, 5000, 65536, null, a.h);
|
|
99
119
|
});
|
|
100
120
|
}
|
|
121
|
+
// What's in a source's file, from its header (the service's /live/mi: its container, codecs,
|
|
122
|
+
// audio and subtitle tracks with their names; see the service's mediaInfo). h, lan: as fileOpen.
|
|
123
|
+
function mediaInfo(url, h, lan, cancel) {
|
|
124
|
+
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
125
|
+
return ensureService().then(entryAuth).then(function (a) {
|
|
126
|
+
return U.getJSON(PROXY + '/live/mi?u=' + encodeURIComponent(url) + headerQuery(h) + (lan ? '&lan=1' : '') + a.q, 25000, 262144, cancel, a.h, null, true);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
101
129
|
// Where a Nuvio plugin's Worker sends its requests (js/plugins.js): { url, headers }, the
|
|
102
130
|
// token in the link (a Worker's POST then needs no preflight). lan: home-network requests
|
|
103
131
|
// allowed (Local-network links from internet addons).
|
|
132
|
+
// Without the token (it can't be read on every TV), the guide ticket goes in the link too: a
|
|
133
|
+
// Worker's POST can carry an Origin (seen on a Tizen 4 TV: every plugin request refused,
|
|
134
|
+
// "not allowed (origin)"), which the service lets through only with one of them (#21).
|
|
104
135
|
function pluginNet(lan) {
|
|
105
136
|
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
106
137
|
return ensureService().then(entryAuth).then(function (a) {
|
|
107
|
-
return
|
|
138
|
+
return (a.q ? Promise.resolve(a.q) : ticketOf(a)).then(function (cred) {
|
|
139
|
+
return { url: PROXY + '/plug/fetch?' + (cred || '').replace(/^&/, '') + (lan ? '&lan=1' : ''), headers: a.h || {} };
|
|
140
|
+
});
|
|
108
141
|
});
|
|
109
142
|
}
|
|
110
143
|
function liveOpen(url, h, force, opts, cancel) {
|
|
@@ -329,6 +362,6 @@ var YTPlay = (function () {
|
|
|
329
362
|
return MODE === 'tizenbrew' ? U.t('TizenBrew module') : MODE === 'wgt' ? U.t('Sideloaded app (.wgt)') : U.t('Browser (development)');
|
|
330
363
|
}
|
|
331
364
|
|
|
332
|
-
return { ensureService: ensureService, resolverUrl: resolverUrl, infoUrl: infoUrl, canPlay: canPlay, liveOpen: liveOpen, fileOpen: fileOpen, pluginNet: pluginNet, hlsMaster: hlsMaster, aiomAddons: aiomAddons, stalkerList: stalkerList, stalkerVod: stalkerVod, drmLicense: drmLicense, stalkerPlayUrl: stalkerPlayUrl, stalkerGenres: stalkerGenres, stalkerLink: stalkerLink, xtvodAsk: xtvodAsk, epgLoad: epgLoad, epgGet: epgGet, epgFiles: epgFiles, epgClear: epgClear, entryOpen: entryOpen, entryGive: entryGive, entrySeen: entrySeen, entryPoll: entryPoll, entryClose: entryClose, subsUrl: subsUrl, audioLang: audioLang, setAudioLang: setAudioLang, installMode: function () { return MODE; },
|
|
365
|
+
return { ensureService: ensureService, resolverUrl: resolverUrl, infoUrl: infoUrl, canPlay: canPlay, liveOpen: liveOpen, fileOpen: fileOpen, mediaInfo: mediaInfo, pluginNet: pluginNet, hlsMaster: hlsMaster, aiomAddons: aiomAddons, stalkerList: stalkerList, stalkerVod: stalkerVod, drmLicense: drmLicense, stalkerPlayUrl: stalkerPlayUrl, stalkerGenres: stalkerGenres, stalkerLink: stalkerLink, xtvodAsk: xtvodAsk, epgLoad: epgLoad, epgGet: epgGet, epgFiles: epgFiles, epgClear: epgClear, entryOpen: entryOpen, entryGive: entryGive, bakWrite: bakWrite, bakRead: bakRead, entrySeen: entrySeen, entryPoll: entryPoll, entryClose: entryClose, subsUrl: subsUrl, audioLang: audioLang, setAudioLang: setAudioLang, installMode: function () { return MODE; },
|
|
333
366
|
installLabel: installLabel, unavailableMessage: unavailableMessage, isRunning: isRunning, port: PORT };
|
|
334
367
|
})();
|