Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3768514
D3484.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3484.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 08:27 (12 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258486
Default Alt Text
D3484.diff (1 KB)
Attached To
Mode
D3484: Build a playlist from current directory media files
Attached
Detach File
Event Timeline
Log In to Comment