Change the way we detect Windows admin permission

This commit is contained in:
Michael Campagnaro 2020-11-23 14:14:03 -05:00
parent e1f29f72e1
commit 3dec337272
2 changed files with 7 additions and 6 deletions

View File

@ -45,18 +45,17 @@ function encode() {
output="${output_name}.$extension"
fi
printf "\n${YELLOW}${BOLD}Encoding with crf $crf | output: $output${NORMAL}\n"
printf "\n${YELLOW}${BOLD}Encoding '$filename.$extension' with CRF $crf | output: $output${NORMAL}\n"
ffmpeg -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v baseline -level 3.0 -strict -2 "$output"
printf "\n${GREEN}${BOLD}Done encoding with crf $crf${NORMAL}\n\n"
printf "\n${GREEN}${BOLD}Done encoding '$filename.$extension' with CRF $crf${NORMAL}\n\n"
}
if [[ $use_crf == "" ]]; then
use_crf=$default_crf
fi
if [[ $use_crf == -1 ]]; then
printf "\n${YELLOW}${BOLD}Encoding using a range of crf values.${NORMAL}\n"
printf "\n${YELLOW}${BOLD}Encoding using a range of CRF values.${NORMAL}\n"
# Bigger crf values == bigger compression.
for crf in {25..28}

View File

@ -20,9 +20,11 @@ os_is_windows is_windows
os_is_macos is_macos
os_is_linux is_linux
# Check for admin permissions when running on Windows.
if [[ $is_windows -eq 1 ]]; then
# Check for admin permissions.
net session &>/dev/null
# `openfiles` is a command present on all supported Windows versions,
# requires admin privileges, and has no side effects.
openfiles &>/dev/null
admin_error=$?
if [[ ! $admin_error -eq 0 ]]; then
fatal "You need to run this in an admin shell!"