File indexing completed on 2024-10-06 09:25:16

0001 #!/bin/bash
0002 #
0003 # Run this script on gcompris.net to update the rcc files
0004 # being served by it.
0005 #
0006 # cd /opt/gcompris
0007 # ./update_backgroundMusic.sh
0008 #
0009 
0010 function generateEncodedVoices {
0011     codec=$1
0012     echo "Create the $codec directory"
0013     rm -rf $codec
0014 
0015     rsync -a --exclude .git backgroundMusic *.sh $codec
0016     cd $codec
0017 
0018     if [[ $codec != ogg ]]; then
0019         echo "Encoding $codec files"
0020         ./encodeTo.sh $codec
0021     fi
0022     
0023     echo "Generate $codec rcc"
0024     ./generate_backgroundMusic_rcc.sh $codec
0025 
0026     if [[ $codec != ogg ]]; then
0027         echo "Consolidate the top level Content file"
0028         cat .rcc/Contents >> ../ogg/.rcc/Contents
0029         mv .rcc/backgroundMusic-$codec-${LAST_UPDATE_DATE}.rcc ../ogg/.rcc/
0030         rm -rf .rcc
0031     fi
0032 
0033     cd ..
0034 }
0035 
0036 export LAST_UPDATE_DATE=$(git log -n 1 --pretty=format:%cd --date=format:"%Y-%m-%d-%H-%M-%S" backgroundMusic/)
0037 
0038 generateEncodedVoices ogg
0039 generateEncodedVoices aac
0040 generateEncodedVoices mp3
0041 # Keep a trace of the uploaded Contents in case we need
0042 CURRENT_DATE=$(date "+%F-%H-%M-%S")
0043 cp ogg/.rcc/Contents ogg/.rcc/Contents-${CURRENT_DATE}
0044 
0045 mv ogg/.rcc .rcc
0046 
0047 #echo "Update ogg on gcompris.net"
0048 #rsync -avx .rcc/ /var/www/data3/backgroundMusic/