fixxed some json stuff

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-08-12 22:07:15 +02:00
parent b175a59c42
commit bce6623603
1 changed files with 5 additions and 5 deletions

View File

@ -2,6 +2,7 @@ import time
import os import os
current_path = os.path.dirname(os.path.realpath(__file__)) current_path = os.path.dirname(os.path.realpath(__file__))
import threading import threading
import json
try: try:
import pystray import pystray
from PIL import Image, ImageDraw from PIL import Image, ImageDraw
@ -25,20 +26,19 @@ def debug_print_error(msg: str):
if not os.path.exists(current_path+"/modes.json"): if not os.path.exists(current_path+"/modes.json"):
with open(current_path+"/modes.json", "w") as f: with open(current_path+"/modes.json", "w") as f:
f.write({"mode": 0}) json.dump({"mode": 0}, f)
else: else:
with open(current_path+"/modes.json", "r") as f: with open(current_path+"/modes.json", "r") as f:
global mode global mode
mode = f.read() mode = json.load(f)["mode"]
#mode switches #mode switches
def volument_mode(): def volumen_mode():
debug_print("volument mode") debug_print("volument mode")
global mode global mode
mode = 0 mode = 0
with open(current_path+"/modes.json", "w") as f: with open(current_path+"/modes.json", "w") as f:
f.write({"mode": 0}) json.dump({"mode": 0}, f)
#mode actions #mode actions