Zufallsnamen
This commit is contained in:
parent
9daaf4bf2a
commit
0be69a4884
3 changed files with 49 additions and 36 deletions
2
.idea/MSFS_Simbrief2.iml
generated
2
.idea/MSFS_Simbrief2.iml
generated
|
|
@ -2,7 +2,7 @@
|
||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<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" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -3,5 +3,5 @@
|
||||||
<component name="Black">
|
<component name="Black">
|
||||||
<option name="sdkName" value="Python 3.13" />
|
<option name="sdkName" value="Python 3.13" />
|
||||||
</component>
|
</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>
|
</project>
|
||||||
|
|
@ -346,7 +346,14 @@ def BACKUP(Pfad):
|
||||||
len(txt_files)
|
len(txt_files)
|
||||||
)
|
)
|
||||||
return None
|
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()
|
host = os.getcwd()
|
||||||
Pfad = os.getcwd() + '/Announcements/'
|
Pfad = os.getcwd() + '/Announcements/'
|
||||||
|
|
@ -367,6 +374,10 @@ if conf_file.exists():
|
||||||
)
|
)
|
||||||
with open(conf_file) as file:
|
with open(conf_file) as file:
|
||||||
passw = json.load(file)
|
passw = json.load(file)
|
||||||
|
if passw['Prompt']['CptName'] == '':
|
||||||
|
passw['Prompt']['CptName'] = zufName("C")
|
||||||
|
if passw['Prompt']['PurserName'] == '':
|
||||||
|
passw['Prompt']['PurserName'] = zufName("P")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
#print("Keine Konfigurationsdatei vorhanden:", conf_file)
|
#print("Keine Konfigurationsdatei vorhanden:", conf_file)
|
||||||
|
|
@ -453,52 +464,54 @@ ordnerneu.mkdir(exist_ok=True)
|
||||||
logging.info("--------------------------------------------------")
|
logging.info("--------------------------------------------------")
|
||||||
logging.info("START .txt Erzeugung ")
|
logging.info("START .txt Erzeugung ")
|
||||||
logging.info("--------------------------------------------------")
|
logging.info("--------------------------------------------------")
|
||||||
metarCabin = METAR()
|
debug = True
|
||||||
metar = metarCabin.choices[0].message.content
|
if debug == False:
|
||||||
metar = "\n".join(filter(None, map(str.strip, metar.splitlines())))
|
metarCabin = METAR()
|
||||||
logging.info("METAR erzeugt")
|
metar = metarCabin.choices[0].message.content
|
||||||
welcomePilot = WelcomePilot()
|
metar = "\n".join(filter(None, map(str.strip, metar.splitlines())))
|
||||||
Inhalt = welcomePilot.choices[0].message.content
|
logging.info("METAR erzeugt")
|
||||||
Inhalt = "\n".join(filter(None, map(str.strip, Inhalt.splitlines())))
|
welcomePilot = WelcomePilot()
|
||||||
logging.info("WelcomePilot erzeugt")
|
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 = CruiseElapsed10Percent().choices[0].message.content
|
||||||
InhaltCruise10 = "\n".join(filter(None, map(str.strip, InhaltCruise10.splitlines())))
|
InhaltCruise10 = "\n".join(filter(None, map(str.strip, InhaltCruise10.splitlines())))
|
||||||
logging.info("Cruise10 erzeugt")
|
logging.info("Cruise10 erzeugt")
|
||||||
|
|
||||||
InhaltCruise50 = CruiseElapsed50Percent().choices[0].message.content
|
InhaltCruise50 = CruiseElapsed50Percent().choices[0].message.content
|
||||||
InhaltCruise50 = "\n".join(filter(None, map(str.strip, InhaltCruise50.splitlines())))
|
InhaltCruise50 = "\n".join(filter(None, map(str.strip, InhaltCruise50.splitlines())))
|
||||||
logging.info("Cruise50 erzeugt")
|
logging.info("Cruise50 erzeugt")
|
||||||
|
|
||||||
InhaltCruise80 = CruiseElapsed80Percent().choices[0].message.content
|
InhaltCruise80 = CruiseElapsed80Percent().choices[0].message.content
|
||||||
InhaltCruise80 = "\n".join(filter(None, map(str.strip, InhaltCruise80.splitlines())))
|
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 = SafetyBriefing().choices[0].message.content
|
||||||
Safety = "\n".join(filter(None, map(str.strip, Safety.splitlines())))
|
Safety = "\n".join(filter(None, map(str.strip, Safety.splitlines())))
|
||||||
logging.info("SafetyBriefing erzeugt")
|
logging.info("SafetyBriefing erzeugt")
|
||||||
|
|
||||||
Pfad = Pfad_wd + 'BoardingWelcomePilot.txt'
|
Pfad = Pfad_wd + 'BoardingWelcomePilot.txt'
|
||||||
txtSave(Pfad, Inhalt)
|
txtSave(Pfad, Inhalt)
|
||||||
|
|
||||||
Pfad = Pfad_wd + 'FastenSeatbelt.txt'
|
Pfad = Pfad_wd + 'FastenSeatbelt.txt'
|
||||||
txtSave(Pfad, metar)
|
txtSave(Pfad, metar)
|
||||||
|
|
||||||
Pfad = Pfad_wd + 'CruiseElapsed10Percent.txt'
|
Pfad = Pfad_wd + 'CruiseElapsed10Percent.txt'
|
||||||
txtSave(Pfad, InhaltCruise10)
|
txtSave(Pfad, InhaltCruise10)
|
||||||
|
|
||||||
Pfad = Pfad_wd + 'CruiseElapsed50Percent.txt'
|
Pfad = Pfad_wd + 'CruiseElapsed50Percent.txt'
|
||||||
txtSave(Pfad, InhaltCruise50)
|
txtSave(Pfad, InhaltCruise50)
|
||||||
|
|
||||||
Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt'
|
Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt'
|
||||||
txtSave(Pfad, InhaltCruise80)
|
txtSave(Pfad, InhaltCruise80)
|
||||||
|
|
||||||
Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt'
|
Pfad = Pfad_wd + 'CruiseElapsed80Percent.txt'
|
||||||
txtSave(Pfad, InhaltCruise80)
|
txtSave(Pfad, InhaltCruise80)
|
||||||
|
|
||||||
Pfad = Pfad_wd + 'SafetyBriefing.txt'
|
Pfad = Pfad_wd + 'SafetyBriefing.txt'
|
||||||
txtSave(Pfad, Safety)
|
txtSave(Pfad, Safety)
|
||||||
|
|
||||||
logging.info("--------------------------------------------------")
|
logging.info("--------------------------------------------------")
|
||||||
logging.info(" F E R T S C H ")
|
logging.info(" F E R T S C H ")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue