Zufallsnamen
This commit is contained in:
parent
0be69a4884
commit
ccd615bb07
14 changed files with 85 additions and 60 deletions
|
|
@ -313,7 +313,7 @@ def txtSave(Datei, Inhalt):
|
|||
|
||||
with open(Datei, "r", encoding="utf-8") as f:
|
||||
erste_zeile = f.readline().strip()
|
||||
if erste_zeile.startswith("##Voice:"):
|
||||
if erste_zeile.startswith("##Role:"):
|
||||
voice = erste_zeile + "\n"
|
||||
Inhalt = voice + Inhalt
|
||||
except:
|
||||
|
|
@ -346,15 +346,19 @@ def BACKUP(Pfad):
|
|||
len(txt_files)
|
||||
)
|
||||
return None
|
||||
def zufName(X):
|
||||
with open("namen.json", encoding="utf-8") as f:
|
||||
def zufName(geschlecht):
|
||||
with resource_path("namen.json").open(encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
if geschlecht == "P": # Frau
|
||||
return random.choice(data["Frau"])
|
||||
|
||||
name = random.choice(data["Mann"])
|
||||
if X =='P':
|
||||
name = random.choice(data["Frau"])
|
||||
return name
|
||||
|
||||
# Default: Mann
|
||||
return random.choice(data["Mann"])
|
||||
def delete(pfad_ogg):
|
||||
if pfad_ogg.exists():
|
||||
pfad_ogg.unlink()
|
||||
logging.info("Datei gelöscht: %s", pfad_ogg)
|
||||
return None
|
||||
host = os.getcwd()
|
||||
Pfad = os.getcwd() + '/Announcements/'
|
||||
_airports_cache = None
|
||||
|
|
@ -464,7 +468,7 @@ ordnerneu.mkdir(exist_ok=True)
|
|||
logging.info("--------------------------------------------------")
|
||||
logging.info("START .txt Erzeugung ")
|
||||
logging.info("--------------------------------------------------")
|
||||
debug = True
|
||||
debug = False
|
||||
if debug == False:
|
||||
metarCabin = METAR()
|
||||
metar = metarCabin.choices[0].message.content
|
||||
|
|
@ -494,24 +498,39 @@ if debug == False:
|
|||
|
||||
Pfad = Pfad_wd + 'BoardingWelcomePilot.txt'
|
||||
txtSave(Pfad, Inhalt)
|
||||
pfad_txt = Path(Pfad_wd) / "BoardingWelcomePilot.txt"
|
||||
pfad_ogg = pfad_txt.with_suffix(".ogg")
|
||||
delete(pfad_ogg)
|
||||
|
||||
Pfad = Pfad_wd + 'FastenSeatbelt.txt'
|
||||
txtSave(Pfad, metar)
|
||||
pfad_txt = Path(Pfad_wd) / 'FastenSeatbelt.txt'
|
||||
pfad_ogg = pfad_txt.with_suffix(".ogg")
|
||||
delete(pfad_ogg)
|
||||
|
||||
Pfad = Pfad_wd + 'CruiseElapsed10Percent.txt'
|
||||
txtSave(Pfad, InhaltCruise10)
|
||||
pfad_txt = Path(Pfad_wd) / 'CruiseElapsed10Percent.txt'
|
||||
pfad_ogg = pfad_txt.with_suffix(".ogg")
|
||||
delete(pfad_ogg)
|
||||
|
||||
Pfad = Pfad_wd + 'CruiseElapsed50Percent.txt'
|
||||
txtSave(Pfad, InhaltCruise50)
|
||||
pfad_txt = Path(Pfad_wd) / 'CruiseElapsed50Percent.txt'
|
||||
pfad_ogg = pfad_txt.with_suffix(".ogg")
|
||||
delete(pfad_ogg)
|
||||
|
||||
Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt'
|
||||
txtSave(Pfad, InhaltCruise80)
|
||||
|
||||
Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt'
|
||||
txtSave(Pfad, InhaltCruise80)
|
||||
pfad_txt = Path(Pfad_wd) / 'CruiseElapsed80Percent.txt'
|
||||
pfad_ogg = pfad_txt.with_suffix(".ogg")
|
||||
delete(pfad_ogg)
|
||||
|
||||
Pfad = Pfad_wd + 'SafetyBriefing.txt'
|
||||
txtSave(Pfad, Safety)
|
||||
pfad_txt = Path(Pfad_wd) / 'SafetyBriefing.txt'
|
||||
pfad_ogg = pfad_txt.with_suffix(".ogg")
|
||||
delete(pfad_ogg)
|
||||
|
||||
logging.info("--------------------------------------------------")
|
||||
logging.info(" F E R T S C H ")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue