summaryrefslogtreecommitdiffstats
path: root/kaudiocreator/upgrade-kaudiocreator-metadata.sh
blob: a288c411f6c4f7853c70836e2f5d3464ff9f2e26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#! /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
	encoderconfig/fileFormat)
      VALUE=`echo $VALUE | sed -e s/%album/%{albumtitle}/g`;
      VALUE=`echo $VALUE | sed -e s/%artist/%{albumartist}/g`;
      VALUE=`echo $VALUE | sed -e s/%song/%{title}/g`;
      VALUE=`echo $VALUE | sed -e s/%track/%{number}/g`;
      VALUE=`echo $VALUE | sed -e s/%genre/%{genre}/g`;
      VALUE=`echo $VALUE | sed -e s/%extension/%{extension}/g`;
      VALUE=`echo $VALUE | sed -e s/%year/%{year}/g`;
	    echo "[encoderconfig]";
	    echo "fileFormat=$VALUE"
	    echo "# DELETE [encoderconfig]fileFormat"
			;;

	Encoder_0/commandLine)
      VALUE=`echo $VALUE | sed -e s/%album/%{albumtitle}/g`;
      VALUE=`echo $VALUE | sed -e s/%artist/%{albumartist}/g`;
      VALUE=`echo $VALUE | sed -e s/%song/%{title}/g`;
      VALUE=`echo $VALUE | sed -e s/%track/%{number}/g`;
      VALUE=`echo $VALUE | sed -e s/%genre/%{genre}/g`;
      VALUE=`echo $VALUE | sed -e s/%extension/%{extension}/g`;
      VALUE=`echo $VALUE | sed -e s/%year/%{year}/g`;
	    echo "[Encoder_0]";
	    echo "commandLine=$VALUE"
	    echo "# DELETE [Encoder_0]commandLine"
			;;

	Encoder_1/commandLine)
      VALUE=`echo $VALUE | sed -e s/%album/%{albumtitle}/g`;
      VALUE=`echo $VALUE | sed -e s/%artist/%{albumartist}/g`;
      VALUE=`echo $VALUE | sed -e s/%song/%{title}/g`;
      VALUE=`echo $VALUE | sed -e s/%track/%{number}/g`;
      VALUE=`echo $VALUE | sed -e s/%genre/%{genre}/g`;
      VALUE=`echo $VALUE | sed -e s/%extension/%{extension}/g`;
      VALUE=`echo $VALUE | sed -e s/%year/%{year}/g`;
	    echo "[Encoder_1]";
	    echo "commandLine=$VALUE"
	    echo "# DELETE [Encoder_1]commandLine"
			;;

	Encoder_2/commandLine)
      VALUE=`echo $VALUE | sed -e s/%album/%{albumtitle}/g`;
      VALUE=`echo $VALUE | sed -e s/%artist/%{albumartist}/g`;
      VALUE=`echo $VALUE | sed -e s/%song/%{title}/g`;
      VALUE=`echo $VALUE | sed -e s/%track/%{number}/g`;
      VALUE=`echo $VALUE | sed -e s/%genre/%{genre}/g`;
      VALUE=`echo $VALUE | sed -e s/%extension/%{extension}/g`;
      VALUE=`echo $VALUE | sed -e s/%year/%{year}/g`;
	    echo "[Encoder_2]";
	    echo "commandLine=$VALUE"
	    echo "# DELETE [Encoder_2]commandLine"
			;;			
	Encoder_3/commandLine)
      VALUE=`echo $VALUE | sed -e s/%album/%{albumtitle}/g`;
      VALUE=`echo $VALUE | sed -e s/%artist/%{albumartist}/g`;
      VALUE=`echo $VALUE | sed -e s/%song/%{title}/g`;
      VALUE=`echo $VALUE | sed -e s/%track/%{number}/g`;
      VALUE=`echo $VALUE | sed -e s/%genre/%{genre}/g`;
      VALUE=`echo $VALUE | sed -e s/%extension/%{extension}/g`;
      VALUE=`echo $VALUE | sed -e s/%year/%{year}/g`;
	    echo "[Encoder_3]";
	    echo "commandLine=$VALUE"
	    echo "# DELETE [Encoder_3]commandLine"
			;;			
    esac
done