mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
option to use pngquant for smaller waveform PNGs
This commit is contained in:
parent
38e4fdfe03
commit
82ce6862ee
|
@ -190,6 +190,7 @@ flagcats = {
|
|||
"dvthumb": "disables video thumbnails",
|
||||
"dathumb": "disables audio thumbnails (spectrograms)",
|
||||
"dithumb": "disables image thumbnails",
|
||||
"pngquant": "compress audio waveforms 33% better",
|
||||
"thsize": "thumbnail res; WxH",
|
||||
"crop": "center-cropping (y/n/fy/fn)",
|
||||
"th3x": "3x resolution (y/n/fy/fn)",
|
||||
|
|
|
@ -593,6 +593,24 @@ class ThumbSrv(object):
|
|||
cmd += [fsenc(tpath)]
|
||||
self._run_ff(cmd, vn)
|
||||
|
||||
if "pngquant" in vn.flags:
|
||||
wtpath = tpath + ".png"
|
||||
cmd = [
|
||||
b"pngquant",
|
||||
b"--strip",
|
||||
b"--nofs",
|
||||
b"--output", fsenc(wtpath),
|
||||
fsenc(tpath)
|
||||
]
|
||||
ret = runcmd(cmd, timeout=vn.flags["convt"], nice=True, oom=400)[0]
|
||||
if ret:
|
||||
try:
|
||||
wunlink(self.log, wtpath, vn.flags)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
wrename(self.log, wtpath, tpath, vn.flags)
|
||||
|
||||
def conv_spec(self, abspath: str, tpath: str, fmt: str, vn: VFS) -> None:
|
||||
ret, _ = ffprobe(abspath, int(vn.flags["convt"] / 2))
|
||||
if "ac" not in ret:
|
||||
|
|
Loading…
Reference in a new issue