Compare commits
No commits in common. "89fd2f2f8c0c860f92f70668bf9773c5b6726d02" and "2badabb616c7df2535961c3ed2f622e240936799" have entirely different histories.
89fd2f2f8c
...
2badabb616
@ -9,12 +9,6 @@
|
||||
#######################################
|
||||
|
||||
text_dir="/root/iobroker_scripts/general/.text"
|
||||
markdown_file="$text_dir/handout.md"
|
||||
|
||||
all=("date" "time") # Add more elements as needed
|
||||
|
||||
# remove files in text_dir
|
||||
rm -f $text_dir/*
|
||||
|
||||
# Function to get the IP address of Lisa's iPhone
|
||||
check_ip() {
|
||||
@ -48,58 +42,29 @@ check_ip
|
||||
generate_text() {
|
||||
# German
|
||||
date_de=$(date '+Heute ist %A, der %d. %B %Y.')
|
||||
echo "$date_de" > "$text_dir/date_de.txt"
|
||||
echo $date_de > $text_dir/date_de.txt
|
||||
time_de=$(date '+Es ist %H:%M Uhr.')
|
||||
echo "$time_de" > "$text_dir/time_de.txt"
|
||||
echo $time_de > $text_dir/time_de.txt
|
||||
|
||||
# Spanish
|
||||
date_es=$(trans -b :de :es "$date_de")
|
||||
echo "$date_es" > "$text_dir/date_es.txt"
|
||||
echo $date_es > $text_dir/date_es.txt
|
||||
time_es=$(trans -b :de :es "$time_de")
|
||||
echo "$time_es" > "$text_dir/time_es.txt"
|
||||
echo $time_es > $text_dir/time_es.txt
|
||||
}
|
||||
|
||||
# Call the generate_text function
|
||||
generate_text
|
||||
|
||||
# Create Markdown file
|
||||
echo "## Handout:" > $markdown_file
|
||||
echo "| Deutsch | Español |" >> $markdown_file
|
||||
echo "| ------- | ------- |" >> $markdown_file
|
||||
|
||||
for component in "${all[@]}"; do
|
||||
german_output=$(cat $text_dir/${component}_de.txt)
|
||||
spanish_output=$(cat $text_dir/${component}_es.txt)
|
||||
echo "| $german_output | $spanish_output |" >> $markdown_file
|
||||
done
|
||||
|
||||
# Transfer files to A72
|
||||
scp -r -i /root/.ssh/A72 "$text_dir" root@$A72_ip:/data/scripts/
|
||||
|
||||
# Send Notification to A72 with handout.md file
|
||||
curl_command="curl -u 'Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu' \
|
||||
-H 'Priority:High' \
|
||||
-T $markdown_file \
|
||||
-H 'Filename: handout.md' \
|
||||
-d $'notification_date: Heute ist Dienstag, der 30. Januar 2024.\n"
|
||||
|
||||
for component in "${all[@]}"; do
|
||||
curl_command+="${component}:\n"
|
||||
curl_command+="$(cat $text_dir/${component}_de.txt)\n"
|
||||
curl_command+="$(cat $text_dir/${component}_es.txt)\n"
|
||||
done
|
||||
|
||||
curl_command="${curl_command%\\n}" # Remove the trailing newline
|
||||
curl_command+="\n'"
|
||||
|
||||
curl_command+=" https://ntfy.michaelis.digital/ioBroker"
|
||||
|
||||
echo "curl_command: $curl_command"
|
||||
eval "$curl_command" # Execute the constructed curl command
|
||||
|
||||
# Display Markdown file content
|
||||
cat $markdown_file
|
||||
scp -r -i /root/.ssh/A72 $text_dir root@$A72_ip:/data/scripts/
|
||||
|
||||
# Start generate_mp3.sh on A72
|
||||
nohup ssh -i /root/.ssh/A72 -f root@$A72_ip '/data/scripts/generate_mp3.sh' > /root/generate_mp3.log &
|
||||
ssh -i /root/.ssh/A72 -f root@$A72_ip '/data/scripts/generate_mp3.sh' > /root/generate_mp3.log &
|
||||
|
||||
# Output the generated texts
|
||||
echo "German Output:"
|
||||
echo "$date_de $time_de"
|
||||
|
||||
echo "Spanish Output:"
|
||||
echo "$date_es $time_es"
|
||||
|
||||
@ -41,10 +41,8 @@ check_notification() {
|
||||
# Turn off Bluetooth
|
||||
turn_off_bluetooth
|
||||
|
||||
## Play alarm sound
|
||||
for ((volume = 10; volume <= 100; volume += 10)); do
|
||||
/data/data/com.termux/files/usr/bin/mpv --replaygain=track --volume="$volume" /data/scripts/your-new-morning-alarm.ogg &
|
||||
done
|
||||
# Play alarm sound
|
||||
/data/data/com.termux/files/usr/bin/mpv --replaygain=track --loop=inf /data/scripts/your-new-morning-alarm.ogg &
|
||||
|
||||
# Increase volume and check notification
|
||||
while true; do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user