1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00

TTS scripts were completely broken

This commit is contained in:
Bertrand Songis 2016-05-10 00:59:51 +02:00
parent e55a84d8b7
commit 77888ae200
9 changed files with 49 additions and 66 deletions

View file

@ -26,12 +26,13 @@
# Portuguese : Romolo Manfredini
# Spanish : Romolo Manfredini (With the help of Jose Moreno)
from __future__ import print_function
# from __future__ import print_function
import os
import sys
import subprocess
import zipfile
from tts_common import *
try:
# Python 3
@ -42,24 +43,6 @@ except ImportError:
from httplib import HTTPConnection
from urllib import urlencode
NO_ALTERNATE = 1024
def filename(idx, alternate=0):
if "gruvin9x" in sys.argv:
ext = ".ad4"
else:
ext = ".wav"
if isinstance(idx, int):
result = "%04d%s" % (idx, ext)
elif board in ('sky9x', 'taranis'):
result = idx + ext
else:
if alternate >= NO_ALTERNATE:
return None
result = "%04d%s" % (alternate, ext)
return result
def wavstrip(filename):
output = "_" + filename
@ -142,22 +125,7 @@ def generate(str, filename):
if __name__ == "__main__":
if "sky9x" in sys.argv:
board = "sky9x"
PROMPT_CUSTOM_BASE = 256
PROMPT_SYSTEM_BASE = 0
elif "taranis" in sys.argv:
board = "taranis"
PROMPT_CUSTOM_BASE = 256
PROMPT_SYSTEM_BASE = 0
elif "gruvin9x" in sys.argv:
board = "gruvin9x"
PROMPT_CUSTOM_BASE = 0
PROMPT_SYSTEM_BASE = 256
else:
board = "stock"
PROMPT_CUSTOM_BASE = 0
PROMPT_SYSTEM_BASE = 256
if "sapi" in sys.argv:
import pyTTS

35
radio/util/tts_common.py Normal file
View file

@ -0,0 +1,35 @@
NO_ALTERNATE = 1024
import sys
def filename(idx, alternate=0):
if "gruvin9x" in sys.argv:
ext = ".ad4"
else:
ext = ".wav"
if isinstance(idx, int):
result = "%04d%s" % (idx, ext)
elif board in ('sky9x', 'taranis'):
result = idx + ext
else:
if alternate >= NO_ALTERNATE:
return None
result = "%04d%s" % (alternate, ext)
return result
if "sky9x" in sys.argv:
board = "sky9x"
PROMPT_CUSTOM_BASE = 256
PROMPT_SYSTEM_BASE = 0
elif "taranis" in sys.argv or "horus" in sys.argv:
board = "taranis"
PROMPT_CUSTOM_BASE = 256
PROMPT_SYSTEM_BASE = 0
elif "gruvin9x" in sys.argv:
board = "gruvin9x"
PROMPT_CUSTOM_BASE = 0
PROMPT_SYSTEM_BASE = 256
else:
board = "stock"
PROMPT_CUSTOM_BASE = 0
PROMPT_SYSTEM_BASE = 256

View file

@ -2,7 +2,7 @@
# Czech language sounds configuration
from tts import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
from tts_common import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
systemSounds = []

View file

@ -2,7 +2,7 @@
# German language sounds configuration
from tts import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
from tts_common import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
systemSounds = []

View file

@ -2,7 +2,7 @@
# English language sounds configuration
from tts import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
from tts_common import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
systemSounds = []
@ -29,6 +29,7 @@ for i, s in enumerate(["volt", "volts",
"percent", "percent",
"milliamp-hour", "milliamp-hours",
"watt", "watts",
"milli-watt", "milli-watts",
"db", "db",
"r p m", "r p m",
"g", "g",
@ -51,17 +52,7 @@ for s, f, a in [(u"trim center", "midtrim", 495),
(u"throttle warning", "thralert", 481),
(u"switch warning", "swalert", 482),
(u"bad eeprom", "eebad", 483),
(u"Welcome to open tea ex!", "tada", 480),
(u"twenty. seconds", "timer20", 500),
(u"thirty. seconds", "timer30", 501),
(u"A1,low", "a1_org", NO_ALTERNATE),
(u"A1,critical", "a1_red", NO_ALTERNATE),
(u"A2,low", "a2_org", NO_ALTERNATE),
(u"A2,critical", "a2_red", NO_ALTERNATE),
(u"A3,low", "a3_org", NO_ALTERNATE),
(u"A3,critical", "a3_red", NO_ALTERNATE),
(u"A4,low", "a4_org", NO_ALTERNATE),
(u"A4,critical", "a4_red", NO_ALTERNATE),
(u"Welcome to open tea ex!", "hello", 480),
(u"RF signal, low", "rssi_org", NO_ALTERNATE),
(u"RF signal, critical", "rssi_red", NO_ALTERNATE),
(u"radio antenna defective", "swr_red", NO_ALTERNATE),

View file

@ -2,7 +2,7 @@
# Spanish language sounds configuration
from tts import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
from tts_common import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
systemSounds = []

View file

@ -2,8 +2,7 @@
# French language sounds configuration
from tts import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
from tts_common import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
systemSounds = []
sounds = []
@ -16,7 +15,7 @@ for i, s in enumerate(["une", "onze", "vingt et une", "trente et une", "quarante
systemSounds.append((s, filename(PROMPT_SYSTEM_BASE + 110 + i)))
for i, s in enumerate(["virgule", "et", "moins", "minuit", "midi"]):
systemSounds.append((s, filename(PROMPT_SYSTEM_BASE + 119 + i)))
for i, s in enumerate(["volts", u"ampères", u"milli ampères", u"knots", u"mètres seconde", u"pieds par seconde", u"kilomètre heure", u"miles par heure", u"mètres", u"pieds", u"degrés", u"degrés fahrenheit", u"pourcents", u"milli ampères / heure", u"watt", u"milli watt", u"db", u"tours minute", u"g", u"degrés", u"millilitres", u"onces", u"heure", u"minute", u"seconde"]):
for i, s in enumerate([u"volts", u"ampères", u"milli ampères", u"knots", u"mètres seconde", u"pieds par seconde", u"kilomètre heure", u"miles par heure", u"mètres", u"pieds", u"degrés", u"degrés fahrenheit", u"pourcents", u"milli ampères / heure", u"watt", u"milli watt", u"db", u"tours minute", u"g", u"degrés", u"millilitres", u"onces", u"heure", u"minute", u"seconde"]):
systemSounds.append((s, filename(PROMPT_SYSTEM_BASE + 125 + i)))
for i, s in enumerate(["virgule 0", "virgule 1", "virgule 2", "virgule 3", "virgule 4", "virgule 5", "virgule 6", "virgule 7", "virgule 8", "virgule 9"]):
systemSounds.append((s, filename(PROMPT_SYSTEM_BASE + 180 + i)))
@ -27,17 +26,7 @@ for s, f, a in [(u"Trim centré", "midtrim", 495),
(u"Alerte manche des gaz", "thralert", 481),
(u"Alerte inters", "swalert", 482),
(u"éprome corrompue", "eebad", 483),
(u"Bienvenue sur Open TI X!", "tada", 480),
(u"vingt secondes", "timer20", 500),
(u"trente secondes", "timer30", 501),
(u"A1,faible", "a1_org", NO_ALTERNATE),
(u"A1,critique", "a1_red", NO_ALTERNATE),
(u"A2,faible", "a2_org", NO_ALTERNATE),
(u"A2,critique", "a2_red", NO_ALTERNATE),
(u"A3,faible", "a3_org", NO_ALTERNATE),
(u"A3,critique", "a3_red", NO_ALTERNATE),
(u"A4,faible", "a4_org", NO_ALTERNATE),
(u"A4,critique", "a4_red", NO_ALTERNATE),
(u"Bienvenue sur Open Thé Hix!", "hello", 480),
(u"Signal RF, faible", "rssi_org", NO_ALTERNATE),
(u"Signal RF, critique", "rssi_red", NO_ALTERNATE),
(u"Antenne défectueuse", "swr_red", NO_ALTERNATE),

View file

@ -2,7 +2,7 @@
# Italian language sounds configuration
from tts import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
from tts_common import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
systemSounds = []

View file

@ -2,7 +2,7 @@
# Portuguese language sounds configuration
from tts import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
from tts_common import filename, NO_ALTERNATE, PROMPT_SYSTEM_BASE, PROMPT_CUSTOM_BASE
systemSounds = []