Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. import subprocess
  2. import time
  3. from gtts import gTTS
  4.  
  5. ####################################
  6.  
  7. def set_month():
  8.  
  9.     str = time.strftime("%m")
  10.  
  11.     if str == "01":
  12.         return "Januar"
  13.     if str == "02":
  14.         return "Februar"
  15.     if str == "03":
  16.         return "März"
  17.     if str == "04":
  18.         return "April"
  19.     if str == "05":
  20.         return "Mai"
  21.     if str == "06":
  22.         return "Juni"
  23.     if str == "07":
  24.         return "Juli"
  25.     if str == "08":
  26.         return "August"
  27.     if str == "09":
  28.         return "September"
  29.     if str == "10":
  30.         return "Oktober"
  31.     if str == "11":
  32.         return "November"
  33.     if str == "12":
  34.         return "Dezember"
  35.  
  36. day = time.strftime("%d")
  37. month = set_month()
  38. year = time.strftime("%Y")
  39.  
  40. str1 = "Heute ist der %sthe %s %s." % (day, month, year)
  41.  
  42. ####################################
  43.  
  44. clock = time.strftime("%H:%M:%S")
  45.  
  46. hour = time.strftime("%H")
  47. minute = time.strftime("%M")
  48.  
  49. str2 = "Wir haben %s Uhr %s." % (hour, minute)
  50. tts = gTTS(text = str2, lang = 'de', slow = False)
  51. tts.save("output.mp3")
  52.  
  53. ####################################
  54.  
  55. def play(datei):
  56.     subprocess.call(['start', datei])
  57.  
  58. play("output.mp3")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement