+#!/bin/bash
+
read_flac_to_mp3_tags()
{
local inputfile="$1"
local outputfile="$2"
local inputfiledir=${inputfile%/*}
+ local ARTIST=
+ local TITLE=
+ local GENRE=
+ local TRACKNUMBER=
+ local DATE=
+ local RRL=
+ local RTG=
+ local RTP=
+ local RAG=
+ local RAP=
# get the tags from flac file
- local readonly ARTIST=$(metaflac "$inputfile" \
+ ARTIST=$(metaflac "$inputfile" \
--show-tag=ARTIST | sed s/.*=//g)
- local readonly TITLE=$(metaflac "$inputfile" \
+ TITLE=$(metaflac "$inputfile" \
--show-tag=TITLE | sed s/.*=//g)
- local readonly ALBUM=$(metaflac "$inputfile" \
+ ALBUM=$(metaflac "$inputfile" \
--show-tag=ALBUM | sed s/.*=//g)
- local readonly GENRE=$(metaflac "$inputfile" \
+ GENRE=$(metaflac "$inputfile" \
--show-tag=GENRE | sed s/.*=//g)
- local readonly TRACKNUMBER=$(metaflac "$inputfile" \
+ TRACKNUMBER=$(metaflac "$inputfile" \
--show-tag=TRACKNUMBER | sed s/.*=//g)
- local readonly DATE=$(metaflac "$inputfile" \
+ DATE=$(metaflac "$inputfile" \
--show-tag=DATE | sed s/.*=//g)
- local readonly RRL=$(metaflac "$inputfile" \
+ RRL=$(metaflac "$inputfile" \
--show-tag=REPLAYGAIN_REFERENCE_LOUDNESS | tr '=' ':')
- local readonly RTG=$(metaflac "$inputfile" \
+ RTG=$(metaflac "$inputfile" \
--show-tag=REPLAYGAIN_TRACK_GAIN | tr '=' ':')
- local readonly RTP=$(metaflac "$inputfile" \
+ RTP=$(metaflac "$inputfile" \
--show-tag=REPLAYGAIN_TRACK_PEAK | tr '=' ':')
- local readonly RAG=$(metaflac "$inputfile" \
+ RAG=$(metaflac "$inputfile" \
--show-tag=REPLAYGAIN_ALBUM_GAIN | tr '=' ':')
- local readonly RAP=$(metaflac "$inputfile" \
+ RAP=$(metaflac "$inputfile" \
--show-tag=REPLAYGAIN_ALBUM_PEAK | tr '=' ':')
# --------------------------------------------------
encoding_flac_to_mp3()
{
- local readonly inputfile="$1"
- local readonly outputfile="$2"
+ local inputfile="$1"
+ local outputfile="$2"
nice --adjustment=10 flac --totally-silent --stdout --decode \
"$inputfile" \
export -f flac_to_mp3
export -f encoding_flac_to_mp3
export -f read_flac_to_mp3_tags
- find $workdir -name '*.flac' \
+ find "$workdir" -name '*.flac' \
| sort \
| parallel --will-cite \
--ungroup \