From 50a309ae0132a3703299e5d42a5b4b594d648554 Mon Sep 17 00:00:00 2001 From: msglm Date: Fri, 6 Oct 2023 02:11:13 -0500 Subject: properly implement ipfs support --- sortunsorted | 42 ++++++++++-------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/sortunsorted b/sortunsorted index 2fd72b2..fe7eb6c 100755 --- a/sortunsorted +++ b/sortunsorted @@ -9,8 +9,7 @@ numofvids=1 playablevideo="$(find ~/Videos/unsorted/ -maxdepth 1 -type f | shuf | head -1)" -if [[ $# = 0 ]] -then +playvid() { if [[ "${playablevideo##*.}" == "png" || "${playablevideo##*.}" == "jpg" || "${playablevideo##*.}" == "jpeg" || "${playablevideo##*.}" == "webp" ]] then feh "$playablevideo" @@ -25,54 +24,33 @@ then touch "$playablevideo" if [[ "${playablevideo##*.}" == "gif" ]] then + ipfs-archive-manager shitpost-gifs "./$Name.${playablevideo##*.}" "$playablevideo" mv "$playablevideo" "/home/$USER/Pictures/gif/$Name.${playablevideo##*.}" elif [[ "${playablevideo##*.}" == "png" || "${playablevideo##*.}" == "jpg" || "${playablevideo##*.}" == "jpeg" || "${playablevideo##*.}" == "webp" ]] then + ipfs-archive-manager shitpost-pictures "./$Name.${playablevideo##*.}" "$playablevideo" mv "$playablevideo" "/home/$USER/Pictures/$Name.${playablevideo##*.}" else + ipfs-archive-manager shitpost-videos "./$Name.${playablevideo##*.}" "$playablevideo" mv "$playablevideo" "/home/$USER/Videos/$Name.${playablevideo##*.}" fi - - exit elif [ "$Choice" = 'n' ] then trash "$playablevideo" else echo "You did nothing..." fi - exit +} +if [[ $# = 0 ]] +then + playvid + 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 - trash "$playablevideo" - else - echo "You did nothing..." - fi + playvid playablevideo="$(find ~/Videos/unsorted/ -maxdepth 1 -type f | shuf | head -1)" numofvids=$numofvids+1 done -- cgit v1.2.3