diff --git a/.idea/MSFS_Simbrief2.iml b/.idea/MSFS_Simbrief2.iml index 8388dbc..d8b3f6c 100644 --- a/.idea/MSFS_Simbrief2.iml +++ b/.idea/MSFS_Simbrief2.iml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 01cb8a2..1d3ce46 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/Simbriefimport.py b/Simbriefimport.py index 6bf9d8f..7afd7d5 100644 --- a/Simbriefimport.py +++ b/Simbriefimport.py @@ -346,7 +346,14 @@ def BACKUP(Pfad): len(txt_files) ) return None +def zufName(X): + with open("namen.json", encoding="utf-8") as f: + data = json.load(f) + name = random.choice(data["Mann"]) + if X =='P': + name = random.choice(data["Frau"]) + return name host = os.getcwd() Pfad = os.getcwd() + '/Announcements/' @@ -367,6 +374,10 @@ if conf_file.exists(): ) with open(conf_file) as file: passw = json.load(file) + if passw['Prompt']['CptName'] == '': + passw['Prompt']['CptName'] = zufName("C") + if passw['Prompt']['PurserName'] == '': + passw['Prompt']['PurserName'] = zufName("P") else: #print("Keine Konfigurationsdatei vorhanden:", conf_file) @@ -453,52 +464,54 @@ ordnerneu.mkdir(exist_ok=True) logging.info("--------------------------------------------------") logging.info("START .txt Erzeugung ") logging.info("--------------------------------------------------") -metarCabin = METAR() -metar = metarCabin.choices[0].message.content -metar = "\n".join(filter(None, map(str.strip, metar.splitlines()))) -logging.info("METAR erzeugt") -welcomePilot = WelcomePilot() -Inhalt = welcomePilot.choices[0].message.content -Inhalt = "\n".join(filter(None, map(str.strip, Inhalt.splitlines()))) -logging.info("WelcomePilot erzeugt") +debug = True +if debug == False: + metarCabin = METAR() + metar = metarCabin.choices[0].message.content + metar = "\n".join(filter(None, map(str.strip, metar.splitlines()))) + logging.info("METAR erzeugt") + welcomePilot = WelcomePilot() + Inhalt = welcomePilot.choices[0].message.content + Inhalt = "\n".join(filter(None, map(str.strip, Inhalt.splitlines()))) + logging.info("WelcomePilot erzeugt") -InhaltCruise10 = CruiseElapsed10Percent().choices[0].message.content -InhaltCruise10 = "\n".join(filter(None, map(str.strip, InhaltCruise10.splitlines()))) -logging.info("Cruise10 erzeugt") + InhaltCruise10 = CruiseElapsed10Percent().choices[0].message.content + InhaltCruise10 = "\n".join(filter(None, map(str.strip, InhaltCruise10.splitlines()))) + logging.info("Cruise10 erzeugt") -InhaltCruise50 = CruiseElapsed50Percent().choices[0].message.content -InhaltCruise50 = "\n".join(filter(None, map(str.strip, InhaltCruise50.splitlines()))) -logging.info("Cruise50 erzeugt") + InhaltCruise50 = CruiseElapsed50Percent().choices[0].message.content + InhaltCruise50 = "\n".join(filter(None, map(str.strip, InhaltCruise50.splitlines()))) + logging.info("Cruise50 erzeugt") -InhaltCruise80 = CruiseElapsed80Percent().choices[0].message.content -InhaltCruise80 = "\n".join(filter(None, map(str.strip, InhaltCruise80.splitlines()))) + InhaltCruise80 = CruiseElapsed80Percent().choices[0].message.content + InhaltCruise80 = "\n".join(filter(None, map(str.strip, InhaltCruise80.splitlines()))) -logging.info("Cruise80 erzeugt") + logging.info("Cruise80 erzeugt") -Safety = SafetyBriefing().choices[0].message.content -Safety = "\n".join(filter(None, map(str.strip, Safety.splitlines()))) -logging.info("SafetyBriefing erzeugt") + Safety = SafetyBriefing().choices[0].message.content + Safety = "\n".join(filter(None, map(str.strip, Safety.splitlines()))) + logging.info("SafetyBriefing erzeugt") -Pfad = Pfad_wd + 'BoardingWelcomePilot.txt' -txtSave(Pfad, Inhalt) + Pfad = Pfad_wd + 'BoardingWelcomePilot.txt' + txtSave(Pfad, Inhalt) -Pfad = Pfad_wd + 'FastenSeatbelt.txt' -txtSave(Pfad, metar) + Pfad = Pfad_wd + 'FastenSeatbelt.txt' + txtSave(Pfad, metar) -Pfad = Pfad_wd + 'CruiseElapsed10Percent.txt' -txtSave(Pfad, InhaltCruise10) + Pfad = Pfad_wd + 'CruiseElapsed10Percent.txt' + txtSave(Pfad, InhaltCruise10) -Pfad = Pfad_wd + 'CruiseElapsed50Percent.txt' -txtSave(Pfad, InhaltCruise50) + Pfad = Pfad_wd + 'CruiseElapsed50Percent.txt' + txtSave(Pfad, InhaltCruise50) -Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt' -txtSave(Pfad, InhaltCruise80) + Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt' + txtSave(Pfad, InhaltCruise80) -Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt' -txtSave(Pfad, InhaltCruise80) + Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt' + txtSave(Pfad, InhaltCruise80) -Pfad = Pfad_wd + 'SafetyBriefing.txt' -txtSave(Pfad, Safety) + Pfad = Pfad_wd + 'SafetyBriefing.txt' + txtSave(Pfad, Safety) logging.info("--------------------------------------------------") logging.info(" F E R T S C H ")