Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import time
- from gtts import gTTS
- ####################################
- def set_month():
- str = time.strftime("%m")
- if str == "01":
- return "Januar"
- if str == "02":
- return "Februar"
- if str == "03":
- return "März"
- if str == "04":
- return "April"
- if str == "05":
- return "Mai"
- if str == "06":
- return "Juni"
- if str == "07":
- return "Juli"
- if str == "08":
- return "August"
- if str == "09":
- return "September"
- if str == "10":
- return "Oktober"
- if str == "11":
- return "November"
- if str == "12":
- return "Dezember"
- day = time.strftime("%d")
- month = set_month()
- year = time.strftime("%Y")
- str1 = "Heute ist der %sthe %s %s." % (day, month, year)
- ####################################
- clock = time.strftime("%H:%M:%S")
- hour = time.strftime("%H")
- minute = time.strftime("%M")
- str2 = "Wir haben %s Uhr %s." % (hour, minute)
- tts = gTTS(text = str2, lang = 'de', slow = False)
- tts.save("output.mp3")
- ####################################
- def play(datei):
- subprocess.call(['start', datei])
- play("output.mp3")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement