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"> <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
View file

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

View file

@ -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,6 +464,8 @@ ordnerneu.mkdir(exist_ok=True)
logging.info("--------------------------------------------------") logging.info("--------------------------------------------------")
logging.info("START .txt Erzeugung ") logging.info("START .txt Erzeugung ")
logging.info("--------------------------------------------------") logging.info("--------------------------------------------------")
debug = True
if debug == False:
metarCabin = METAR() metarCabin = METAR()
metar = metarCabin.choices[0].message.content metar = metarCabin.choices[0].message.content
metar = "\n".join(filter(None, map(str.strip, metar.splitlines()))) metar = "\n".join(filter(None, map(str.strip, metar.splitlines())))