|
|
|
@ -4,6 +4,20 @@ import toml
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
import subprocess
|
|
|
|
|
from urllib.request import urlopen
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_public_ip():
|
|
|
|
|
data = str(urlopen('http://checkip.dyndns.com/').read())
|
|
|
|
|
return re.compile(r'Address: (\d+.\d+.\d+.\d+)').search(data).group(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def read_datei(datei):
|
|
|
|
|
with open(os.path.join(CONFIG["pfad_cloud"], datei)) as file:
|
|
|
|
|
inhalt = file.read()
|
|
|
|
|
inhalt = inhalt.strip()
|
|
|
|
|
return inhalt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class EmpyrionLauncher(QtWidgets.QDialog):
|
|
|
|
@ -29,7 +43,7 @@ class EmpyrionLauncher(QtWidgets.QDialog):
|
|
|
|
|
def on_spiel_starten(self):
|
|
|
|
|
dateiname = os.path.join(CONFIG["pfad_cloud"], "aktiv_{}".format(CONFIG["username"]))
|
|
|
|
|
with open(dateiname, "w") as file:
|
|
|
|
|
file.write("")
|
|
|
|
|
file.write(f"{get_public_ip()}")
|
|
|
|
|
subprocess.call(CONFIG["pfad_game"])
|
|
|
|
|
os.remove(dateiname)
|
|
|
|
|
|
|
|
|
@ -58,6 +72,7 @@ class EmpyrionLauncher(QtWidgets.QDialog):
|
|
|
|
|
self.label_status_pfade.setText(self.text_status_pfade)
|
|
|
|
|
|
|
|
|
|
def cloud_lokal_verschieben(self):
|
|
|
|
|
datei = ""
|
|
|
|
|
self.check_pfad()
|
|
|
|
|
if self.status_pfade:
|
|
|
|
|
ordnerinhalt = os.listdir(CONFIG["pfad_cloud"])
|
|
|
|
@ -72,7 +87,7 @@ class EmpyrionLauncher(QtWidgets.QDialog):
|
|
|
|
|
for datei in ordnerinhalt:
|
|
|
|
|
if datei.startswith("aktiv"):
|
|
|
|
|
user = datei.split("_")[1]
|
|
|
|
|
self.label_spiel_aktiv.setText("Spiel schon aktiv von {}".format(user))
|
|
|
|
|
self.label_spiel_aktiv.setText("Spiel schon aktiv von {} \n IP: {}".format(user, read_datei(datei)))
|
|
|
|
|
else:
|
|
|
|
|
self.label_spiel_aktiv.setText("Kein Spiel aktiv")
|
|
|
|
|
self.ui.button_spiel_starten.clicked.connect(self.on_spiel_starten)
|
|
|
|
|