Ajout utilitaires HV pour conversion FLAC à OGG et MP3
authorgobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Mon, 17 Oct 2011 03:48:37 +0000 (03:48 +0000)
committergobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Mon, 17 Oct 2011 03:48:37 +0000 (03:48 +0000)
stage2/hv-utilities/flac2mp3 [new file with mode: 0755]
stage2/hv-utilities/flac2ogg [new file with mode: 0755]
stage2/install-hv-utilities

diff --git a/stage2/hv-utilities/flac2mp3 b/stage2/hv-utilities/flac2mp3
new file mode 100755 (executable)
index 0000000..1dcf400
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# default = 4. 0 = highest quality.
+VBR_QUALITY="-V4"
+LAME_OPTS="--noreplaygain ${VBR_QUALITY} --add-id3v2 --pad-id3v2 \
+  --ignore-tag-errors"
+
+print_usage()
+{
+    echo "$(basename $0) -- Translates FLAC file to MP3."
+    echo "Usage: $(basename $0) flac-file"
+}
+
+if [ $# = 0 ]; then
+    print_usage
+    exit 1
+fi
+
+a=${1}
+
+# Checking if input file exist.
+if [ ! -f $1 ]; then
+    echo "$0: File $a not found."
+    print_usage
+    exit 1
+fi
+
+OUTF=`echo "$a" | sed s/\.flac$/.mp3/g`
+
+ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`
+TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`
+ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`
+GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`
+TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`
+DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`
+
+flac -c -d "$a" | lame ${LAME_OPTS} \
+    --tt "$TITLE" --tn "${TRACKNUMBER:-0}" --ta "$ARTIST" \
+    --tl "$ALBUM" --ty "$DATE" --tg "${GENRE:-12}" \
+    - "$OUTF"
diff --git a/stage2/hv-utilities/flac2ogg b/stage2/hv-utilities/flac2ogg
new file mode 100755 (executable)
index 0000000..528ebb4
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# default = 3.
+OGG_QUALITY="4"
+OGGENC_OPTS="-q ${OGG_QUALITY}"
+
+print_usage()
+{
+    echo "$(basename $0) -- Translates FLAC file to OGG."
+    echo "Usage: $(basename $0) flac-file"
+}
+
+if [ $# = 0 ]; then
+    print_usage
+    exit 1
+fi
+
+a=${1}
+
+# Checking if input file exist.
+if [ ! -f $1 ]; then
+    echo "$0: File $a not found."
+    print_usage
+    exit 1
+fi
+
+OUTF=`echo "$a" | sed s/\.flac$/.ogg/g`
+
+ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`
+TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`
+ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`
+GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`
+TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`
+DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`
+
+flac -c -d "$a" | oggenc ${OGGENC_OPTS} \
+    -t "$TITLE" -N "${TRACKNUMBER:-0}" -a "$ARTIST" \
+    -l "$ALBUM" -d "$DATE" -G "${GENRE:-12}" \
+    -o "$OUTF" -
index 7aefa4f..55180b6 100755 (executable)
@@ -11,7 +11,7 @@ BIN_UTILITIES="camera-download cd-erase cd-copy cgrep pstopdf distro-backup \
                dos2unix dvd-ram-format fix-avi gztobz2 hv-backup hv-video-dvd \
                mail-files mail-if-fail mail-statistics media-write pstopdf \
                replace.pl rotatelogs setdate strip-debug-symbols tarbz2 \
-               tildes-clean vd vs"
+               tildes-clean vd vs flac2ogg flac2mp3"
 
 for program in ${BIN_UTILITIES}; do
     install -v ${SRCDIR}/${program} ${BINDIR}