summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rwxr-xr-xbin/checkMissingmp39
2 files changed, 10 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 5fe87ec..ebecb7a 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ check: ## make download should be run first
checkmp3: ## check for missing songs
checkmp3: ## make download should be run first
- cat links | musicDir=./mp3 xargs -n1 bin/checkMissing
+ cat links | musicDir=./mp3 xargs -n1 bin/checkMissingmp3
play: ## play the playlist without downloading
mpv --loop=inf --shuffle --playlist links
diff --git a/bin/checkMissingmp3 b/bin/checkMissingmp3
new file mode 100755
index 0000000..d7722d2
--- /dev/null
+++ b/bin/checkMissingmp3
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+uri=$1
+musicDir=${musicDir-./}
+id=$(echo "$uri" | sed -n 's@^https\?://www\.youtube\.com/watch?v=@@p' | sed 's/#.*$//')
+
+if ! file=$(find $musicDir | grep -q "[-]$id\\.mp3\$"); then
+ echo $uri
+fi