aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2021-05-30 15:41:05 -0300
committerSilvio Rhatto <rhatto@riseup.net>2021-05-30 15:41:05 -0300
commita0deea739032f5ba5980b45d2627cb12c2ac29a0 (patch)
treef764061f5b415ae1d59891dded4432ac2761bf35
parentc04d6ce0f809b800c278cb3e88669e06222ee5af (diff)
downloadplaylister-a0deea739032f5ba5980b45d2627cb12c2ac29a0.tar.gz
playlister-a0deea739032f5ba5980b45d2627cb12c2ac29a0.tar.bz2
Feat: playlist-check script
-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