mirror of
https://github.com/9001/copyparty.git
synced 2026-06-18 20:22:27 -06:00
PRTY_FFMPEG_BIN
This commit is contained in:
parent
9068ec6a8e
commit
5e806ec124
|
|
@ -3225,6 +3225,8 @@ enable [smb](#smb-server) support (**not** recommended): `impacket==0.13.0`
|
||||||
|
|
||||||
to install FFmpeg on Windows, grab [a recent build](https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-full.7z) -- you need `ffmpeg.exe` and `ffprobe.exe` from inside the `bin` folder; copy them into `C:\Windows\System32` or any other folder that's in your `%PATH%`
|
to install FFmpeg on Windows, grab [a recent build](https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-full.7z) -- you need `ffmpeg.exe` and `ffprobe.exe` from inside the `bin` folder; copy them into `C:\Windows\System32` or any other folder that's in your `%PATH%`
|
||||||
|
|
||||||
|
if your ffmpeg/ffprobe binaries have nonstandard names -- such as `ffmpeg8` (macports) -- set environment variables `PRTY_FFMPEG_BIN` and `PRTY_FFPROBE_BIN` to the corret name (or full path)
|
||||||
|
|
||||||
|
|
||||||
### dependency chickenbits
|
### dependency chickenbits
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,24 +46,33 @@ except:
|
||||||
HAVE_MUTAGEN = False
|
HAVE_MUTAGEN = False
|
||||||
|
|
||||||
|
|
||||||
def have_ff(scmd: str) -> bool:
|
def have_ff(name: str) -> bool:
|
||||||
if ANYWIN:
|
uname = name.upper()
|
||||||
scmd += ".exe"
|
if os.environ.get("PRTY_NO_" + uname):
|
||||||
|
return b""
|
||||||
|
|
||||||
|
ebin = os.environ.get("PRTY_%s_BIN" % (uname,))
|
||||||
|
try:
|
||||||
|
bcmd = (ebin or name).encode("utf-8")
|
||||||
|
except:
|
||||||
|
bcmd = ebin or name
|
||||||
|
|
||||||
|
if ANYWIN and not ebin:
|
||||||
|
bcmd += b".exe"
|
||||||
|
|
||||||
if PY2:
|
if PY2:
|
||||||
print("# checking {}".format(scmd))
|
print("# checking {}".format(bcmd))
|
||||||
acmd = (scmd + " -version").encode("ascii").split(b" ")
|
|
||||||
try:
|
try:
|
||||||
sp.Popen(acmd, stdout=sp.PIPE, stderr=sp.PIPE).communicate()
|
sp.Popen([bcmd, b"-version"], stdout=sp.PIPE, stderr=sp.PIPE).communicate()
|
||||||
return True
|
return bcmd
|
||||||
except:
|
except:
|
||||||
return False
|
return b""
|
||||||
else:
|
else:
|
||||||
return bool(shutil.which(scmd))
|
return shutil.which(bcmd) or b""
|
||||||
|
|
||||||
|
|
||||||
HAVE_FFMPEG = not os.environ.get("PRTY_NO_FFMPEG") and have_ff("ffmpeg")
|
HAVE_FFMPEG = have_ff("ffmpeg")
|
||||||
HAVE_FFPROBE = not os.environ.get("PRTY_NO_FFPROBE") and have_ff("ffprobe")
|
HAVE_FFPROBE = have_ff("ffprobe")
|
||||||
|
|
||||||
CBZ_PICS = set("png jpg jpeg gif bmp tga tif tiff webp avif jxl".split())
|
CBZ_PICS = set("png jpg jpeg gif bmp tga tif tiff webp avif jxl".split())
|
||||||
CBZ_01 = re.compile(r"(^|[^0-9v])0+[01]\b")
|
CBZ_01 = re.compile(r"(^|[^0-9v])0+[01]\b")
|
||||||
|
|
@ -219,7 +228,7 @@ def ffprobe(
|
||||||
) -> tuple[dict[str, tuple[int, Any]], dict[str, list[Any]], list[Any], dict[str, Any]]:
|
) -> tuple[dict[str, tuple[int, Any]], dict[str, list[Any]], list[Any], dict[str, Any]]:
|
||||||
# ffprobe -hide_banner -show_streams -show_format --
|
# ffprobe -hide_banner -show_streams -show_format --
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffprobe",
|
HAVE_FFPROBE,
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
b"-show_streams",
|
b"-show_streams",
|
||||||
b"-show_format",
|
b"-show_format",
|
||||||
|
|
|
||||||
|
|
@ -860,7 +860,7 @@ class ThumbSrv(object):
|
||||||
bscale = scale.format(*list(res)).encode("utf-8")
|
bscale = scale.format(*list(res)).encode("utf-8")
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner"
|
b"-hide_banner"
|
||||||
|
|
@ -1001,7 +1001,7 @@ class ThumbSrv(object):
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
@ -1080,7 +1080,7 @@ class ThumbSrv(object):
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
@ -1112,7 +1112,7 @@ class ThumbSrv(object):
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
@ -1148,7 +1148,7 @@ class ThumbSrv(object):
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
@ -1177,7 +1177,7 @@ class ThumbSrv(object):
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
@ -1212,7 +1212,7 @@ class ThumbSrv(object):
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
@ -1273,7 +1273,7 @@ class ThumbSrv(object):
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
@ -1314,7 +1314,7 @@ class ThumbSrv(object):
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
@ -1340,7 +1340,7 @@ class ThumbSrv(object):
|
||||||
self.log("conv2 caf-transcode; dur=%d sz=%d q=%s" % (dur, sz, zs), 6)
|
self.log("conv2 caf-transcode; dur=%d sz=%d q=%s" % (dur, sz, zs), 6)
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
@ -1361,7 +1361,7 @@ class ThumbSrv(object):
|
||||||
self.log("conv2 caf-remux; dur=%d sz=%d" % (dur, sz), 6)
|
self.log("conv2 caf-remux; dur=%d sz=%d" % (dur, sz), 6)
|
||||||
# fmt: off
|
# fmt: off
|
||||||
cmd = [
|
cmd = [
|
||||||
b"ffmpeg",
|
HAVE_FFMPEG,
|
||||||
b"-nostdin",
|
b"-nostdin",
|
||||||
b"-v", b"error",
|
b"-v", b"error",
|
||||||
b"-hide_banner",
|
b"-hide_banner",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue