summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rwxr-xr-xbin/checkMissing9
2 files changed, 13 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index faeec9a..c665ee6 100644
--- a/Makefile
+++ b/Makefile
@@ -7,3 +7,7 @@ download: ## download all links to ./music
add: ##make add url="http://youtube..."
add: ##to add link to ./links
bin/youtplaylist ${url} >> links
+
+check: ## check for missing songs
+check: ## make download should be run first
+ cat links | musicDir=./music xargs -n1 bin/checkMissing
diff --git a/bin/checkMissing b/bin/checkMissing
new file mode 100755
index 0000000..16cb477
--- /dev/null
+++ b/bin/checkMissing
@@ -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\\.ogg\$"); then
+ echo $uri
+fi