summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinfloop43
-rwxr-xr-xsonggrab2
2 files changed, 44 insertions, 1 deletions
diff --git a/infloop b/infloop
new file mode 100755
index 0000000..dde7c86
--- /dev/null
+++ b/infloop
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+
+MUSTBETRUE=y
+unset MUSTBEFALSE
+count=1
+for i in $@; do
+ count=$(printf "%s + 1\n" "$count" | bc)
+ [ -n "$BUFFERREAD" ] && BUFFERTIME="$i" && unset BUFFERREAD && continue
+ case "$i" in
+ "-t")
+ MUSTBETRUE=y
+ unset MUSTBEFALSE
+ ;;
+ "-f")
+ MUSTBEFALSE=y
+ unset MUSTBETRUE
+ ;;
+ "-c")
+ break 2
+ ;;
+ "-b")
+ BUFFERREAD="y"
+ ;;
+ "-*")
+ printf "Unsupported argument. Please use -t if exit on true, and -f if exit on false.\n"
+ exit 1
+ esac
+done
+
+if [ $# -ge $count ]; then
+ COMMAND="${@:$count}"
+else
+ printf "No command given!\n" && exit 1
+fi
+
+while true; do
+ if [ "$MUSTBEFALSE" ]; then
+ $COMMAND || exit 0
+ else
+ $COMMAND && exit 0
+ fi
+ sleep "${BUFFERTIME:-1}"
+done
diff --git a/songgrab b/songgrab
index e96861c..808ecb4 100755
--- a/songgrab
+++ b/songgrab
@@ -81,7 +81,7 @@ fi
# download the video(s)
notify-send "songgrab" "Starting download..."
printf "Starting download..."
-ls | grep -q "$(echo $URL | cut -d'=' -f2 | cut -d'&' -f1)" && echo "Already downloaded" || youtube-dl $SPLITTER_FLAGS --format bestaudio --restrict-filenames "$URL"
+ls | grep -q "$(echo $URL | cut -d'=' -f2 | cut -d'&' -f1)" && echo "Already downloaded" || yt-dlp $SPLITTER_FLAGS --format bestaudio --restrict-filenames "$URL"
notify-send "songgrab" "Download stopped."
printf "Download stopped."