summarylogtreecommitdiffstats
path: root/04-oggcomments-overwrite-policy.patch
blob: 416071328e5986e95541bb3eb49bfbe17999a433 (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
(c) 3ED <krzysztof1987@gmail.com>
Description: Don't append but replace mixramp tags...

--- mixramp-tag.orig	2014-02-25 09:14:24.000000000 +0000
+++ mixramp-tag	2014-02-25 09:18:04.000000000 +0000
@@ -129,12 +129,26 @@
           "$FILE" > /dev/null || exit 14 
           ;;
       (ogg)
-       "$TAGGER" \
-          --tag "MIXRAMP_START=$MIXRAMP_START" \
-          --tag "MIXRAMP_END=$MIXRAMP_END" \
-          --tag "MIXRAMP_REF=$MIXRAMP_REF" \
-          -a "$FILE" || exit 14
-          ;;
+        OGGTAGS=$(mktemp) || exit 14
+
+        #dump tags to file
+        "$TAGGER" -c "$OGGTAGS" "$FILE" || exit 14
+
+        #remove old mixramp tags
+        sed '/^MIXRAMP_\(START\|END\|REF\)=.*$/d' -i "$OGGTAGS"
+
+        #add new mixramp tags
+        cat >> "$OGGTAGS" <<EOF
+MIXRAMP_START=$MIXRAMP_START
+MIXRAMP_END=$MIXRAMP_END
+MIXRAMP_REF=$MIXRAMP_REF
+EOF
+
+        #overwrite ogg tags
+        "$TAGGER" -c "$OGGTAGS" -w "$FILE" || exit 14
+
+        rm -f "$OGGTAGS"
+        ;;
   esac
   
 done