aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xplaylist-check36
1 files changed, 36 insertions, 0 deletions
diff --git a/playlist-check b/playlist-check
new file mode 100755
index 0000000..854ca5d
--- /dev/null
+++ b/playlist-check
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# Check for playlist files.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+PLAYLIST="$1"
+MEDIA="/var/cache/media/noise"
+PLAYLISTS="$MEDIA/playlists"
+
+# Basic syntax
+if [ -z "$PLAYLIST" ]; then
+ echo "Usage: $BASENAME <playlist>"
+
+ if [ -d "$PLAYLISTS" ]; then
+ echo ""
+ echo "Available playlists: "
+ ls $PLAYLISTS
+ fi
+
+ exit 1
+elif [ ! -f "$PLAYLISTS/$PLAYLIST.m3u" ]; then
+ echo "No such playlist $PLAYLISTS/$PLAYLIST.m3u"
+ exit 1
+fi
+
+# Prepare
+cd $MEDIA
+
+# Process
+cat $PLAYLISTS/$PLAYLIST.m3u | while read file; do
+ if [ ! -e "$file" ]; then
+ echo "missing file: $file"
+ fi
+done