yaml_edit +
This commit is contained in:
parent
c3f9f68e64
commit
47546c48e7
@ -6,9 +6,5 @@ QueryPort: 27015
|
||||
ServerPassword:
|
||||
MaxPlayers: 70
|
||||
ModsId:
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
listen: True
|
||||
Cluster: False
|
58
dodo.py
58
dodo.py
@ -1,8 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import yaml
|
||||
#map_server = "TheIsland"
|
||||
#dir_server = "~/ARK_Servers/"
|
||||
from pathlib import Path
|
||||
home_Dir = Path.home()
|
||||
map_server = "TheIsland"
|
||||
dir_server = "~/ARK_Servers/"
|
||||
#session_name = "Dodo server"
|
||||
#Port = 7777
|
||||
#QueryPort = 27015
|
||||
@ -12,14 +14,29 @@ import yaml
|
||||
#listen = True
|
||||
#Cluster = False
|
||||
|
||||
def read_yaml():
|
||||
with open("config.yaml", "r") as f:
|
||||
return yaml.safe_load(f)
|
||||
#if not os.path.exists("~/.config/dodo/config.yaml"):
|
||||
#os.system("")
|
||||
|
||||
if not os.path.exists(dir_server):
|
||||
os.mkdir(dir_server)
|
||||
def yaml_create():
|
||||
if not os.path.exists(f"{home_Dir}/.config/dodo/"):
|
||||
os.mkdir(f"{home_Dir}/.config/dodo/")
|
||||
if not os.path.exists("config.yaml"):
|
||||
example = open("/usr/share/dodo/config.yaml", "r")
|
||||
f = example.read()
|
||||
else:
|
||||
example = open("config.yaml")
|
||||
f = example.read()
|
||||
config = open(f"{home_Dir}/.config/dodo/config.yaml", "w+")
|
||||
config.write(f)
|
||||
example.close()
|
||||
config.close()
|
||||
|
||||
def install(map_server):
|
||||
|
||||
|
||||
#if not os.path.exists(dir_server):
|
||||
# os.mkdir(dir_server)
|
||||
|
||||
def yaml_edit():
|
||||
print("""Укажите требуется ли кластер?
|
||||
1. Да
|
||||
2. Нет""")
|
||||
@ -29,6 +46,15 @@ def install(map_server):
|
||||
else:
|
||||
Cluster = False
|
||||
|
||||
print("Укажите название Сервера")
|
||||
session_name = input("")
|
||||
|
||||
print("Укажите порт Сервера <7777>")
|
||||
Port = input("")
|
||||
|
||||
print("Укажите Query-порт Сервера <27015>")
|
||||
QueryPort = input("")
|
||||
|
||||
while True:
|
||||
count_maps = input("Укажите количество карт:\n")
|
||||
if count_maps.isdigit:
|
||||
@ -78,20 +104,20 @@ def install(map_server):
|
||||
elif count_map == "12":
|
||||
map_server = "Fjordur"
|
||||
print("Введите цифры")
|
||||
with open("/usr/share/dodo/config.yaml", "rw+") as f:
|
||||
config_Data = yaml.safe_load(f)
|
||||
config_Data[""]
|
||||
def install(map_server):
|
||||
if not os.path.isdir(dir_server + map_server):
|
||||
os.mkdir(dir_server + map_server)
|
||||
else:
|
||||
os.system(f"steamcmd +force_install_dir {dir_server + map_server} +login anonymous +app_update 376030 +quit")
|
||||
print("Укажите название Сервера")
|
||||
session_name = input("")
|
||||
print("Укажите порт Сервера <7777>")
|
||||
Port = input("")
|
||||
print("Укажите Query-порт Сервера <27015>")
|
||||
QueryPort = input("")
|
||||
install(map_server)
|
||||
os.chdir(dir_server + map_server + "/" + "ShooterGame/Binaries/Linux/")
|
||||
#os.chdir(dir_server + map_server + "/" + "ShooterGame/Binaries/Linux/")
|
||||
def start():
|
||||
if Cluster == False:
|
||||
os.system(f"./ShooterGameServer {map_server}?SessionName={session_name}?Port={Port}?QueryPort={QueryPort}?MaxPlayers={MaxPlayers}?GameModIds={ModsId}?listen={listen}")
|
||||
#os.system("ShooterGameServer")
|
||||
yaml_create()
|
||||
yaml_edit()
|
||||
install(map_server)
|
||||
start()
|
Loading…
Reference in New Issue
Block a user