... Experiment .. I edited the script to reproduce the clock, instead of the time, the
various animal sounds downloaded from the internet ... if you want to try the effect of the rabbit doing cluck ...
https://hubic.com/home/pub/?ruid=aHR0cHM6Ly9sYjEwNDAuaHViaWMub3ZoLm5ldC92MS9BVVRIXzQzM2QyNDgwNTIzN2JkZjZmYmEzYWYzZjUwYmIyMGUyL2RlZmF1bHQvLm92aFB1Yi8xNDI2NzE1OTI5XzE0MjkzMDc5Mjk/dGVtcF91cmxfc2lnPTBkMDZhM2I5NmUxM2RhNzA3MGQ4NDg4ZmFjMDFjODNiNzFlNGFjYWUmdGVtcF91cmxfZXhwaXJlcz0xNDI5MzA3OTI5#
these are the ways that I have found
and I put them here
/usr/openkarotz/Extra/Animals
the script in the same folder clock
/usr/www/cgi-bin/apps
clockAnimals
- Code:
-
#!/bin/bash
source /www/cgi-bin/setup.inc
source /www/cgi-bin/url.inc
source /www/cgi-bin/utils.inc
source /www/cgi-bin/leds.inc
source /www/cgi-bin/ears.inc
ReadUrlParam
# ----- dir to animals mp3
GRUNT=Extra/Animals
# --- array animals
v[0]='anatra-domestica.mp3'
v[1]='asino.mp3'
v[2]='canarino.mp3'
v[3]='cavallo.mp3'
v[4]='coyote.mp3'
v[5]='elefante.mp3'
v[6]='fringuello.mp3'
v[7]='gallina.mp3'
v[8]='gallo.mp3'
v[9]='gheppio.mp3'
v[10]='gufo-reale.mp3'
v[11]='inseparabili.mp3'
v[12]='lupo.mp3'
v[13]='maiale.mp3'
v[14]='megattera.mp3'
v[15]='merlo.mp3'
v[16]='mp.mp3'
v[17]='pecore.mp3'
v[18]='pettirosso.mp3'
v[19]='megattera.mp3'
v[20]='merlo.mp3'
v[21]='mp.mp3'
v[22]='pecore.mp3'
v[23]='pettirosso.mp3'
H=${URLParam[hour]}
CheckMandatoryDirectory "$CNF_DATADIR/Apps"
CheckMandatoryDirectory "$CNF_DATADIR/Apps/Clock"
CheckMandatoryDirectory "$CNF_DATADIR/Apps/Clock/Data"
if [ -e "$CNF_DATADIR/Run/karotz.sleep" ]; then
DATA='{"return":"1","msg":"Unable to perform action, rabbit is sleeping."}'
SendResponse "$DATA"
exit 0
fi
Log "[APPS][CLOCK]" "Clock Animals Called"
D=$(date +%H)
HOUR=$(( 10#$D ))
if [ -f "$CNF_DATADIR/$GRUNT/${v[$HOUR]}" ]; then
Log "[APPS][CLOCK]" "Playing sound : "$CNF_DATADIR/$GRUNT/${v[$HOUR]}
PlaySound $CNF_DATADIR/$GRUNT/${v[$HOUR]} 1
EarsReset
DATA='{"return":"0","hour":"'$HOUR'"}'
else
DATA='{"return":"1","msg":"No sound for this time.'$CNF_DATADIR/$GRUNT/${v[$HOUR]}'"}'
fi
SendResponse "$DATA"
the index of the table is the time
Carlo
would be nice to do it for nabaztag v2 ...
![nabzlol](/users/1714/33/94/82/smiles/416568.gif)