You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
misc/shell_scripts/pmwiki_generate_ssml_and_ogg

31 lines
1.1 KiB

#! /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
GROUP_FILTER=ReadingNotes.
DEFAULT_TR=~/bin/pmwiki-to-ssml-default
for P in `ls $WIKIPATH -IPmWiki.* -I*RecentChanges -Itotalcounter.stat -I*,del-* | grep $GROUP_FILTER`;
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 $WIKIPATH/../pub/audio/$P.ssml -w $WIKIPATH/../pub/audio/$P.wav
oggenc $WIKIPATH/../pub/audio/$P.wav && rm $WIKIPATH/../pub/audio/$P.wav
done