From 6815a260ef87c376463154ea869c41845b036393 Mon Sep 17 00:00:00 2001 From: gobo72 Date: Mon, 17 Oct 2011 03:48:37 +0000 Subject: [PATCH] =?utf8?q?Ajout=20utilitaires=20HV=20pour=20conversion=20F?= =?utf8?q?LAC=20=C3=A0=20OGG=20et=20MP3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- stage2/hv-utilities/flac2mp3 | 40 ++++++++++++++++++++++++++++++++++++ stage2/hv-utilities/flac2ogg | 39 +++++++++++++++++++++++++++++++++++ stage2/install-hv-utilities | 2 +- 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100755 stage2/hv-utilities/flac2mp3 create mode 100755 stage2/hv-utilities/flac2ogg diff --git a/stage2/hv-utilities/flac2mp3 b/stage2/hv-utilities/flac2mp3 new file mode 100755 index 0000000..1dcf400 --- /dev/null +++ b/stage2/hv-utilities/flac2mp3 @@ -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 index 0000000..528ebb4 --- /dev/null +++ b/stage2/hv-utilities/flac2ogg @@ -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" - diff --git a/stage2/install-hv-utilities b/stage2/install-hv-utilities index 7aefa4f..55180b6 100755 --- a/stage2/install-hv-utilities +++ b/stage2/install-hv-utilities @@ -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} -- 2.20.1