added unit test, updated Readme and picture

This commit is contained in:
cpu
2023-12-13 01:53:14 +01:00
parent 1522032a36
commit 89f84666bc
8 changed files with 406 additions and 73 deletions

View File

@@ -3,16 +3,15 @@ import sys
import time
from datetime import datetime
import subprocess
from slovak_datetime_formatter import get_datetime_as_slovak_sentence
from lib.slovak_datetime_formatter import get_datetime_as_slovak_sentence
if len(sys.argv) > 1 and sys.argv[1] == "test":
import dummygpio as GPIO
import lib.dummygpio as GPIO
else:
import RPi.GPIO as GPIO
BUTTON_TIMEOUT = (
30 # button release timeout terminates playing
)
TTS_API_URL = "https://tts.virtonline.eu/api/tts"
BUTTON_TIMEOUT = 30 # button release timeout terminates playing
PIN = 27 # listen to changes on this GPIO pin
GPIO.setmode(GPIO.BCM) # use BCM pin layout
GPIO.setwarnings(False)
@@ -56,11 +55,16 @@ def generate_presny_cas():
username, password = get_credentials()
subprocess.call(
[
"curl", "--silent", "-u", f"{username}:{password}",
"curl",
"--silent",
"-u",
f"{username}:{password}",
"--get",
"--data-urlencode", f"text={text}",
"https://tts.virtonline.eu/api/tts",
"--output", "presny_cas.wav",
"--data-urlencode",
f"text={text}",
TTS_API_URL,
"--output",
"presny_cas.wav",
]
)
print("Generated presny_cas.wav")