Improved tools

This commit is contained in:
Sven Heidemann 2021-11-15 17:05:48 +01:00
parent 059e345751
commit b1becbe866
9 changed files with 51 additions and 75 deletions

View File

@ -1,3 +1,5 @@
import json
from cpl_core.application import ApplicationABC
from cpl_core.configuration import ConfigurationABC
from cpl_core.console import Console
@ -13,4 +15,42 @@ class Application(ApplicationABC):
pass
def main(self):
Console.write_line('Hello World')
f = open("./Levels.txt", "r", encoding='utf-8')
i = 0
lines = f.readlines()
json_list = []
for line in lines:
if i > 0:
line = line.split('\n')[0]
words = line.split(' ')
use_words = []
for word in words:
if word != '':
use_words.append(word)
if len(use_words) == 6:
string = use_words[2]
use_words.remove(use_words[2])
use_words[1] += f' {string}'
loc_json = {
"id": int(use_words[0]),
"alias": use_words[1],
"min_ontime": int(use_words[2]),
"min_message_count": int(use_words[3]),
"color": use_words[4],
"hoist": "False",
"mentionable": "True",
"PermissionBagId": 0
}
json_list.append(loc_json)
i += 1
f.close()
Console.write_line(json_list)
json_format = json.dumps(json_list, ensure_ascii=False)
with open("../src/sh_dobby_bot/assets/Level.json", "w", encoding='utf-8') as outfile:
outfile.write(json_format)

View File

@ -1,15 +0,0 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "ERROR",
"FileLogLevel": "WARN"
}
}

View File

@ -13,4 +13,13 @@ class Application(ApplicationABC):
pass
def main(self):
Console.write_line('Hello World')
ontime = 0
mc = 0
for i in range(0, 31):
Console.write_line(f'i: {i} {ontime} {mc}')
if i == 0:
ontime = 4
mc = 10
else:
ontime = round((ontime * 1.2561), 0)
mc = round((mc * 1.26), 0)

View File

@ -1,15 +0,0 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "logs/",
"Filename": "log_$start_time.log",
"ConsoleLogLevel": "ERROR",
"FileLogLevel": "WARN"
}
}

View File

@ -1,43 +0,0 @@
{
"ProjectSettings": {
"Name": "tools/ontime-calculator",
"Version": {
"Major": "0",
"Minor": "0",
"Micro": "0"
},
"Author": "",
"AuthorEmail": "",
"Description": "",
"LongDescription": "",
"URL": "",
"CopyrightDate": "",
"CopyrightName": "",
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
"sh_cpl>=2021.10.2"
],
"PythonVersion": ">=3.9.2",
"PythonPath": {
"linux": ""
},
"Classifiers": []
},
"BuildSettings": {
"ProjectType": "console",
"SourcePath": "",
"OutputPath": "../../dist",
"Main": "tools/_ontime_calculator.main",
"EntryPoint": "tools/ontime-calculator",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": []
}
}