Change calc command for bc
This commit is contained in:
parent
e2e801e741
commit
a7015d228b
22
src/ks-av1
22
src/ks-av1
|
@ -51,16 +51,16 @@ fi
|
||||||
# Setting the correct resolution for the video file
|
# Setting the correct resolution for the video file
|
||||||
# Sintaxis: set_resolution <resolution> <file>
|
# Sintaxis: set_resolution <resolution> <file>
|
||||||
function set_resolution() {
|
function set_resolution() {
|
||||||
check_calc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
check_bc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||||
set_rel="${1}"
|
set_rel="${1}"
|
||||||
input_video_file="${2}"
|
input_video_file="${2}"
|
||||||
calc_found="1"
|
bc_found="1"
|
||||||
for file in ${check_calc_app_directories} ; do
|
for file in ${check_bc_app_directories} ; do
|
||||||
if [ -f ${file}/calc ] ; then
|
if [ -f ${file}/bc ] ; then
|
||||||
calc_found=0
|
bc_found=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${calc_found} -eq 0 ] ; then
|
if [ ${bc_found} -eq 0 ] ; then
|
||||||
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
||||||
if [ -z "${file_rel}" ] ; then
|
if [ -z "${file_rel}" ] ; then
|
||||||
echo ${set_rel}
|
echo ${set_rel}
|
||||||
|
@ -68,14 +68,12 @@ function set_resolution() {
|
||||||
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
||||||
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
||||||
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
||||||
aspect_rel=$(calc ${file_rel_width} / ${file_rel_height} | tr -s "~" " ")
|
aspect_rel=$(echo ${file_rel_width} / ${file_rel_height} | bc -l)
|
||||||
new_rel_height=$(calc ${set_rel_width} / ${aspect_rel} | cut -d "." -f 1 | tr -s "~" " ")
|
new_rel_height=$(echo ${set_rel_width} / ${aspect_rel} | bc)
|
||||||
even_number=$(calc ${new_rel_height} % 2)
|
even_number=$(echo ${new_rel_height} % 2 | bc)
|
||||||
if [ ${even_number} -ne 0 ] ; then
|
if [ ${even_number} -ne 0 ] ; then
|
||||||
new_rel_height=$(calc ${new_rel_height} + 1)
|
new_rel_height=$(expr ${new_rel_height} + 1)
|
||||||
fi
|
fi
|
||||||
set_rel_width=$(echo ${set_rel_width})
|
|
||||||
new_rel_height=$(echo ${new_rel_height})
|
|
||||||
echo ${set_rel_width}x${new_rel_height}
|
echo ${set_rel_width}x${new_rel_height}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
22
src/ks-av1s
22
src/ks-av1s
|
@ -51,16 +51,16 @@ fi
|
||||||
# Setting the correct resolution for the video file
|
# Setting the correct resolution for the video file
|
||||||
# Sintaxis: set_resolution <resolution> <file>
|
# Sintaxis: set_resolution <resolution> <file>
|
||||||
function set_resolution() {
|
function set_resolution() {
|
||||||
check_calc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
check_bc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||||
set_rel="${1}"
|
set_rel="${1}"
|
||||||
input_video_file="${2}"
|
input_video_file="${2}"
|
||||||
calc_found="1"
|
bc_found="1"
|
||||||
for file in ${check_calc_app_directories} ; do
|
for file in ${check_bc_app_directories} ; do
|
||||||
if [ -f ${file}/calc ] ; then
|
if [ -f ${file}/bc ] ; then
|
||||||
calc_found=0
|
bc_found=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${calc_found} -eq 0 ] ; then
|
if [ ${bc_found} -eq 0 ] ; then
|
||||||
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
||||||
if [ -z "${file_rel}" ] ; then
|
if [ -z "${file_rel}" ] ; then
|
||||||
echo ${set_rel}
|
echo ${set_rel}
|
||||||
|
@ -68,14 +68,12 @@ function set_resolution() {
|
||||||
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
||||||
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
||||||
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
||||||
aspect_rel=$(calc ${file_rel_width} / ${file_rel_height} | tr -s "~" " ")
|
aspect_rel=$(echo ${file_rel_width} / ${file_rel_height} | bc -l)
|
||||||
new_rel_height=$(calc ${set_rel_width} / ${aspect_rel} | cut -d "." -f 1 | tr -s "~" " ")
|
new_rel_height=$(echo ${set_rel_width} / ${aspect_rel} | bc)
|
||||||
even_number=$(calc ${new_rel_height} % 2)
|
even_number=$(echo ${new_rel_height} % 2 | bc)
|
||||||
if [ ${even_number} -ne 0 ] ; then
|
if [ ${even_number} -ne 0 ] ; then
|
||||||
new_rel_height=$(calc ${new_rel_height} + 1)
|
new_rel_height=$(expr ${new_rel_height} + 1)
|
||||||
fi
|
fi
|
||||||
set_rel_width=$(echo ${set_rel_width})
|
|
||||||
new_rel_height=$(echo ${new_rel_height})
|
|
||||||
echo ${set_rel_width}x${new_rel_height}
|
echo ${set_rel_width}x${new_rel_height}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
22
src/ks-avi
22
src/ks-avi
|
@ -54,16 +54,16 @@ fi
|
||||||
# Setting the correct resolution for the video file
|
# Setting the correct resolution for the video file
|
||||||
# Sintaxis: set_resolution <resolution> <file>
|
# Sintaxis: set_resolution <resolution> <file>
|
||||||
function set_resolution() {
|
function set_resolution() {
|
||||||
check_calc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
check_bc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||||
set_rel="${1}"
|
set_rel="${1}"
|
||||||
input_video_file="${2}"
|
input_video_file="${2}"
|
||||||
calc_found="1"
|
bc_found="1"
|
||||||
for file in ${check_calc_app_directories} ; do
|
for file in ${check_bc_app_directories} ; do
|
||||||
if [ -f ${file}/calc ] ; then
|
if [ -f ${file}/bc ] ; then
|
||||||
calc_found=0
|
bc_found=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${calc_found} -eq 0 ] ; then
|
if [ ${bc_found} -eq 0 ] ; then
|
||||||
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
||||||
if [ -z "${file_rel}" ] ; then
|
if [ -z "${file_rel}" ] ; then
|
||||||
echo ${set_rel}
|
echo ${set_rel}
|
||||||
|
@ -71,14 +71,12 @@ function set_resolution() {
|
||||||
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
||||||
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
||||||
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
||||||
aspect_rel=$(calc ${file_rel_width} / ${file_rel_height} | tr -s "~" " ")
|
aspect_rel=$(echo ${file_rel_width} / ${file_rel_height} | bc -l)
|
||||||
new_rel_height=$(calc ${set_rel_width} / ${aspect_rel} | cut -d "." -f 1 | tr -s "~" " ")
|
new_rel_height=$(echo ${set_rel_width} / ${aspect_rel} | bc)
|
||||||
even_number=$(calc ${new_rel_height} % 2)
|
even_number=$(echo ${new_rel_height} % 2 | bc)
|
||||||
if [ ${even_number} -ne 0 ] ; then
|
if [ ${even_number} -ne 0 ] ; then
|
||||||
new_rel_height=$(calc ${new_rel_height} + 1)
|
new_rel_height=$(expr ${new_rel_height} + 1)
|
||||||
fi
|
fi
|
||||||
set_rel_width=$(echo ${set_rel_width})
|
|
||||||
new_rel_height=$(echo ${new_rel_height})
|
|
||||||
echo ${set_rel_width}x${new_rel_height}
|
echo ${set_rel_width}x${new_rel_height}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
22
src/ks-mp4
22
src/ks-mp4
|
@ -54,16 +54,16 @@ fi
|
||||||
# Setting the correct resolution for the video file
|
# Setting the correct resolution for the video file
|
||||||
# Sintaxis: set_resolution <resolution> <file>
|
# Sintaxis: set_resolution <resolution> <file>
|
||||||
function set_resolution() {
|
function set_resolution() {
|
||||||
check_calc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
check_bc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||||
set_rel="${1}"
|
set_rel="${1}"
|
||||||
input_video_file="${2}"
|
input_video_file="${2}"
|
||||||
calc_found="1"
|
bc_found="1"
|
||||||
for file in ${check_calc_app_directories} ; do
|
for file in ${check_bc_app_directories} ; do
|
||||||
if [ -f ${file}/calc ] ; then
|
if [ -f ${file}/bc ] ; then
|
||||||
calc_found=0
|
bc_found=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${calc_found} -eq 0 ] ; then
|
if [ ${bc_found} -eq 0 ] ; then
|
||||||
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
||||||
if [ -z "${file_rel}" ] ; then
|
if [ -z "${file_rel}" ] ; then
|
||||||
echo ${set_rel}
|
echo ${set_rel}
|
||||||
|
@ -71,14 +71,12 @@ function set_resolution() {
|
||||||
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
||||||
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
||||||
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
||||||
aspect_rel=$(calc ${file_rel_width} / ${file_rel_height} | tr -s "~" " ")
|
aspect_rel=$(echo ${file_rel_width} / ${file_rel_height} | bc -l)
|
||||||
new_rel_height=$(calc ${set_rel_width} / ${aspect_rel} | cut -d "." -f 1 | tr -s "~" " ")
|
new_rel_height=$(echo ${set_rel_width} / ${aspect_rel} | bc)
|
||||||
even_number=$(calc ${new_rel_height} % 2)
|
even_number=$(echo ${new_rel_height} % 2 | bc)
|
||||||
if [ ${even_number} -ne 0 ] ; then
|
if [ ${even_number} -ne 0 ] ; then
|
||||||
new_rel_height=$(calc ${new_rel_height} + 1)
|
new_rel_height=$(expr ${new_rel_height} + 1)
|
||||||
fi
|
fi
|
||||||
set_rel_width=$(echo ${set_rel_width})
|
|
||||||
new_rel_height=$(echo ${new_rel_height})
|
|
||||||
echo ${set_rel_width}x${new_rel_height}
|
echo ${set_rel_width}x${new_rel_height}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
22
src/ks-mp4k
22
src/ks-mp4k
|
@ -54,16 +54,16 @@ fi
|
||||||
# Setting the correct resolution for the video file
|
# Setting the correct resolution for the video file
|
||||||
# Sintaxis: set_resolution <resolution> <file>
|
# Sintaxis: set_resolution <resolution> <file>
|
||||||
function set_resolution() {
|
function set_resolution() {
|
||||||
check_calc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
check_bc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||||
set_rel="${1}"
|
set_rel="${1}"
|
||||||
input_video_file="${2}"
|
input_video_file="${2}"
|
||||||
calc_found="1"
|
bc_found="1"
|
||||||
for file in ${check_calc_app_directories} ; do
|
for file in ${check_bc_app_directories} ; do
|
||||||
if [ -f ${file}/calc ] ; then
|
if [ -f ${file}/bc ] ; then
|
||||||
calc_found=0
|
bc_found=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${calc_found} -eq 0 ] ; then
|
if [ ${bc_found} -eq 0 ] ; then
|
||||||
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
||||||
if [ -z "${file_rel}" ] ; then
|
if [ -z "${file_rel}" ] ; then
|
||||||
echo ${set_rel}
|
echo ${set_rel}
|
||||||
|
@ -71,14 +71,12 @@ function set_resolution() {
|
||||||
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
||||||
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
||||||
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
||||||
aspect_rel=$(calc ${file_rel_width} / ${file_rel_height} | tr -s "~" " ")
|
aspect_rel=$(echo ${file_rel_width} / ${file_rel_height} | bc -l)
|
||||||
new_rel_height=$(calc ${set_rel_width} / ${aspect_rel} | cut -d "." -f 1 | tr -s "~" " ")
|
new_rel_height=$(echo ${set_rel_width} / ${aspect_rel} | bc)
|
||||||
even_number=$(calc ${new_rel_height} % 2)
|
even_number=$(echo ${new_rel_height} % 2 | bc)
|
||||||
if [ ${even_number} -ne 0 ] ; then
|
if [ ${even_number} -ne 0 ] ; then
|
||||||
new_rel_height=$(calc ${new_rel_height} + 1)
|
new_rel_height=$(expr ${new_rel_height} + 1)
|
||||||
fi
|
fi
|
||||||
set_rel_width=$(echo ${set_rel_width})
|
|
||||||
new_rel_height=$(echo ${new_rel_height})
|
|
||||||
echo ${set_rel_width}x${new_rel_height}
|
echo ${set_rel_width}x${new_rel_height}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
22
src/ks-mp4s
22
src/ks-mp4s
|
@ -54,16 +54,16 @@ fi
|
||||||
# Setting the correct resolution for the video file
|
# Setting the correct resolution for the video file
|
||||||
# Sintaxis: set_resolution <resolution> <file>
|
# Sintaxis: set_resolution <resolution> <file>
|
||||||
function set_resolution() {
|
function set_resolution() {
|
||||||
check_calc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
check_bc_app_directories="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
|
||||||
set_rel="${1}"
|
set_rel="${1}"
|
||||||
input_video_file="${2}"
|
input_video_file="${2}"
|
||||||
calc_found="1"
|
bc_found="1"
|
||||||
for file in ${check_calc_app_directories} ; do
|
for file in ${check_bc_app_directories} ; do
|
||||||
if [ -f ${file}/calc ] ; then
|
if [ -f ${file}/bc ] ; then
|
||||||
calc_found=0
|
bc_found=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${calc_found} -eq 0 ] ; then
|
if [ ${bc_found} -eq 0 ] ; then
|
||||||
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}')
|
||||||
if [ -z "${file_rel}" ] ; then
|
if [ -z "${file_rel}" ] ; then
|
||||||
echo ${set_rel}
|
echo ${set_rel}
|
||||||
|
@ -71,14 +71,12 @@ function set_resolution() {
|
||||||
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
file_rel_width=$(echo ${file_rel} | cut -d "x" -f 1)
|
||||||
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
file_rel_height=$(echo ${file_rel} | cut -d "x" -f 2)
|
||||||
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
set_rel_width=$(echo ${set_rel} | cut -d "x" -f 1)
|
||||||
aspect_rel=$(calc ${file_rel_width} / ${file_rel_height} | tr -s "~" " ")
|
aspect_rel=$(echo ${file_rel_width} / ${file_rel_height} | bc -l)
|
||||||
new_rel_height=$(calc ${set_rel_width} / ${aspect_rel} | cut -d "." -f 1 | tr -s "~" " ")
|
new_rel_height=$(echo ${set_rel_width} / ${aspect_rel} | bc)
|
||||||
even_number=$(calc ${new_rel_height} % 2)
|
even_number=$(echo ${new_rel_height} % 2 | bc)
|
||||||
if [ ${even_number} -ne 0 ] ; then
|
if [ ${even_number} -ne 0 ] ; then
|
||||||
new_rel_height=$(calc ${new_rel_height} + 1)
|
new_rel_height=$(expr ${new_rel_height} + 1)
|
||||||
fi
|
fi
|
||||||
set_rel_width=$(echo ${set_rel_width})
|
|
||||||
new_rel_height=$(echo ${new_rel_height})
|
|
||||||
echo ${set_rel_width}x${new_rel_height}
|
echo ${set_rel_width}x${new_rel_height}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user