LINUX.ORG.RU

michwill@mev ~ $ cat bin/wma2flac
#!/bin/bash

echo "Total files: $(find -L -name *.[wW][mM][aA] | wc -l)"
find -L -name *.[wW][mM][aA] -exec wma2flac1 '{}' \;
michwill@mev ~ $ cat bin/wma2flac1
#!/bin/bash

is_wma()
{
file -b "$1" | grep 'Microsoft' || echo $1 | grep -i '\.wma$'
}
wma_decode ()
{
echo "$1"
mplayer -quiet -ao pcm:file="tmp.wav" "$1" > tmp.tmp
}
flac_encode()
{
b="$(echo $1 | sed 's/...$/flac/g')"
flac --delete-input-file --best -o "$b" tmp.wav
name="$(cat tmp.tmp | grep '\ name\:\ '| sed 's/\ name\:\ //g')"
author="$(cat tmp.tmp | grep '\ author\:\ '| sed 's/\ author\:\ //g')"
comments="$(cat tmp.tmp | grep '\ comments\:\ '| sed 's/\ comments\:\ //g')"
rm tmp.tmp
metaflac "$b" --set-tag=ARTIST="$author" --set-tag=TITLE="$name" --set-tag=COMMENT="$comments"
rm "$1"
}

if (is_wma "$1")
then
wma_decode "$1"
flac_encode "$1"
fi

michwill ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.