Compare commits

..

No commits in common. "main" and "039a5653c53669c4a67833e178deb71fc5d1c561" have entirely different histories.

View file

@ -32,13 +32,13 @@ function clean {
if [ -f "$1" ] if [ -f "$1" ]
then then
echo "Cleaning existing file, $1." echo "Cleaning existing file, $1."
rm "$1" rm $1
fi fi
} }
if [ -z "$1" ] if [ -z "$1" ]
then then
echo "Provide a cast config!" echo "Provide a cast type!"
echo "$0 <cast config> <slug> [date]" echo "$0 <cast config> <slug> [date]"
exit 1 exit 1
fi fi
@ -49,22 +49,22 @@ then
echo "$0 <cast config> <slug> [date]" echo "$0 <cast config> <slug> [date]"
exit 2 exit 2
fi fi
slug="$2" slug=$2
if [ -z "$3" ] if [ -z "$3" ]
then then
date=$(date +%Y-%m-%d) date=$(date +%Y-%m-%d)
year=$(date +%Y) year=$(date +%Y)
post_date=$(date +%Y/%m/%d) post_date=$(date +%Y/%m/%d)
else else
date=$(date +%Y-%m-%d -d "$3") date=$(date +%Y-%m-%d -d $3)
year=$(date +%Y -d "$3") year=$(date +%Y -d $3)
post_date=$(date +%Y/%m/%d -d "$3") post_date=$(date +%Y/%m/%d -d $3)
fi fi
# load info from cast specific config file # load info from cast specific config file
. "$config" . $config
if [ -z "$file_prefix" ] if [ -z "${file_prefix}" ]
then then
echo "${config} must set file_prefix." echo "${config} must set file_prefix."
exit 1 exit 1
@ -88,7 +88,7 @@ clean "${base_file}.mp3"
echo "" echo ""
# encode lossy, MP3, adding ID3v2 tags for everything # encode lossy, MP3, adding ID3v2 tags for everything
# *except* cover art # *except* cover art
lame -b "${mp3_bitrate}" \ lame -b ${mp3_bitrate} \
--cbr \ --cbr \
--tt "${title}" \ --tt "${title}" \
--ta "${artist}" \ --ta "${artist}" \
@ -98,28 +98,91 @@ lame -b "${mp3_bitrate}" \
--tg "${genre}" \ --tg "${genre}" \
--id3v2-only \ --id3v2-only \
--noreplaygain \ --noreplaygain \
"${base_file}".flac \ ${base_file}.wav \
"${base_file}".mp3 ${base_file}.mp3
# lame package from Lucid lacks the --ti switch for image # lame package from Lucid lacks the --ti switch for image
# found eyed3 via a web search # found eyed3 via a web search
eyeD3 --add-image "${cover}":FRONT_COVER \ eyeD3 --add-image ${cover}:FRONT_COVER \
--url-frame="WCOP:${copyright}" \ --url-frame="WCOP:${copyright}" \
"${base_file}".mp3 ${base_file}.mp3
echo "" echo ""
echo "Tagging ${base_file}.flac." echo "Encoding ${base_file}.flac."
clean "${base_file}.flac"
echo "" echo ""
# lossless encoding # lossless encoding
metaflac \ flac \
--import-picture-from="|image/png|||${cover}" \ --picture="|image/jpeg|||${cover}" \
--set-tag=title="${title}" \ --tag=title="${title}" \
--set-tag=artist="${artist}" \ --tag=artist="${artist}" \
--set-tag=album="${album}" \ --tag=album="${album}" \
--set-tag=year="${year}" \ --tag=year="${year}" \
--set-tag=genre="${genre}" \ --tag=genre="${genre}" \
--set-tag=composer="${artist}" \ --tag=composer="${artist}" \
--set-tag=comment="${comment}" \ --tag=comment="${comment}" \
--set-tag=url="${url}" \ --tag=url="${url}" \
--set-tag=copyright="${copyright}" \ --tag=copyright="${copyright}" \
"${base_file}".flac ${base_file}.wav
echo ""
echo "Encoding ${base_file}.m4a at ${aac_quality}."
clean "${base_file}.m4a"
echo ""
# AAC encoding, lossy
# docs recommend against setting bandwidth and bitrate setting
# doesn't seem to result in the desired quality as tweaking
# the quality setting (max 500)--200 was arrived at by iteratively
# encoding the same raw audio and subjective listening to the results
ffmpeg -i ${base_file}.wav \
-b:a ${aac_quality}k \
-metadata title="${title}" \
-metadata artist="${artist}" \
-metadata album="${album}" \
-metadata year="${year}" \
-metadata genre="${genre}" \
-metadata writer="${artist}" \
-metadata comment="${comment}" \
-strict experimental \
${base_file}.m4a
#-metadata cover-art="${cover}" \
#-acodec fdk_aac \
#faac -q ${aac_quality} \
#-o ${base_file}.m4a \
#--title "${title}" \
#--artist "${artist}" \
#--album "${album}" \
#--year "${year}" \
#--genre "${genre}" \
#--writer "${artist}" \
#--comment "${comment}" \
#--cover-art "${cover}" \
#${base_file}.wav
if [ -f "${aac_notes_path}/${date}.notes" ]
then
# put together the just-so input file for mp4chaps
echo "00:00:00.000 Start" > \
${base_file}.chapters.txt
grep "{{offset|" ${aac_notes_path}/${date}.notes | \
sed -e "s/.*offset|\(.*\)}}.*|\(.*\)}}.*/\1 \2/" >> \
${base_file}.chapters.txt
# write the chapter marks to the AAC/MP4 file
mp4chaps -o -z -i ${base_file}.m4a
fi
echo ""
echo "Encoding ${base_file}.ogg at quality ${ogg_quality}."
clean "${base_file}.ogg"
echo ""
# encode the Ogg Vorbis from the flac copies the tags/comments
# already set into the flac file except the cover art;
# using metaflac, can encode the binary block in flac
# per the latest recommendations from Xiph for cover art
oggenc \
-q ${ogg_quality} \
--comment=METADATA_BLOCK_PICTURE="$(metaflac --export-picture-to=- ${base_file}.flac| base64 -w 0)" \
${base_file}.flac