mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
ffthumb only gets one shot
This commit is contained in:
parent
97be495861
commit
d8fd82bcb5
|
@ -8,7 +8,7 @@ import threading
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
|
|
||||||
from .__init__ import PY2
|
from .__init__ import PY2
|
||||||
from .util import fsenc, Queue, Cooldown, BytesIO
|
from .util import fsenc, mchkcmd, Queue, Cooldown, BytesIO
|
||||||
from .mtag import HAVE_FFMPEG, HAVE_FFPROBE, ffprobe
|
from .mtag import HAVE_FFMPEG, HAVE_FFPROBE, ffprobe
|
||||||
|
|
||||||
|
|
||||||
|
@ -299,8 +299,7 @@ class ThumbSrv(object):
|
||||||
|
|
||||||
cmd += [fsenc(tpath)]
|
cmd += [fsenc(tpath)]
|
||||||
|
|
||||||
p = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
|
mchkcmd(*cmd)
|
||||||
p.communicate()
|
|
||||||
|
|
||||||
def poke(self, tdir):
|
def poke(self, tdir):
|
||||||
if not self.poke_cd.poke(tdir):
|
if not self.poke_cd.poke(tdir):
|
||||||
|
|
|
@ -985,6 +985,17 @@ def chkcmd(*argv):
|
||||||
return sout, serr
|
return sout, serr
|
||||||
|
|
||||||
|
|
||||||
|
def mchkcmd(*argv, timeout=10):
|
||||||
|
if PY2:
|
||||||
|
with open(os.devnull, "wb") as f:
|
||||||
|
rv = sp.call(argv, stdout=f, stderr=f)
|
||||||
|
else:
|
||||||
|
rv = sp.call(argv, stdout=sp.DEVNULL, stderr=sp.DEVNULL, timeout=timeout)
|
||||||
|
|
||||||
|
if rv:
|
||||||
|
raise sp.CalledProcessError(rv, (argv[0], b"...", argv[-1]))
|
||||||
|
|
||||||
|
|
||||||
def gzip_orig_sz(fn):
|
def gzip_orig_sz(fn):
|
||||||
with open(fsenc(fn), "rb") as f:
|
with open(fsenc(fn), "rb") as f:
|
||||||
f.seek(-4, 2)
|
f.seek(-4, 2)
|
||||||
|
|
Loading…
Reference in a new issue