From 0d05ef1e12314985988e567ac22a179d0f646899 Mon Sep 17 00:00:00 2001 From: msglm Date: Sat, 14 Jan 2023 10:33:04 -0600 Subject: Inital Commit --- .local/bin/sortunsorted | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 .local/bin/sortunsorted (limited to '.local/bin/sortunsorted') diff --git a/.local/bin/sortunsorted b/.local/bin/sortunsorted new file mode 100755 index 0000000..7691ca3 --- /dev/null +++ b/.local/bin/sortunsorted @@ -0,0 +1,78 @@ +#!/bin/bash + +#Description: This program takes a paramater for the amount of videos you would like to sort from your UNSORTEDIR. If you do not pass a paramater, it will assume that you only wish to sort one video. These videos are then moved to ~/Videos/ with a new name that you provide or deleted depending on your choice. + +#Axioms: UNSORTEDDIR + +#Dependencies: https://packages.debian.org/sid/mpv + +numofvids=1 +playablevideo="$(find ~/Videos/unsorted/ -maxdepth 1 -type f | shuf | head -1)" + +if [[ $# = 0 ]] +then + if [[ "${playablevideo##*.}" == "png" || "${playablevideo##*.}" == "jpg" || "${playablevideo##*.}" == "jpeg" || "${playablevideo##*.}" == "webp" ]] + then + feh "$playablevideo" + else + mpv --ontop --geometry=50%:50% --autofit=50%x50% "$playablevideo" + fi + echo "Video played was: $playablevideo" + read -r -p "Was This quality? (y/n): " Choice + if [ "$Choice" = 'y' ] + then + read -r -p "What would you like to name the video?: " Name + touch "$playablevideo" + if [[ "${playablevideo##*.}" == "gif" ]] + then + mv "$playablevideo" "/home/$USER/Pictures/gif/$Name.${playablevideo##*.}" + elif [[ "${playablevideo##*.}" == "png" || "${playablevideo##*.}" == "jpg" || "${playablevideo##*.}" == "jpeg" || "${playablevideo##*.}" == "webp" ]] + then + mv "$playablevideo" "/home/$USER/Pictures/$Name.${playablevideo##*.}" + else + mv "$playablevideo" "/home/$USER/Videos/$Name.${playablevideo##*.}" + fi + + exit + elif [ "$Choice" = 'n' ] + then + rm "$playablevideo" + else + echo "You did nothing..." + fi + exit + +fi + +while [[ "$numofvids" -le "$1" ]] +do + if [[ "${playablevideo##*.}" == "png" || "${playablevideo##*.}" == "jpg" || "${playablevideo##*.}" == "jpeg" || "${playablevideo##*.}" == "webp" ]] + then + feh "$playablevideo" + else + mpv --ontop --geometry=50%:50% --autofit=50%x50% "$playablevideo" + fi + echo "Video played was: $playablevideo" + read -r -p "Was This quality? (y/n): " Choice + if [ "$Choice" = 'y' ] + then + read -r -p "What would you like to name the video?: " Name + touch "$playablevideo" + if [[ "${playablevideo##*.}" == "gif" ]] + then + mv "$playablevideo" "/home/$USER/Pictures/gif/$Name.${playablevideo##*.}" + elif [[ "${playablevideo##*.}" == "png" || "${playablevideo##*.}" == "jpg" || "${playablevideo##*.}" == "jpeg" || "${playablevideo##*.}" == "webp" ]] + then + mv "$playablevideo" "/home/$USER/Pictures/$Name.${playablevideo##*.}" + else + mv "$playablevideo" "/home/$USER/Videos/$Name.${playablevideo##*.}" + fi + elif [ "$Choice" = 'n' ] + then + rm "$playablevideo" + else + echo "You did nothing..." + fi + playablevideo="$(find ~/Videos/unsorted/ -maxdepth 1 -type f | shuf | head -1)" + numofvids=$numofvids+1 +done -- cgit v1.2.3