[gcompris/voices] new version with fixed qrc prefix and now in data2
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris/voices] new version with fixed qrc prefix and now in data2
- Date: Sun, 5 Apr 2015 14:52:28 +0000 (UTC)
commit 88bee28cd801e0d0cf5c2a2d60a8be9005e67f92
Author: Bruno Coudoin <bruno coudoin gcompris net>
Date: Sun Apr 5 16:49:20 2015 +0200
new version with fixed qrc prefix and now in data2
This version also support creating the words.rcc (dir must be passed as param).
Now the .rcc dir is created with the correct directory structure ready to be
pushed.
generate_voices_rcc.sh | 106 ++++++++++++++++++++++++++++++++----------------
1 files changed, 71 insertions(+), 35 deletions(-)
---
diff --git a/generate_voices_rcc.sh b/generate_voices_rcc.sh
index a7ec5fb..c77921f 100755
--- a/generate_voices_rcc.sh
+++ b/generate_voices_rcc.sh
@@ -29,35 +29,68 @@ MD5SUM=/usr/bin/md5sum
exit 1
}
+[ $# -ne 1 ] && {
+ echo "Usage: generate_voices_rcc.sh <path to gtk lang words dir>"
+ exit 1
+}
+WORDS_DIR=$1
+[ ! -d "${WORDS_DIR}" ] && {
+ echo "Words dir ${WORDS_DIR} not found"
+ exit 1
+}
+[ -d words ] && rm -rf words
+ln -s ${WORDS_DIR} words
+
function generate_rcc {
# Generate RCC
- echo -n "$1 ... "
+ echo -n "$2 ... "
+ mkdir -p ${2%/*}
${RCC} -binary $1 -o $2
echo "md5sum ... "
- cd ${RCC_DIR}
- ${MD5SUM} `basename $2` >>${CONTENTS_FILE}
+ cd ${2%/*}
+ ${MD5SUM} ${2##*/}>> ${CONTENTS_FILE}
cd - &>/dev/null
}
+function header_rcc {
+(cat <<EOHEADER
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/gcompris/data">
+EOHEADER
+) > $1
+}
+
+function footer_rcc {
+(cat <<EOFOOTER
+</qresource>
+</RCC>
+EOFOOTER
+) >> $1
+}
+
echo "Generating binary resource files in ${RCC_DIR}/ folder:"
[ -d ${RCC_DIR} ] && rm -rf ${RCC_DIR}
mkdir ${RCC_DIR}
#header of the global qrc (all the langs)
-QRC_ALL_FILE="${QRC_DIR}/voices.qrc"
-RCC_ALL_FILE="${RCC_DIR}/voices.rcc"
-(cat <<EOHEADER
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
-EOHEADER
-) > $QRC_ALL_FILE
+QRC_FULL_FILE="${QRC_DIR}/full.qrc"
+RCC_FULL_FILE="${RCC_DIR}/full.rcc"
+header_rcc $QRC_FULL_FILE
+# Create the voices directory that will contains links to locales dir
+VOICE_DIR='voices-ogg'
+[ -d ${RCC_DIR} ] && rm -rf ${RCC_DIR}
+rm -rf ${VOICE_DIR}
+mkdir -p ${VOICE_DIR}
for LANG in `find . -maxdepth 1 -regextype posix-egrep -type d -regex "\./[a-z]{2,3}(_[A-Z]{2,3})?"`; do
QRC_FILE="${QRC_DIR}/voices-${LANG#./}.qrc"
- RCC_FILE="${RCC_DIR}/voices-${LANG#./}.rcc"
+ RCC_FILE="${RCC_DIR}/${VOICE_DIR}/voices-${LANG#./}.rcc"
+
+ # Populate the voices backlinks
+ ln -s -t ${VOICE_DIR} ../$LANG
# Generate QRC:
echo -n " ${LANG#./}: ${QRC_FILE} ... "
@@ -68,41 +101,44 @@ for LANG in `find . -maxdepth 1 -regextype posix-egrep -type d -regex "\./[a-z]{
fi
[ -e ${QRC_FILE} ] && rm ${QRC_FILE}
- #header:
- (cat <<EOHEADER
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
-EOHEADER
-) >> $QRC_FILE
+ header_rcc $QRC_FILE
for i in `find ${LANG} -not -type d`; do
# For the lang file
- echo " <file>${i#./}</file>" >> $QRC_FILE
+ echo " <file>${VOICE_DIR}/${i#./}</file>" >> $QRC_FILE
# For the all lang file
- echo " <file>${i#./}</file>" >> $QRC_ALL_FILE
+ echo " <file>${VOICE_DIR}/${i#./}</file>" >> $QRC_FULL_FILE
done
- #footer:
- (cat <<EOFOOTER
-</qresource>
-</RCC>
-EOFOOTER
-) >> $QRC_FILE
+ footer_rcc $QRC_FILE
+ generate_rcc ${QRC_FILE} ${RCC_FILE}
- generate_rcc ${QRC_FILE} ${RCC_FILE}
+done
+# Word images for the full qrc
+for i in `find words/ -not -type d`; do
+ echo " <file>${i#${WORDS_DIR}}</file>" >> $QRC_FULL_FILE
done
#footer of the global qrc (all the langs)
-(cat <<EOFOOTER
-</qresource>
-</RCC>
-EOFOOTER
-) >> $QRC_ALL_FILE
+footer_rcc $QRC_FULL_FILE
+
+echo -n " full: ${QRC_FULL_FILE} ... "
+generate_rcc ${QRC_FULL_FILE} ${RCC_FULL_FILE}
+
+# Word images standalone rcc
+header_rcc "${QRC_DIR}/words.qrc"
+for i in `find words/ -not -type d`; do
+ echo " <file>${i#${WORDS_DIR}}</file>" >> "${QRC_DIR}/words.qrc"
+done
+footer_rcc "${QRC_DIR}/words.qrc"
+echo -n " words: "${QRC_DIR}/words.qrc" ... "
+generate_rcc "${QRC_DIR}/words.qrc" "${RCC_DIR}/words/words.rcc"
-generate_rcc ${QRC_ALL_FILE} ${RCC_ALL_FILE}
-cleanup:
-rm -f *.qrc
+#cleanup:
+#rm -f *.qrc
+#rm words
+#rm -rf ${VOICE_DIR}
echo "Finished! Now do something like:"
-echo "rsync -avx ${RCC_DIR}/ www.gcompris.net:/path/to/www/gcompris/data/voices/"
+echo "rsync -avx ${RCC_DIR}/ gcompris.net:/var/www/data2/"
#EOF
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]