From d340e8fc3531a1e53db308e66e0f145a7d95b0fc Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Fri, 11 Mar 2022 04:25:06 +0100 Subject: [PATCH] Add automatic INI generator --- utils/playlist2ini.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 utils/playlist2ini.sh diff --git a/utils/playlist2ini.sh b/utils/playlist2ini.sh new file mode 100644 index 0000000..a6d3e5a --- /dev/null +++ b/utils/playlist2ini.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euo pipefail + +# This script takes current playlist as `mpc` sees it and converts it into +# QuickPlay INI sections. +# Use at own risk :-) + + +mpc -f '[[%artist%] - %title%]#|%file%#|%time%' playlist | while IFS='|' read title file time; do + if test -n "$title"; then + title="$(basename "$title")" + fi + + echo -e "[$title]\npath = $file\ntime = $time\n" +done