Page MenuHomeDevCentral

No OneTemporary

diff --git a/roles/devserver/userland-home/files/dereckson/bin/build-playlist b/roles/devserver/userland-home/files/dereckson/bin/build-playlist
new file mode 100755
index 0000000..faae873
--- /dev/null
+++ b/roles/devserver/userland-home/files/dereckson/bin/build-playlist
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Build a m3u playlist
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# License: BSD-2-Clause
+# Dependencies: `url` to resolve a path into an URL
+# Source file: roles/devserver/userland-home/files/dereckson/bin/build-playlist
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+set -e
+
+# -------------------------------------------------------------
+# Detect media files
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+is_media_file() {
+ case "$1" in
+ *.mp3|*.mp4|*.wav|*.m4a|*.flac|*.aac|*.mkv|*.avi|*.mov) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+# -------------------------------------------------------------
+# Build playlist
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+echo "#EXTM3U"
+echo ""
+
+for file in *; do
+ if [ -f "$file" ] && is_media_file "$file"; then
+ url "$file"
+ fi
+done

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 07:31 (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258438
Default Alt Text
(1 KB)

Event Timeline