Page MenuHomeDevCentral

D3484.id8980.diff
No OneTemporary

D3484.id8980.diff

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
--- /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/plain
Expires
Sat, Nov 23, 17:01 (18 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258486
Default Alt Text
D3484.id8980.diff (1 KB)

Event Timeline