Script updates
This commit is contained in:
2
scripts/shell/backup-stuff.sh
Normal file
2
scripts/shell/backup-stuff.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
# vencord stuff
|
||||
cp '/mnt/c/Users/cloud/AppData/Roaming/Vencord/settings/settings.json' '/mnt/e/home/clouds/google-drive/backup'
|
||||
3
scripts/shell/ffmpeg-get-video-fps.sh
Executable file
3
scripts/shell/ffmpeg-get-video-fps.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
ffmpeg -i $1 2>&1 | sed -n "s/.*, \(.*\) fp.*/\1/p"
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
show_help() {
|
||||
echo "Usage: `basename $0` [--input|-i input_file] [--crop|-c width:height] [--trim-start start] [--trim-end end] [--crf crf_value] [--fps new_fps] [--scale640] [--merge-audio] [--remove-audio] --output|-o output_file"
|
||||
echo "Usage: $(basename $0) [--input|-i input_file] [--crop|-c width:height] [--trim-start start] [--trim-end end] [--crf crf_value] [--fps new_fps] [--scale new_video_resolution] [--merge-audio] [--remove-audio] --output|-o output_file"
|
||||
echo "Options:"
|
||||
echo " --input|-i Specify the input video file (required)."
|
||||
echo " --crop|-c Specify the width:height for video cropping."
|
||||
@@ -9,7 +9,7 @@ show_help() {
|
||||
echo " --trim-end Specify the end timestamp for video trimming."
|
||||
echo " --crf Specify the CRF value for video compressing."
|
||||
echo " --fps Specify the new frames per second for the video."
|
||||
echo " --scale640 Scale the video to 640x320."
|
||||
echo " --scale Scale the video to a new resolution."
|
||||
echo " --merge-audio Merge all audio tracks into the main track."
|
||||
echo " --remove-audio Suppress all audio and remove audio tracks."
|
||||
echo " --audio-track-no Selects a specific audio track for the output"
|
||||
@@ -34,7 +34,7 @@ trim_start=""
|
||||
trim_end=""
|
||||
crf=""
|
||||
new_fps=""
|
||||
scale640=false
|
||||
scale=""
|
||||
merge_audio=false
|
||||
remove_audio=false
|
||||
audio_track_no=1
|
||||
@@ -42,18 +42,54 @@ output_file=""
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--help|-h) show_help; exit ;;
|
||||
--input|-i) input_file="$2"; shift 2 ;;
|
||||
--crop|-c) crop="$2"; shift 2 ;;
|
||||
--trim-start) trim_start="$2"; shift 2 ;;
|
||||
--trim-end) trim_end="$2"; shift 2 ;;
|
||||
--crf) crf="$2"; shift 2 ;;
|
||||
--fps) new_fps="$2"; shift 2 ;;
|
||||
--scale640) scale640=true; shift ;;
|
||||
--merge-audio) merge_audio=true; shift ;;
|
||||
--remove-audio) remove_audio=true; shift;;
|
||||
--audio-track-no) audio_track_no="$2"; shift;;
|
||||
--output|-o) output_file="$2"; shift 2 ;;
|
||||
--help | -h)
|
||||
show_help
|
||||
exit
|
||||
;;
|
||||
--input | -i)
|
||||
input_file="$2"
|
||||
shift 2
|
||||
;;
|
||||
--crop | -c)
|
||||
crop="$2"
|
||||
shift 2
|
||||
;;
|
||||
--trim-start)
|
||||
trim_start="$2"
|
||||
shift 2
|
||||
;;
|
||||
--trim-end)
|
||||
trim_end="$2"
|
||||
shift 2
|
||||
;;
|
||||
--crf)
|
||||
crf="$2"
|
||||
shift 2
|
||||
;;
|
||||
--fps)
|
||||
new_fps="$2"
|
||||
shift 2
|
||||
;;
|
||||
--scale)
|
||||
scale="$2"
|
||||
shift 2
|
||||
;;
|
||||
--merge-audio)
|
||||
merge_audio=true
|
||||
shift
|
||||
;;
|
||||
--remove-audio)
|
||||
remove_audio=true
|
||||
shift
|
||||
;;
|
||||
--audio-track-no)
|
||||
audio_track_no="$2"
|
||||
shift
|
||||
;;
|
||||
--output | -o)
|
||||
output_file="$2"
|
||||
shift 2
|
||||
;;
|
||||
*) shift ;;
|
||||
esac
|
||||
done
|
||||
@@ -68,7 +104,7 @@ if [ -z "$output_file" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$crop" ] && [ -z "$trim_start" ] && [ -z "$trim_end" ] && [ -z "$crf" ] && [ -z "$new_fps" ] && [ "$merge_audio" = false ] && [ "$scale640" = false ] && [ "$remove_audio" = false ]; then
|
||||
if [ -z "$crop" ] && [ -z "$trim_start" ] && [ -z "$trim_end" ] && [ -z "$crf" ] && [ -z "$new_fps" ] && [ "$merge_audio" = false ] && [ -z "$scale" ] && [ "$remove_audio" = false ]; then
|
||||
echo "Error: At least one optional parameter is required."
|
||||
exit 1
|
||||
fi
|
||||
@@ -83,8 +119,8 @@ if [ -n "$trim_end" ] && [ -z "$trim_start" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$crop" ] && [ "$scale640" = true ]; then
|
||||
echo "Error: Cannot use both --crop and --scale640 together."
|
||||
if [ -n "$crop" ] && [ "$scale" = true ]; then
|
||||
echo "Error: Cannot use both --crop and --scale together."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -122,15 +158,15 @@ if [ -n "$trim_start" ] && [ -n "$trim_end" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$crf" ]; then
|
||||
ffmpeg_command+=" -c:v libx264 -crf $crf"
|
||||
ffmpeg_command+=" -c:v libx265 -crf $crf"
|
||||
fi
|
||||
|
||||
if [ -n "$new_fps" ]; then
|
||||
ffmpeg_command+=" -r $new_fps"
|
||||
fi
|
||||
|
||||
if [ "$scale640" = true ]; then
|
||||
ffmpeg_command+=" -vf scale=640:320"
|
||||
if [ -n "$scale" ]; then
|
||||
ffmpeg_command+=" -s $scale"
|
||||
fi
|
||||
|
||||
if [ "$merge_audio" = true ]; then
|
||||
|
||||
@@ -8,4 +8,4 @@ video_res=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,heig
|
||||
video_framerate=$(ffmpeg -i $file_to_convert 2>&1 | sed -n "s/.*, \(.*\) fp.*/\1/p")
|
||||
|
||||
ffmpeg -y -i $file_to_convert -vf palettegen $pallete_file
|
||||
ffmpeg -y -i $file_to_convert -i $pallete_file -filter_complex paletteuse "${file_to_convert%"$file_to_convert_extension"}.gif"
|
||||
ffmpeg -y -i $file_to_convert -i $pallete_file -filter_complex fps=20,paletteuse "${file_to_convert%".$file_to_convert_extension"}.gif"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
show_help() {
|
||||
# echo "Usage: `basename $0` [--no-abort-on-found] [--parallel] [--custom-grep-search|-c <string>]"
|
||||
echo "Usage: `basename $0` [--help|-h] [--filter-mode|-f]"
|
||||
echo "Usage: $(basename $0) [--help|-h] [--filter-mode|-f]"
|
||||
echo "Options:"
|
||||
echo " --help | -h (optional) Display script's help text"
|
||||
echo " --filter-mode | -f (optional) The script iterate over the files of a selected folder and store the ones that should be deleted"
|
||||
@@ -11,8 +11,14 @@ show_help() {
|
||||
filter_mode=false
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--help|-h) show_help; exit ;;
|
||||
--filter-mode|-f) filter_mode=true; shift;;
|
||||
--help | -h)
|
||||
show_help
|
||||
exit
|
||||
;;
|
||||
--filter-mode | -f)
|
||||
filter_mode=true
|
||||
shift
|
||||
;;
|
||||
*) shift ;;
|
||||
esac
|
||||
done
|
||||
@@ -36,8 +42,8 @@ if [ ${#commands_not_found[@]} -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cur_dir=`pwd`
|
||||
furry_commission_ideas_path=/mnt/e/home/documents/data-hoarding/furry-commission-ideas
|
||||
cur_dir=$(pwd)
|
||||
furry_commission_ideas_path=/mnt/e/home/documents/downloads-furry
|
||||
furry_commission_ideas_urls_filename="urls.txt"
|
||||
scripts_path=/home/cloud/repos/personal-devboot/scripts/shell
|
||||
|
||||
@@ -59,13 +65,13 @@ input_media_url() {
|
||||
media_url=''
|
||||
|
||||
if ! $filter_mode; then
|
||||
media_url=`input_media_url`
|
||||
media_url=$(input_media_url)
|
||||
while [ -z "$media_url" ]; do
|
||||
media_url=`input_media_url`
|
||||
media_url=$(input_media_url)
|
||||
done
|
||||
|
||||
# remove trailing slashes
|
||||
media_url=`sed 's:/*$::' <<< "$media_url"`
|
||||
media_url=$(sed 's:/*$::' <<<"$media_url")
|
||||
|
||||
url_regex='(https?)://[-[:alnum:]\+&@#/%?=~_|!:,.;]*[-[:alnum:]\+&@#/%=~_|]'
|
||||
if [[ ! $media_url =~ $url_regex ]]; then
|
||||
@@ -84,7 +90,7 @@ filtered_existing_folders=()
|
||||
for folder in "${existing_folders[@]}"; do
|
||||
if [[ ! $folder =~ ^artists/[^/]+$ ]]; then
|
||||
filtered_existing_folders+=("$folder")
|
||||
fi;
|
||||
fi
|
||||
done
|
||||
|
||||
existing_folders=("${filtered_existing_folders[@]}")
|
||||
@@ -117,9 +123,9 @@ input_select_folder() {
|
||||
read -p "[INFO] Please inform the desired option: " selected_option
|
||||
|
||||
if [ "$selected_option" == 'n' ]; then
|
||||
selected_folder=`input_create_folder`
|
||||
selected_folder=$(input_create_folder)
|
||||
while [ -z "$selected_folder" ]; do
|
||||
selected_folder=`input_create_folder`
|
||||
selected_folder=$(input_create_folder)
|
||||
done
|
||||
|
||||
mkdir --parents "$selected_folder"
|
||||
@@ -142,9 +148,9 @@ if [ -z "$selected_folder" ]; then
|
||||
|
||||
printf "\n"
|
||||
|
||||
selected_folder=`input_select_folder`
|
||||
selected_folder=$(input_select_folder)
|
||||
while [ -z "$selected_folder" ]; do
|
||||
selected_folder=`input_select_folder`
|
||||
selected_folder=$(input_select_folder)
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -218,8 +224,7 @@ if $filter_mode; then
|
||||
files_to_delete+=("$file")
|
||||
fi
|
||||
;;
|
||||
1)
|
||||
;;
|
||||
1) ;;
|
||||
2)
|
||||
if ((i - 1 < 0)); then
|
||||
echo ""
|
||||
@@ -229,7 +234,7 @@ if $filter_mode; then
|
||||
else
|
||||
((i--))
|
||||
xdotool search --name feh key p
|
||||
files_to_delete=("${files_to_delete[@]/$file}")
|
||||
files_to_delete=("${files_to_delete[@]/$file/}")
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
@@ -282,7 +287,6 @@ else
|
||||
media_filenames+=$(basename "$filename")
|
||||
done
|
||||
|
||||
|
||||
for ((i = 0; i < ${#media_filenames[@]}; i++)); do
|
||||
media_filename=${media_filenames[$i]}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user