summaryrefslogtreecommitdiffstats
path: root/tdeioslave/audiocd/upgrade-metadata.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tdeioslave/audiocd/upgrade-metadata.sh')
-rwxr-xr-xtdeioslave/audiocd/upgrade-metadata.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tdeioslave/audiocd/upgrade-metadata.sh b/tdeioslave/audiocd/upgrade-metadata.sh
new file mode 100755
index 00000000..000323b1
--- /dev/null
+++ b/tdeioslave/audiocd/upgrade-metadata.sh
@@ -0,0 +1,28 @@
+#! /usr/bin/env bash
+
+while read; do
+ if [ "${REPLY#\[}" != "$REPLY" ] ; then # group name
+ GROUP="${REPLY:1:${#REPLY}-2}"
+ continue;
+ fi
+ # normal key=value pair:
+ KEY="${REPLY%%=*}"
+ VALUE="${REPLY#*=}"
+
+ case "$GROUP/$KEY" in
+ FileName/file_name_template)
+ #
+ # Swap
+ #
+ VALUE=`echo $VALUE | sed -e s/%a/%{albumtitle}/g`;
+ VALUE=`echo $VALUE | sed -e s/%t/%{title}/g`;
+ VALUE=`echo $VALUE | sed -e s/%n/%{number}/g`;
+ VALUE=`echo $VALUE | sed -e s/%g/%{genre}/g`;
+ VALUE=`echo $VALUE | sed -e s/%y/%{year}/g`;
+ VALUE=`echo $VALUE | sed -e s/%A/%{albumartist}/g`;
+ echo "[FileName]";
+ echo "file_name_template=$VALUE"
+ echo "# DELETE [FileName]file_name_template"
+ ;;
+ esac
+done