Compare commits

...

5 Commits

Author SHA1 Message Date
ed
391caca043 v1.1.1 2021-11-08 22:39:00 +01:00
ed
171ce348d6 improve swr 2021-11-08 22:25:35 +01:00
ed
c2cc729135 update sfx sizes 2021-11-08 21:11:10 +01:00
ed
e7e71b76f0 add alternative preloader for spotty connections 2021-11-08 20:46:40 +01:00
ed
a2af61cf6f fix clipboard sharing on recent firefox versions 2021-11-08 20:43:26 +01:00
6 changed files with 64 additions and 22 deletions

View File

@@ -1065,13 +1065,14 @@ pls note that `copyparty-sfx.sh` will fail if you rename `copyparty-sfx.py` to `
reduce the size of an sfx by removing features
if you don't need all the features, you can repack the sfx and save a bunch of space; all you need is an sfx and a copy of this repo (nothing else to download or build, except if you're on windows then you need msys2 or WSL)
* `525k` size of original sfx.py as of v0.11.30
* `315k` after `./scripts/make-sfx.sh re no-ogv`
* `223k` after `./scripts/make-sfx.sh re no-ogv no-cm`
* `584k` size of original sfx.py as of v1.1.0
* `392k` after `./scripts/make-sfx.sh re no-ogv`
* `310k` after `./scripts/make-sfx.sh re no-ogv no-cm`
* `269k` after `./scripts/make-sfx.sh re no-ogv no-cm no-hl`
the features you can opt to drop are
* `ogv`.js, the opus/vorbis decoder which is needed by apple devices to play foss audio files, saves ~192k
* `cm`/easymde, the "fancy" markdown editor, saves ~92k
* `cm`/easymde, the "fancy" markdown editor, saves ~82k
* `hl`, prism, the syntax hilighter, saves ~41k
* `fnt`, source-code-pro, the monospace font, saves ~9k
* `dd`, the custom mouse cursor for the media player tray tab, saves ~2k

View File

@@ -1,8 +1,8 @@
# coding: utf-8
VERSION = (1, 1, 0)
VERSION = (1, 1, 1)
CODENAME = "opus"
BUILD_DT = (2021, 11, 6)
BUILD_DT = (2021, 11, 8)
S_VERSION = ".".join(map(str, VERSION))
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)

View File

@@ -362,7 +362,13 @@ class ThumbSrv(object):
raise Exception("not audio")
fc = "[0:a:0]aresample=48000{},showspectrumpic=s=640x512,crop=780:544:70:50[o]"
fc = fc.format("" if self.args.th_ff_swr else ":resampler=soxr")
if self.args.th_ff_swr:
fco = ":filter_size=128:cutoff=0.877"
else:
fco = ":resampler=soxr"
fc = fc.format(fco)
# fmt: off
cmd = [

View File

@@ -870,11 +870,13 @@ html.light #tree.nowrap .ntree a+a:hover {
border-bottom: 1px solid #555;
}
#thumbs,
#au_fullpre,
#au_osd_cv,
#u2tdate {
opacity: .3;
}
#griden.on+#thumbs,
#au_preload.on+#au_fullpre,
#au_os_ctl.on+#au_osd_cv,
#u2turbo.on+#u2tdate {
opacity: 1;

View File

@@ -314,6 +314,7 @@ var mpl = (function () {
ebi('op_player').innerHTML = (
'<div><h3>switches</h3><div>' +
'<a href="#" class="tgl btn" id="au_preload" tt="start loading the next song near the end for gapless playback">preload</a>' +
'<a href="#" class="tgl btn" id="au_fullpre" tt="try to preload the entire song;$N✔ enable on <b>unreliable</b> connections,$N❌ <b>disable</b> on slow connections probably">full</a>' +
'<a href="#" class="tgl btn" id="au_npclip" tt="show buttons for clipboarding the currently playing song">/np clip</a>' +
'<a href="#" class="tgl btn" id="au_os_ctl" tt="os integration (media hotkeys / osd)">os-ctl</a>' +
'<a href="#" class="tgl btn" id="au_osd_cv" tt="show album cover in osd">osd-cv</a>' +
@@ -343,6 +344,7 @@ var mpl = (function () {
"os_ctl": bcfg_get('au_os_ctl', have_mctl) && have_mctl,
};
bcfg_bind(r, 'preload', 'au_preload', true);
bcfg_bind(r, 'fullpre', 'au_fullpre', false);
bcfg_bind(r, 'osd_cv', 'au_osd_cv', true);
bcfg_bind(r, 'clip', 'au_npclip', false, function (v) {
clmod(ebi('wtoggle'), 'np', v && mp.au);
@@ -587,8 +589,25 @@ function MPlayer() {
}
r.preload = function (url) {
var au = null;
url = mpl.acode(url);
url += url.indexOf('?') < 0 ? '?cache' : '&cache';
if (mpl.fullpre)
return fetch(url).then(function (x) {
var rd = x.body.getReader(), n = 0;
function drop(x) {
if (x && x.value && x.value.length)
n += x.value.length;
if (n >= 128 * 1024 * 1024)
return console.log('aborting preload at 128 MiB');
if (!x || !x.done)
return rd.read().then(drop);
}
drop();
});
var au = null;
if (need_ogv_for(url)) {
au = mp.au_ogvjs2;
if (!au && window['OGVPlayer']) {
@@ -604,9 +623,8 @@ function MPlayer() {
r.au_native2 = au;
}
}
if (au) {
au.src = url + (url.indexOf('?') < 0 ? '?cache' : '&cache');
}
if (au)
au.src = url;
};
}
@@ -1067,7 +1085,7 @@ var mpui = (function () {
var pos = mp.au.currentTime,
len = mp.au.duration;
if (pos > 0 && pos > len - 20) {
if (pos > 0 && pos > len - (mpl.fullpre ? 40 : 20)) {
preloaded = mp.au.src;
try {
mp.preload(mp.tracks[mp.order[mp.order.indexOf(mp.au.tid) + 1]]);
@@ -1808,7 +1826,7 @@ var fileman = (function () {
r.render = function () {
if (r.clip === null)
r.clip = jread('fman_clip', []);
r.clip = jread('fman_clip', []).slice(1);
var nsel = msel.getsel().length;
clmod(bren, 'en', nsel);
@@ -2169,7 +2187,7 @@ var fileman = (function () {
vps = [];
if (!sel.length)
return toast.err(3, 'select at least 1 item to cut');
toast.err(3, 'select at least 1 item to cut');
var els = [];
for (var a = 0; a < sel.length; a++) {
@@ -2186,13 +2204,15 @@ var fileman = (function () {
}, 1);
try {
vps = JSON.stringify(vps);
var stamp = Date.now();
vps = JSON.stringify([stamp].concat(vps));
if (vps.length > 1024 * 1024)
throw 'a';
swrite('fman_clip', vps);
r.tx(1);
toast.inf(1.5, 'cut ' + sel.length + ' items');
r.tx(stamp);
if (sel.length)
toast.inf(1.5, 'cut ' + sel.length + ' items');
}
catch (ex) {
toast.warn(30, 'cut ' + sel.length + ' items\n\nbut: only <b>this</b> browser-tab can paste them\n(since the selection is so absolutely massive)');
@@ -2266,15 +2286,28 @@ var fileman = (function () {
modal.confirm('paste these ' + req.length + ' items here?<ul>' + uricom_adec(req, true).join('') + '</ul>', function () {
paster();
jwrite('fman_clip', []);
jwrite('fman_clip', [Date.now()]);
}, null);
};
function onmsg(msg) {
r.clip = null;
r.render();
if (msg == get_evpath())
treectl.goto(msg);
var n = parseInt('' + msg), tries = 0;
var fun = function () {
if (n == msg && n > 1 && r.clip === null) {
var fc = jread('fman_clip', []);
if (!fc || !fc.length || fc[0] != n) {
if (++tries > 10)
return modal.alert('failed to read clipboard from other browser tab');
return setTimeout(fun, 100);
}
}
r.render();
if (msg == get_evpath())
treectl.goto(msg);
};
fun();
}
if (r.bus)

View File

@@ -19,7 +19,7 @@ help() { exec cat <<'EOF'
# `no-ogv` saves ~192k by removing the opus/vorbis audio codecs
# (only affects apple devices; everything else has native support)
#
# `no-cm` saves ~92k by removing easymde/codemirror
# `no-cm` saves ~82k by removing easymde/codemirror
# (the fancy markdown editor)
#
# `no-hl` saves ~41k by removing syntax hilighting in the text viewer