2016. szeptember 25., vasárnap

xml to cue

echo "gathering timecodes..."
grep ChapterTimeStart flac.xml | sed 's/<[/a-zA-Z]*>//g' | sed 's/ //g' | awk 'BEGIN{FS=":"; OFS="";}{printf("%.2d:%.2d:%.2d\n", $1*60+$2,int($3),int($3 %1 * 100));}' > times.txt

echo "gathering track titles..."
grep ChapterString flac.xml | sed 's/<[/a-zA-Z]*>//g' | sed 's/ //g' | sed 's/[0-9]*\. //g' | sed 's/[0-9]\:[0-9]*$//g' > titles.txt
tracks=$(cat titles.txt | wc -l)

echo "creating cue sheet..."
echo "REM COMMENT \"mkatoflac\"" > flac.cue

artist=$(metaflac --show-tag=artist flac.flac | sed 's/^[a-z]*=//g')
if [ -z "$artist" ]
then
artist="Unknown"
fi
echo "PERFORMER \"$artist\"" >> flac.cue

title=$(metaflac --show-tag=title flac.flac | sed 's/^[a-z]*=//g')
if [ -z "$title" ]
then
title="Unknown"
fi

echo "TITLE \"$title\"" >> flac.cue
echo "FILE \"flac.flac\" WAVE" >> flac.cue

for (( c=1; c<=$tracks; c++ )) do
temp=$c

if [ $temp -lt 10 ]
then
temp=$(echo 0$temp)
fi

echo "TRACK $temp AUDIO" >> flac.cue
echo -n "TITLE \"" >> flac.cue
echo "$(head -n$c titles.txt | tail -n1)\"" >> flac.cue
echo -n "INDEX 01 " >> flac.cue
echo "$(head -n$c times.txt | tail -n1)" >> flac.cue

done


Forrás: http://blog.astech.hu/2012/12/matroska-audio-flac/

Nincsenek megjegyzések:

Megjegyzés küldése