,speech_en.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. # Coding: utf-8
  3. # Editor: www.geany.org
  4. # Created 2017-05-30
  5. #_sudo_apt_install_
  6. #_sudo_dpkg_i_ scons
  7. export XDG_RUNTIME_DIR=/run/user/$(id -u)
  8. source $HOME/.SCR/lib.sh
  9. fun_log_dir_create $0 7 1
  10. fun_speech_time () # напечатать время с разделением на часы, минуты
  11. {
  12. if [ $# == "1" ] # если агрумент один
  13. then
  14. f_hour=$(($1 / 60)) # полных часов
  15. f_min=$(($1 % 60)) # остаток минут
  16. else
  17. f_hour=$1
  18. f_min=$2
  19. fi
  20. case "$f_min" in
  21. "0" ) f_min="exactly" ;;
  22. "1" ) f_min="$f_min minute" ;;
  23. * ) f_min="$f_min minutes" ;;
  24. esac
  25. case "$f_hour" in
  26. "0" ) f_hour="" ;;
  27. "1" ) f_hour="$f_hour hour" ;;
  28. * ) f_hour="$f_hour hours" ;;
  29. esac
  30. echo "$f_hour" "$f_min"
  31. }
  32. fun_voice ()
  33. {
  34. fun_echo_stadia 11 0 ",speech_en.sh $@"
  35. echo "$(date +%y-%m-%d_%H-%M-%S_%6N) start $@" >> "${tmp1}/${date}"
  36. play ~/.RES/sounds/Sound_20761.ogg # sound after speech
  37. echo "$@" | RHVoice-test -v 300 -r 85 -p slt
  38. # see more profiles ls /usr/local/share/RHVoice/voices/
  39. echo "$(date +%y-%m-%d_%H-%M-%S_%6N) finish $@" >> "${tmp1}/${date}"
  40. notify-send -t 10000 -i ~/.RES/icons/vcs-normal.svg "Today $(cat ~/LOG/uptime_counter.sh/time_for_conky)" "$@"
  41. }
  42. if [ -n "$1" ]; # lenth of string not null
  43. then
  44. case "$1" in
  45. "ok" ) fun_voice "Operation complited" ;;
  46. "msg001" ) fun_voice "The time is now $(fun_speech_time $hour_I $mins)" ;; # 12-11h
  47. "msg002" ) fun_voice "Today uptime is $(fun_speech_time $uptime_in_day)" ;;
  48. "msg003" ) fun_voice "Сurrent session uptime is $(fun_speech_time $uptime)" ;;
  49. "msg004" ) fun_voice "The time is now $(fun_speech_time $hour $mins)" ;; # 0-23h
  50. * ) fun_voice "$@" ;; # default speech
  51. esac
  52. fi