Zufallsnamen

This commit is contained in:
hubobel 2025-12-27 16:29:26 +01:00
parent 9daaf4bf2a
commit 0be69a4884
3 changed files with 49 additions and 36 deletions

View file

@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

2
.idea/misc.xml generated
View file

@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.13" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13" project-jdk-type="Python SDK" />
</project>

View file

@ -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 ")