diff --git a/generate_text.sh b/generate_text.sh index 51586ba..3e95149 100755 --- a/generate_text.sh +++ b/generate_text.sh @@ -9,7 +9,7 @@ ####################################### text_dir="/root/iobroker_scripts/general/.text" -markdown_file="$text_dir/handout.md" +html_file="$text_dir/handout.html" all=("date" "time") # Add more elements as needed @@ -62,41 +62,46 @@ generate_text() { # Call the generate_text function generate_text -# Create Markdown file -echo "## Handout:" > $markdown_file -echo "| Deutsch | Español |" >> $markdown_file -echo "| ------- | ------- |" >> $markdown_file +# 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 "

Handout:

" >> "$html_file" +echo "" >> "$html_file" +echo "" >> "$html_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 + echo "processing: $component" + german_output=$(cat "$text_dir/${component}_de.txt") + spanish_output=$(cat "$text_dir/${component}_es.txt") + echo "" >> "$html_file" done +echo "
DeutschEspañol
$german_output$spanish_output
" >> "$html_file" +echo "" >> "$html_file" +echo "" >> "$html_file" + # 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