mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
mtag-bin: support alpine + misc health checks
This commit is contained in:
parent
6f6f9c1f74
commit
8137a99904
|
@ -35,8 +35,16 @@ def det(tf):
|
||||||
|
|
||||||
with open(tf, "rb") as f:
|
with open(tf, "rb") as f:
|
||||||
d = np.fromfile(f, dtype=np.float32)
|
d = np.fromfile(f, dtype=np.float32)
|
||||||
c = vamp.collect(d, 22050, "beatroot-vamp:beatroot")
|
try:
|
||||||
cl = c["list"]
|
# 98% accuracy on jcore
|
||||||
|
c = vamp.collect(d, 22050, "beatroot-vamp:beatroot")
|
||||||
|
cl = c["list"]
|
||||||
|
except:
|
||||||
|
# fallback; 73% accuracy
|
||||||
|
plug = "vamp-example-plugins:fixedtempo"
|
||||||
|
c = vamp.collect(d, 22050, plug, parameters={"maxdflen": 40})
|
||||||
|
print(c["list"][0]["label"].split(" ")[0])
|
||||||
|
return
|
||||||
|
|
||||||
# throws if detection failed:
|
# throws if detection failed:
|
||||||
bpm = float(cl[-1]["timestamp"] - cl[1]["timestamp"])
|
bpm = float(cl[-1]["timestamp"] - cl[1]["timestamp"])
|
||||||
|
|
|
@ -2,12 +2,14 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
||||||
# install optional dependencies
|
# install dependencies for audio-*.py
|
||||||
# works on linux, maybe on macos eventually
|
|
||||||
#
|
#
|
||||||
# enables the following features:
|
# linux: requires {python3,ffmpeg,fftw}-dev py3-{wheel,pip} py3-numpy{,-dev} vamp-sdk-dev
|
||||||
# bpm detection
|
# win64: requires msys2-mingw64 environment
|
||||||
# tempo detection
|
# macos: requires macports
|
||||||
|
#
|
||||||
|
# has the following manual dependencies, especially on mac:
|
||||||
|
# https://www.vamp-plugins.org/pack.html
|
||||||
#
|
#
|
||||||
# installs stuff to the following locations:
|
# installs stuff to the following locations:
|
||||||
# ~/pe/
|
# ~/pe/
|
||||||
|
@ -15,11 +17,10 @@ set -e
|
||||||
#
|
#
|
||||||
# does the following terrible things:
|
# does the following terrible things:
|
||||||
# modifies the keyfinder python lib to load the .so in ~/pe
|
# modifies the keyfinder python lib to load the .so in ~/pe
|
||||||
#
|
|
||||||
# has the following manual dependencies, especially on mac:
|
|
||||||
# https://www.vamp-plugins.org/pack.html
|
|
||||||
|
|
||||||
|
|
||||||
|
linux=1
|
||||||
|
|
||||||
win=
|
win=
|
||||||
[ ! -z "$MSYSTEM" ] || [ -e /msys2.exe ] && {
|
[ ! -z "$MSYSTEM" ] || [ -e /msys2.exe ] && {
|
||||||
[ "$MSYSTEM" = MINGW64 ] || {
|
[ "$MSYSTEM" = MINGW64 ] || {
|
||||||
|
@ -28,6 +29,7 @@ win=
|
||||||
}
|
}
|
||||||
pacman -S --needed mingw-w64-x86_64-{ffmpeg,python,python-pip,vamp-plugin-sdk}
|
pacman -S --needed mingw-w64-x86_64-{ffmpeg,python,python-pip,vamp-plugin-sdk}
|
||||||
win=1
|
win=1
|
||||||
|
linux=
|
||||||
}
|
}
|
||||||
|
|
||||||
mac=
|
mac=
|
||||||
|
@ -44,6 +46,7 @@ mac=
|
||||||
sudo port install $pkgs
|
sudo port install $pkgs
|
||||||
}
|
}
|
||||||
mac=1
|
mac=1
|
||||||
|
linux=
|
||||||
}
|
}
|
||||||
|
|
||||||
hash -r
|
hash -r
|
||||||
|
@ -67,6 +70,8 @@ need() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
need cmake
|
need cmake
|
||||||
|
need ffmpeg
|
||||||
|
need $pybin
|
||||||
#need patchelf
|
#need patchelf
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +103,7 @@ github_tarball() {
|
||||||
jq -r '.tarball_url' ||
|
jq -r '.tarball_url' ||
|
||||||
|
|
||||||
# fallback to awk (sorry)
|
# fallback to awk (sorry)
|
||||||
awk -F\" '/"tarball_url".*\.tar\.gz/ {print$4}'
|
awk -F\" '/"tarball_url": "/ {print$4}'
|
||||||
) |
|
) |
|
||||||
tee /dev/stderr |
|
tee /dev/stderr |
|
||||||
tr -d '\r' | tr '\n' '\0' |
|
tr -d '\r' | tr '\n' '\0' |
|
||||||
|
@ -150,14 +155,27 @@ install_keyfinder() {
|
||||||
cmake --build build --parallel $(nproc || echo 4)
|
cmake --build build --parallel $(nproc || echo 4)
|
||||||
cmake --install build
|
cmake --install build
|
||||||
|
|
||||||
|
libpath="$h/pe/keyfinder/$so"
|
||||||
|
[ $linux ] && [ ! -e "$libpath" ] &&
|
||||||
|
so=lib64/libkeyfinder.so
|
||||||
|
|
||||||
|
libpath="$h/pe/keyfinder/$so"
|
||||||
|
[ -e "$libpath" ] || {
|
||||||
|
echo "so not found at $sop"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# rm -rf /Users/ed/Library/Python/3.9/lib/python/site-packages/*keyfinder*
|
# rm -rf /Users/ed/Library/Python/3.9/lib/python/site-packages/*keyfinder*
|
||||||
CFLAGS="-I$h/pe/keyfinder/include -I/opt/local/include" \
|
CFLAGS="-I$h/pe/keyfinder/include -I/opt/local/include" \
|
||||||
LDFLAGS="-L$h/pe/keyfinder/lib -L/opt/local/lib" \
|
LDFLAGS="-L$h/pe/keyfinder/lib -L$h/pe/keyfinder/lib64 -L/opt/local/lib" \
|
||||||
PKG_CONFIG_PATH=/c/msys64/mingw64/lib/pkgconfig \
|
PKG_CONFIG_PATH=/c/msys64/mingw64/lib/pkgconfig \
|
||||||
$pybin -m pip install --user keyfinder
|
$pybin -m pip install --user keyfinder
|
||||||
|
|
||||||
pypath="$($pybin -c 'import keyfinder; print(keyfinder.__file__)')"
|
pypath="$($pybin -c 'import keyfinder; print(keyfinder.__file__)')"
|
||||||
libpath="$(echo "$h/pe/keyfinder/$so")"
|
for pyso in "${pypath%/*}"/*.so; do
|
||||||
|
[ -e "$pyso" ] || break
|
||||||
|
patchelf --set-rpath "${libpath%/*}" "$pyso"
|
||||||
|
done
|
||||||
|
|
||||||
mv "$pypath"{,.bak}
|
mv "$pypath"{,.bak}
|
||||||
(
|
(
|
||||||
|
@ -178,6 +196,8 @@ install_vamp() {
|
||||||
# pacman -S --needed mingw-w64-x86_64-{ffmpeg,python,python-pip,vamp-plugin-sdk}
|
# pacman -S --needed mingw-w64-x86_64-{ffmpeg,python,python-pip,vamp-plugin-sdk}
|
||||||
|
|
||||||
$pybin -m pip install --user vamp
|
$pybin -m pip install --user vamp
|
||||||
|
|
||||||
|
$pybin -c 'import vampyhost; plugs = vampyhost.list_plugins(); print("\033[31mWARNING: could not find the vamp beatroot plugin, please install it for optimal results\033[0m" if "beatroot-vamp:beatroot" not in plugs else "\033[32mbeatroot detected, good stuff\033[0m")'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue