diff --git a/generate_text.sh b/generate_text.sh index f02f564..e64d403 100755 --- a/generate_text.sh +++ b/generate_text.sh @@ -11,7 +11,7 @@ text_dir="/root/iobroker_scripts/general/.text" html_file="$text_dir/handout.html" -all=("date" "time") # Add more elements as needed +all=("date" "time" "weather") # Add more elements as needed # remove files in text_dir rm -f $text_dir/* @@ -51,44 +51,67 @@ generate_text() { echo "$date_de" > "$text_dir/date_de.txt" time_de=$(date '+Es ist %H:%M Uhr.') echo "$time_de" > "$text_dir/time_de.txt" + weather_de=$(trans -b :en :de "$(/root/iobroker_scripts/general/weather.sh)") + echo "$weather_de" > "$text_dir/weather_de.txt" # Spanish date_es=$(trans -b :de :es "$date_de") echo "$date_es" > "$text_dir/date_es.txt" time_es=$(trans -b :de :es "$time_de") echo "$time_es" > "$text_dir/time_es.txt" + weather_es=$(trans -b :en :es "$(/root/iobroker_scripts/general/weather.sh)") + echo "$weather_es" > "$text_dir/weather_es.txt" } # Call the generate_text function generate_text -# Create Markdown content -markdown_content="**Handout:** -\n -| Deutsch | Español | -| ------- | -------- |" +# Create HTML file +echo "" >> "$html_file" +echo "" >> "$html_file" +echo "" >> "$html_file" +echo "Handout" >> "$html_file" +echo "" >> "$html_file" +echo "" >> "$html_file" +echo "" >> "$html_file" +echo "" >> "$html_file" +echo "

Handout:

" >> "$html_file" +echo "" >> "$html_file" +echo "

" >> "$html_file" for component in "${all[@]}"; do + echo "processing: $component" german_output=$(cat "$text_dir/${component}_de.txt") spanish_output=$(cat "$text_dir/${component}_es.txt") - markdown_content+="\n| $german_output | $spanish_output |" + echo "" >> "$html_file" done -# Send Notification to A72 with Markdown content -curl_command="curl -u 'Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu' \ - -H 'Priority:High' \ - -d \"$markdown_content\" \ - -H 'Markdown: yes' \ - https://ntfy.michaelis.digital/ioBroker" +echo "
DeutschEspañol
$german_output$spanish_output
" >> "$html_file" +echo "" >> "$html_file" +echo "" >> "$html_file" -echo "curl_command: $curl_command" -eval "$curl_command" # Execute the constructed curl command +# Get ip of a72 +check_ip # Transfer files to A72 scp -r -i /root/.ssh/A72 "$text_dir" root@$A72_ip:/sdcard/ -# Display Markdown content -echo -e "$markdown_content" - # 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 &