可用性改进

This commit is contained in:
2025-07-23 23:43:17 +08:00
parent d8feb829b1
commit c679704e56
9 changed files with 54 additions and 14 deletions

26
auxiliary.py Normal file
View File

@@ -0,0 +1,26 @@
import time
import pathlib
import toml
def get_daystamp():
#print("Daystamp: ", (time.time() // (24*3600))) # 20292.0
return (time.time() // (24*3600))
class ConfigFile():
def __init__(self, path):
self.path = pathlib.Path(path)
if self.path.exists() == 0:
self.path.touch()
self.data = dict()
with open(self.path, 'r') as f:
self.data = toml.load(f)
def modify(self, key, value):
self.data[key] = value
self.save()
def save(self, path=""):
if path == "":
path = self.path
with open(path, 'w') as f:
toml.dump(self.data, f)
def get(self, key, default = None):
pass