mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 13:34:40 +00:00
Refactoring step one
This commit is contained in:
+101
@@ -0,0 +1,101 @@
|
||||
import datetime
|
||||
import json
|
||||
from sys import platform
|
||||
from typing import List, Optional, TypedDict
|
||||
from platform import uname
|
||||
|
||||
Music_Config = TypedDict(
|
||||
"Music_Config",
|
||||
{
|
||||
"ctx": Optional[str],
|
||||
"queue": List[str],
|
||||
"requester": List[str],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
|
||||
# *=========================================== Predefines
|
||||
MASTER_TIMEOUT = datetime.now()
|
||||
INITIAL_TIME_WAIT = 500
|
||||
MUZYKA: Music_Config = {"ctx": None, "queue": [], "requester": []}
|
||||
|
||||
LOGFILE = ""
|
||||
NETRC_FILE = ""
|
||||
MUSIC_FOLDER = ""
|
||||
MEMORY_FIVE_SIARA = ""
|
||||
MEMORY_FIVE_MUZYKA = ""
|
||||
SETTINGS_FILE = ""
|
||||
ENCODING = ""
|
||||
GRAPHICS_PATH = ""
|
||||
MUZYKA_MOJEGO_LUDU_HISTORIA = 1500
|
||||
MUZYKA_MOJEGO_LUDU_SLOWA_KLUCZOWE = 15
|
||||
MUZYKA_MOJEGO_LUDU_PLAJLISTA = 30
|
||||
|
||||
FILE_SERVICE_ADDRESS = "http://192.168.1.15:5000"
|
||||
RADIO_HARBOR_ADDRESS = "http://192.168.1.15:54321"
|
||||
SKIP_TRACK = "/skip"
|
||||
|
||||
GET_MP3 = "/mp3"
|
||||
SEND_MP3 = "/update_mp3"
|
||||
GET_PLAYLIST = "/get_music"
|
||||
ADD_TO_PRIO_PLAYLIST = "/add_to_priority"
|
||||
CREATE_PRIO_PLAYLIST = "/create_priority_playlist"
|
||||
|
||||
REQUEST_MUSIC = "/request_radio_file"
|
||||
CLEAR_PRIO = "/clear_pr_pls"
|
||||
LIBRARIAN_SERVICE_ADDRESS = "http://192.168.1.192:5001"
|
||||
SEND_QUERY = "/query"
|
||||
TIME_BETWEEN_CALLS = 100000
|
||||
LAST_SPONTANEOUS_CALL = datetime.now()
|
||||
HOST_ADDRESS = "192.168.1.191"
|
||||
PORT_ADDRESS = 5000
|
||||
|
||||
# *=========================================== Platform Specific Predefines
|
||||
|
||||
if platform in ("linux", "linux2"):
|
||||
SEPARATOR_FILE_PATH = "/"
|
||||
if "microsoft-standard" in uname().release:
|
||||
LOGFILE = "/home/mtuszowski/conjurer/discord.log"
|
||||
MEMORY_FIVE_SIARA = "/home/mtuszowski/conjurer/pamiec.json"
|
||||
SYSTEM_GPT_SETTINGS = "/home/mtuszowski/conjurer/system_gpt_settings.json"
|
||||
MEMORY_FIVE_MUZYKA = "/home/mtuszowski/conjurer/pamiec_muzyki.json"
|
||||
MUSIC_FOLDER = "/mnt/g/Muzyka/"
|
||||
SETTINGS_FILE = "/home/mtuszowski/conjurer/settings.json"
|
||||
NETRC_FILE = "/home/mtuszowski/.netrc"
|
||||
LOGSTORE = "/home/mtuszowski/conjurer/logs/"
|
||||
ACCIDENT_LOG = "/home/mtuszowski/conjurer/accident_log.json"
|
||||
ENCODING = "utf-8"
|
||||
GRAPHICS_PATH = "/home/mtuszowski/conjurer/Conjurer_graphics/"
|
||||
DIR_PATH_SADOX = "/mnt/c/Users/mtusz/OneDrive/Dokumenty/Fansadox"
|
||||
|
||||
else:
|
||||
LOGFILE = "/home/pi/Conjurer/discord.log"
|
||||
MEMORY_FIVE_SIARA = "/home/pi/Conjurer/pamiec.json"
|
||||
SYSTEM_GPT_SETTINGS = "/home/pi/Conjurer/system_gpt_settings.json"
|
||||
MEMORY_FIVE_MUZYKA = "/home/pi/Conjurer/pamiec_muzyki.json"
|
||||
MUSIC_FOLDER = "/home/pi/RetroPie/mp3/"
|
||||
SETTINGS_FILE = "/home/pi/Conjurer/settings.json"
|
||||
NETRC_FILE = "/home/pi/.netrc"
|
||||
LOGSTORE = "/home/pi/RetroPie/logs/"
|
||||
ACCIDENT_LOG = "/home/pi/Conjurer/accident_log.json"
|
||||
ENCODING = "utf-8"
|
||||
GRAPHICS_PATH = "/home/pi/RetroPie/Conjurer_graphics/"
|
||||
DIR_PATH_SADOX = "/home/pi/RetroPie/Fansadox/"
|
||||
|
||||
|
||||
elif platform == "win32":
|
||||
LOGFILE = "discord.log"
|
||||
MEMORY_FIVE_SIARA = "pamiec.json"
|
||||
SYSTEM_GPT_SETTINGS = "system_gpt_settings.json"
|
||||
MEMORY_FIVE_MUZYKA = "pamiec_muzyki.json"
|
||||
MUSIC_FOLDER = "G:\\Muzyka\\"
|
||||
SETTINGS_FILE = "settings.json"
|
||||
NETRC_FILE = "C:\\Users\\mtusz\\.netrc"
|
||||
LOGSTORE = "C:\\Users\\mtusz\\OneDrive\\Pulpit\\Conjurer\\logs\\"
|
||||
ACCIDENT_LOG = "accident_log.json"
|
||||
ENCODING = "utf-8"
|
||||
DIR_PATH_SADOX = "C:\\Users\\mtusz\\OneDrive\\Dokumenty\\Fansadox\\"
|
||||
SEPARATOR_FILE_PATH = "\\"
|
||||
with open(SETTINGS_FILE, "r", encoding=ENCODING) as f_settings_file:
|
||||
DATA = json.load(f_settings_file)
|
||||
Reference in New Issue
Block a user