Last active
August 27, 2021 07:55
-
-
Save code-rgb/91b0e090abce0c9a5f074db1e4393036 to your computer and use it in GitHub Desktop.
Mediainfo Static
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Fail fast | |
set -euo pipefail | |
WORK_DIR=$PWD | |
latest_release() { | |
curl -s "https://api.github.com/repos/$1/releases/latest" | | |
grep '"tag_name":' | | |
sed -E 's/.*"v([^"]+)".*/\1/' | |
} | |
get_source() { | |
echo "https://mediaarea.net/download/binary/mediainfo/$1/MediaInfo_CLI_$1_GNU_FromSource.tar.gz" | |
} | |
version=$(latest_release 'MediaArea/MediaInfo') | |
platform=`uname` | |
binary='build/MediaInfo/Project/GNU/CLI/mediainfo' | |
echo ' | |
_________________________________________ | |
| | | |
| Building Binary for Mediainfo ... | | |
|________________________________________| | |
' | |
echo " Version : v$version" | |
echo " OS : $platform" | |
mkdir -p build && cd build | |
curl -sL $(get_source $version) | tar -xz --strip-components=1 | |
if [ -f CLI_Compile.sh ] ; then | |
chmod +x CLI_Compile.sh | |
./CLI_Compile.sh | |
else | |
echo 'CLI_Compile.sh Not Found !' | |
echo 'EXITING...' | |
exit 1 | |
fi | |
cd $WORK_DIR | |
if [ -f $binary ] ; then | |
mv $binary . | |
else | |
echo "$binary Doesn't Exists !" | |
echo 'EXITING...' | |
exit 1 | |
fi | |
tar -czvf "mediainfo_$version.tar.gz" mediainfo | |
mkdir -p release && mv *.tar.gz release/ | |
rm -rf build/ | |
echo 'DONE' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment