diff --git a/shell_scripts/pmwiki-to-ssml-default b/shell_scripts/pmwiki-to-ssml-default new file mode 100644 index 0000000..6750684 --- /dev/null +++ b/shell_scripts/pmwiki-to-ssml-default @@ -0,0 +1,18 @@ +# default translation file +# TODO +# make it truly default rather than dedicated to ReadingNotes +# if dedicate Group translation file exist use it else us this one +s/^text=// +s/%25/%/g +s/\[\[.*|// +s/\[\[#[a-zA-Z\+]\]\]// +s/\(:.*:\)// +s/^>>.*// +#s/Pre-reading model// +#s/^Draw a schema.*// +s/^!\(.*\)/\1<\/voice>/ +#s/- ISBN [a-zA-Z0-9]\+ // +s/$/./ +s/'''\(.*\)'''/\1<\/emphasis>/ +s/!\+// +s/^*\+// diff --git a/shell_scripts/pmwiki_generate_ssml_and_ogg b/shell_scripts/pmwiki_generate_ssml_and_ogg new file mode 100755 index 0000000..c8313e1 --- /dev/null +++ b/shell_scripts/pmwiki_generate_ssml_and_ogg @@ -0,0 +1,30 @@ +#! /usr/bin/env bash + +# usage: generate ogg audio files from PmWiki content +# see http://fabien.benetou.fr/MemoryRecalls/ImprovingPIM#AudioPIM for details including how to display the generated file + +# TODO +# check espeak and oggenc present in the path (else suggest installing them) +# propose to create the audio dir if not present +# XXX +# doing so for the *whole* wiki takes time and might not be that useful +# consider adding a filter to restrict only on a group e.g. ReadingNotes + + +WIKIPATH=. + +if [ $# -gt 0 ] +then + WIKIPATH=$1 +fi + +DEFAULT_TR=~/bin/pmwiki-to-ssml-default + +for P in `ls $WIKIPATH -IPmWiki.* -I*RecentChanges -Itotalcounter.stat -I*,del-*`; +do + GROUP=`echo $P | sed "s/.*\/\(.*\)\..*$/\1/"` + # test in ssml translation for this group exist else default + grep ^text= $WIKIPATH/$P | sed "s/%0a/\\n/g" | sed -f $DEFAULT_TR > $WIKIPATH/../pub/audio/$P.ssml + espeak -m -f $P.ssml -w $WIKIPATH/../pub/audio/$P.wav + oggenc $WIKIPATH/../pub/audio/$P.wav +done