From ea7bd033e6fcf2416a1b9cd6fb7d008025c54efe Mon Sep 17 00:00:00 2001 From: q3aql Date: Thu, 21 Apr 2022 21:03:27 +0200 Subject: [PATCH] Script for rename ffmpeg to ffmpeg-av (My build for Arch Linux) --- src/ks-tools-ffmpeg-av.sh | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 src/ks-tools-ffmpeg-av.sh diff --git a/src/ks-tools-ffmpeg-av.sh b/src/ks-tools-ffmpeg-av.sh new file mode 100755 index 0000000..ebe5624 --- /dev/null +++ b/src/ks-tools-ffmpeg-av.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +############################################################## +# ks-tools adapter to use ffmpeg-av # +# Last change: 08-06-2022 # +# Author: q3aql # +# Contact: q3aql@duck.com # +# License: GPL v2.0 # +############################################################## +M_DATE="2022.04.08" + +# Commands will be adapted for ffmpeg-av +kstools_commands="ks-mp4 ks-mp4s ks-mp4k ks-avi ks-vob ks-oga ks-oga-album ks-mp3 ks-mp3-album ks-mix ks-crop ks-mp4-wrapper ks-mp4s-wrapper ks-avi-wrapper ks-vob-wrapper" + +# Function to check admin permissions +function checkAdminPerm() { + mkdir -p /etc/root &> /dev/null + administrador=$? + if [ ${administrador} -eq 0 ] ; then + rm -rf /etc/root + else + echo "" + echo "# ks-tools with ffmpeg-av adapter ${M_DATE}" + echo "" + echo "# Administrator permissions are required." + echo "" + exit + fi +} + +# Check if ffmpeg-av is installed +checkAdminPerm +if [ -f /usr/bin/ffmpeg-av ] ; then + echo "" + echo "# ffmpeg-av detected" +else + echo "" + echo "# ffmpeg-av not detected" + echo "" + exit +fi + +# Run function to change for ffmpeg-av +for file_command in ${kstools_commands} ; do + if [ -f /usr/bin/${file_command} ] ; then + check_previous=$(cat /usr/bin/${file_command} | grep "ffmpeg-av") + if [ -z "${check_previous}" ] ; then + sed -i "s/ffmpeg -y/ffmpeg-av -y/g" /usr/bin/${file_command} + sed -i "s/ffmpeg -i/ffmpeg-av -i/g" /usr/bin/${file_command} + sed -i "s/ffmpeg --help/ffmpeg-av --help/g" /usr/bin/${file_command} + sed -i "s/The 'ffmpeg' tool/The 'ffmpeg-av' tool/g" /usr/bin/${file_command} + echo "# ${file_command} linked to ffmpeg-av" + else + echo "# ${file_command} already linked to ffmpeg-av" + fi + fi +done +echo "# Done" +echo "" +exit +