nickjanssen / hlspeak

8 stars 1 forks source link

Love it #1

Open KenyOS opened 11 months ago

KenyOS commented 11 months ago

Remind me of my old days playing and customizing my own dedicated server for cs 1.6/condition.

in current state, it's possible to say date/time?

nickjanssen commented 10 months ago

@KenyOS thank you!! Yeah should be possible as it contains all necessary words like hours, minutes, seconds etc.

You should be able to say the time using something like this (untested)

hour=$(date +%H)  # Use %H for 24-hour format
minute=$(date +%M)

hour_words=( "zero" "one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twelve" "thirteen" "fourteen" "fifteen" "sixteen" "seventeen" "eighteen" "nineteen" "twenty" "twenty one" "twenty two" "twenty three" )
minute_words=( "" "one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twelve" "thirteen" "fourteen" "fifteen" "sixteen" "seventeen" "eighteen" "nineteen" "twenty" "twenty one" "twenty two" "twenty three" "twenty four" "twenty five" "twenty six" "twenty seven" "twenty eight" "twenty nine" "thirty" "thirty one" "thirty two" "thirty three" "thirty four" "thirty five" "thirty six" "thirty seven" "thirty eight" "thirty nine" "forty" "forty one" "forty two" "forty three" "forty four" "forty five" "forty six" "forty seven" "forty eight" "forty nine" "fifty" "fifty one" "fifty two" "fifty three" "fifty four" "fifty five" "fifty six" "fifty seven" "fifty eight" "fifty nine" )

time_string="the time is now ${hour_words[$hour]}"
if [ "$minute" -ne "00" ]; then
    time_string="$time_string ${minute_words[$minute]}"
fi
time_string="$time_string hours."

echo "$time_string" | xargs hlspeak