extractors/ext-mpg123
author Stiletto <blasux@blasux.ru>
Thu, 22 Sep 2011 13:27:23 +0400
changeset 9 ae87469781f2
parent 7 1928f1a1ee5b
permissions -rwxr-xr-x
CUE extractor
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
f0c87fb62b66 example updater, two metadata extractors
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     1
#!/bin/sh
f0c87fb62b66 example updater, two metadata extractors
Stiletto <blasux@blasux.ru>
parents:
diff changeset
     2
echo "$1"
7
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
     3
TFILE=$(mktemp)
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
     4
TFILE2=$(mktemp)
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
     5
mpg123 -vtn1 --long-tag "$1" 2>&1|awk '/^\t.*:/ {match($0,"\t(.*): +(.*)",a); print toupper(a[1])":"a[2]; }' > $TFILE
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
     6
if iconv -s -f utf-8 -t latin1 $TFILE > $TFILE2 && iconv -s -f utf-8 -t utf-8 $TFILE2 > /dev/null; then
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
     7
    echo "ENCODINGHACK:DOUBLE-UTF-8"
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
     8
    cat $TFILE2
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
     9
else
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
    10
    if iconv -s -f utf-8 -t latin1 $TFILE > $TFILE2 && iconv -s -f cp1251 -t utf-8 $TFILE2 > /dev/null; then
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
    11
        iconv -s -f cp1251 -t utf-8 $TFILE2
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
    12
        echo "ENCODINGHACK:CP1251"
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
    13
    else
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
    14
        echo "ENCODING:UTF-8"
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
    15
        cat "$TFILE"
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
    16
    fi
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
    17
fi
1928f1a1ee5b cos-list
Stiletto <blasux@blasux.ru>
parents: 6
diff changeset
    18
rm -f $TFILE $TFILE2
9
ae87469781f2 CUE extractor
Stiletto <blasux@blasux.ru>
parents: 7
diff changeset
    19
echo "EXTRACTOR:mpg123"
6
f0c87fb62b66 example updater, two metadata extractors
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    20
echo
f0c87fb62b66 example updater, two metadata extractors
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    21
f0c87fb62b66 example updater, two metadata extractors
Stiletto <blasux@blasux.ru>
parents:
diff changeset
    22