mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-01-30 09:48:11 +01:00
Merge b2de469c0ed8f5554f66b51506fc153762a2b09c into cf4a12acb3a70951fd59d67e0738bf3ab2d1045c
This commit is contained in:
commit
3dc4d5525e
@ -85,6 +85,52 @@ cmd delete ${{
|
|||||||
[ $ans = "y" ] && rm -rf -- $fx
|
[ $ans = "y" ] && rm -rf -- $fx
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
cmd compressvideo ${{
|
||||||
|
clear;
|
||||||
|
set -f;
|
||||||
|
|
||||||
|
converted_filenames=""; #notify-send variable
|
||||||
|
converted_files_count=0; #notify-send variable
|
||||||
|
|
||||||
|
echo "Compression Rate? (default: 31, maximum: 50)";
|
||||||
|
read -N 2 compressionRate;
|
||||||
|
|
||||||
|
#If not a number (e.g. empty), give default 31 value
|
||||||
|
if ! [[ $compressionRate =~ ^[0-5][0-9]$ ]]; then
|
||||||
|
compressionRate="31";
|
||||||
|
fi
|
||||||
|
|
||||||
|
for pickedFilepath in $fx; do
|
||||||
|
#could instead use ffprobe but would get more complicated as the filetype suffix becomes unknown
|
||||||
|
case $pickedFilepath in
|
||||||
|
*.mp4)
|
||||||
|
tempFilepath=$(echo "$pickedFilepath" | sed 's|.mp4|(CONVERTING).mp4|');
|
||||||
|
mv -f "$pickedFilepath" "$tempFilepath";
|
||||||
|
|
||||||
|
ffmpeg -i "$tempFilepath" -vcodec libx265 -crf "$compressionRate" "$pickedFilepath";
|
||||||
|
rm -f -- "$tempFilepath";
|
||||||
|
;;
|
||||||
|
*.webm | *.mkv)
|
||||||
|
newFilepath=$(echo "$pickedFilepath" | sed 's/\(.webm\|.mkv\)/.mp4/');
|
||||||
|
ffmpeg -i "$pickedFilepath" -vcodec libx265 -crf "$compressionRate" "$newFilepath";
|
||||||
|
rm -f -- "$pickedFilepath";
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
continue 1;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
((converted_files_count=converted_files_count+1));
|
||||||
|
converted_filenames="$converted_filenames"$'\n'"$pickedFilepath";
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
#Notify the user of the results
|
||||||
|
if [[ $converted_files_count -gt 0 ]]; then
|
||||||
|
converted_filenames=$(echo "$converted_filenames" | sed 's|.*\/||');
|
||||||
|
notify-send "Compressed Videos($converted_files_count):" "$converted_filenames";
|
||||||
|
fi;
|
||||||
|
}}
|
||||||
|
|
||||||
cmd moveto ${{
|
cmd moveto ${{
|
||||||
clear; tput cup $(($(tput lines)/3)); tput bold
|
clear; tput cup $(($(tput lines)/3)); tput bold
|
||||||
set -f
|
set -f
|
||||||
@ -164,5 +210,7 @@ map W $setsid -f $TERMINAL >/dev/null 2>&1
|
|||||||
|
|
||||||
map Y $printf "%s" "$fx" | xclip -selection clipboard
|
map Y $printf "%s" "$fx" | xclip -selection clipboard
|
||||||
|
|
||||||
|
map <a-x> compressvideo
|
||||||
|
|
||||||
# Source Bookmarks
|
# Source Bookmarks
|
||||||
source "~/.config/lf/shortcutrc"
|
source "~/.config/lf/shortcutrc"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user