diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2007-07-30 19:29:58 +0000 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2007-07-30 19:29:58 +0000 |
commit | ea41f5b9998b3311202c52b7ce44f72cc538cbc1 (patch) | |
tree | 1f7c7075765461769051177e0c3d83ed82588c31 /examples | |
parent | 0424450735ba3c00395876c28a7b58781d5c9b4a (diff) | |
download | librcc-ea41f5b9998b3311202c52b7ce44f72cc538cbc1.tar.gz librcc-ea41f5b9998b3311202c52b7ce44f72cc538cbc1.tar.bz2 librcc-ea41f5b9998b3311202c52b7ce44f72cc538cbc1.tar.xz librcc-ea41f5b9998b3311202c52b7ce44f72cc538cbc1.zip |
Small example is added
- Cache generator for multi-language tests
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/rusxmms_cache.pl | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/examples/rusxmms_cache.pl b/examples/rusxmms_cache.pl new file mode 100755 index 0000000..ea251fd --- /dev/null +++ b/examples/rusxmms_cache.pl @@ -0,0 +1,54 @@ +#! /bin/bash + +if [ -z "$1" ]; then + echo "Please, specify directory with mp3 files (the list.txt should contain language information)" + echo + exit +fi + +list=$1/list.txt +if [ ! -f $list ]; then + echo "The list.txt with language information is missing in specified directory" + echo + exit +fi + +rccconf=~/.rcc/xmms.xml +if [ ! -f $rccconf ]; then + tagreader + if [ ! -f $rccconf ]; then + echo "Can't locate RCC configuration" + echo + exit + fi +fi + + +echo "Setting timeout to 5s" +perl -pi -e 's|<Option name="TIMEOUT">.*</Option>|<Option name="TIMEOUT">5000000</Option>|' $rccconf + +echo "Setting leraning mode to LELEARN" +perl -pi -e 's|<Option name="LEARNING_MODE">.*</Option>|<Option name="LEARNING_MODE">RELEARN</Option>|' $rccconf + +for filename in $1/*.mp3; do + name=`basename "$filename"` + lang=`grep "$name" $list | cut -d ' ' -f 1` + + echo "MP3: $name, Language: $lang" + perl -pi -e "s|<Language>.*</Language>|<Language>$lang</Language>|" $rccconf + + echo " Recoding..." + perl -pi -e 's|<Option name="TRANSLATE">.*</Option>|<Option name="TRANSLATE">OFF</Option>|' $rccconf + tagreader $filename &> /dev/null + + echo " Translating to English..." + perl -pi -e 's|<Option name="TRANSLATE">.*</Option>|<Option name="TRANSLATE">TO_ENGLISH</Option>|' $rccconf + tagreader filename &> /dev/null + + echo " Translating..." + perl -pi -e 's|<Option name="TRANSLATE">.*</Option>|<Option name="TRANSLATE">FULL</Option>|' $rccconf + tagreader filename &> /dev/null +done + +echo "Setting leraning mode to ON" +perl -pi -e 's|<Option name="LEARNING_MODE">.*</Option>|<Option name="LEARNING_MODE">ON</Option>|' $rccconf |