diff --git a/generate_mp3.sh b/generate_mp3.sh index 927d351..461959f 100644 --- a/generate_mp3.sh +++ b/generate_mp3.sh @@ -20,9 +20,11 @@ category_order=("date" "time") txt_dir="/data/scripts/.text" mp3_dir="/data/scripts/.mp3" +# remove old files +rm -f "$txt_dir"/*complete.txt + # Function to create MP3 files create_mp3_files() { - rm -f "$txt_dir"/*complete.txt for file in "$txt_dir"/*.txt; do text=$(cat "$file") # Read the content of the file @@ -31,12 +33,12 @@ create_mp3_files() { if [[ $file == *de.txt ]]; then # If it's a German file, create a German MP3 /data/data/com.termux/files/usr/bin/gtts-cli -l de "$text" --output "$mp3_dir/$base_filename.mp3" - echo "$text" > "$txt_dir/de_complete.txt" + echo "$text" >> "$txt_dir/de_complete.txt" echo "German MP3 file created: $base_filename.mp3" elif [[ $file != *de.txt ]]; then # If it's a Spanish file, create a Spanish MP3 in slow mode /data/data/com.termux/files/usr/bin/gtts-cli -l es -s "$text" --output "$mp3_dir/$base_filename.mp3" - echo "$text" > "$txt_dir/es_complete.txt" + echo "$text" >> "$txt_dir/es_complete.txt" echo "Spanish MP3 file created: $base_filename.mp3" else echo "File $file was not processed"