summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNineInchNade <nineinchnade@gmail.com>2015-11-10 15:08:30 +0100
committerNineInchNade <nineinchnade@gmail.com>2015-11-10 15:08:30 +0100
commit27a7004fb75d97c39be0faf66b6d514d6cc45775 (patch)
treeab6cb01ce30fb8ac32ac5ebef7e5bb8d4e3abada
parent094789f9250531087b630e92324d3b81b28a881d (diff)
add checkMissingLink
-rw-r--r--Makefile3
-rwxr-xr-xbin/checkMissingLink15
2 files changed, 18 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index ad04750..7edebe3 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,9 @@ check: ## check for missing songs
check: ## make download should be run first
cat links | musicDir=./music xargs -n1 bin/checkMissing
+reversecheck: ## check for orphan files in directory
+ ls music/* | xargs -n1 bin/checkMissingLink
+
checkmp3: ## check for missing songs
checkmp3: ## make download should be run first
cat links | musicDir=./mp3 xargs -n1 bin/checkMissingmp3
diff --git a/bin/checkMissingLink b/bin/checkMissingLink
new file mode 100755
index 0000000..f1ea0df
--- /dev/null
+++ b/bin/checkMissingLink
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+file=$1
+id=$(echo "$file" | sed 's/.*\(.\{11\}\)\.ogg/\1/')
+
+#Wattie_Green_-_Dark_eyes-gdlFy3dRVck.ogg
+
+if [ $id = '' ]; then
+ echo 'no id'
+ exit 23
+fi
+
+if ! grep -q -- "$id#" links; then
+ echo $file
+fi \ No newline at end of file