-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"volume": 10 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import json | ||
|
||
def read(file_path): | ||
"""read json file""" | ||
try: | ||
with open(file_path, 'r', encoding='utf-8') as file: | ||
return json.load(file) | ||
except FileNotFoundError: | ||
return None | ||
except json.JSONDecodeError: | ||
return None | ||
|
||
def write(file_path, data): | ||
"""write json file""" | ||
try: | ||
with open(file_path, 'w', encoding='utf-8') as file: | ||
json.dump(data, file, ensure_ascii=False, indent=4) | ||
except Exception as e: | ||
print(f"Error: 파일 저장 중 오류가 발생했습니다. {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,32 @@ | ||
volume = 10 | ||
import src.utils.json as json | ||
json_file_path = "./setting.json" | ||
def init_file(): | ||
data = {} | ||
data['volume'] = 10 | ||
return data | ||
def change_setting_data(key:str,value): | ||
data = json.read(json_file_path) | ||
if data == None: | ||
data = init_file() | ||
data[key] = value | ||
json.write(json_file_path,data) | ||
reload_setting_file() | ||
def reload_setting_file(): | ||
global volume | ||
data = json.read(json_file_path) | ||
if data == None: | ||
data = init_file() | ||
json.write(json_file_path,data) | ||
volume = data['volume'] | ||
volume = None | ||
loop = False | ||
video_list = [] | ||
SEARCH_PATTERN = r"(?:v=|\/)([0-9A-Za-z_-]{11}).*" | ||
PLAYLIST_SEARCH_PATTERN = r"(?:list=)([A-Za-z0-9_-]{34})" | ||
MESSAGE_DISPLAY_TIME = 2.0 | ||
ASCII_CHARS = ["$", "@", "B", "%", "8", "&", "W", "M", "#", "*", "o", "a", "h", "k", "b", "d", | ||
"p", "q", "w", "m", "Z", "O", "0", "Q", "L", "C", "J", "U", "Y", "X", "z", "c", | ||
"v", "u", "n", "x", "r", "j", "f", "t", "/", "\\", "|", "(", ")", "1", "{", "}", | ||
"[", "]", "?", "-", "_", "+", "~", "<", ">", "i", "!", "l", "I", ";", ":", ",", | ||
"\"", "^", "`", "'", ".", " "] | ||
"\"", "^", "`", "'", ".", " "] | ||
reload_setting_file() |