From 92b37b773043d8b1c75ce844c2e3a6cd688232e6 Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 7 Mar 2023 10:47:07 -0500 Subject: [PATCH] bash scripts i use these days --- bash/dl.sh | 26 ++++++++++++++++++++++++++ bash/fix_screenshot_names.sh | 21 +++++++++++++++++++++ bash/trashpurge.sh | 10 ++++++++++ 3 files changed, 57 insertions(+) create mode 100755 bash/dl.sh create mode 100755 bash/fix_screenshot_names.sh create mode 100755 bash/trashpurge.sh diff --git a/bash/dl.sh b/bash/dl.sh new file mode 100755 index 0000000..f127621 --- /dev/null +++ b/bash/dl.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +starttime=$(date) +yt-dlp --output "%(upload_date)s - %(title)s - [%(id)s].%(ext)s" \ + --format "bv*[ext=mp4]+ba/best" \ + --sponsorblock-remove all \ + -a "$@" \ + --download-archive "done.txt" + +for file in *.webm +do + #surely there's a smarter way to just download mp4? or just prefer not webm? + ffmpeg -i "$file" "$file.mp4" + #rm "$file" +done + +if [ $(wc -l < "$@") -eq $(wc -l < done.txt) ] +then + echo "looks like all downloads worked. :)" + rm "$@" + rm done.txt +fi + +echo "started $starttime" +echo "completed $(date)" +echo "(idk how to datemath)" \ No newline at end of file diff --git a/bash/fix_screenshot_names.sh b/bash/fix_screenshot_names.sh new file mode 100755 index 0000000..1665150 --- /dev/null +++ b/bash/fix_screenshot_names.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# vlc MUST have a screenshot prefix. -_- + +cd ~/Pictures/0/screenshots +while : +do + sleep 600 + for i in ./* + do + if [[ "$i" == ./Screenshot_* ]] + then + mv "$i" "$(echo $i | sed 's/Screenshot_//')" + fi + + if [[ "$i" == ./vlcsnap-* ]] + then + mv "$i" "$(echo $i | sed 's/vlcsnap-//')" + fi + done +done diff --git a/bash/trashpurge.sh b/bash/trashpurge.sh new file mode 100755 index 0000000..7153f49 --- /dev/null +++ b/bash/trashpurge.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# you'll need trash-cli +while : +do + sleep 60 + trash-empty +done + +# for fuck's sake just stop with the goddamn trash