mirror of
https://github.com/csd4ni3l/music-player.git
synced 2026-01-01 04:03:42 +01:00
Fix files not being opened with utf-8 encoding
This commit is contained in:
@@ -18,7 +18,7 @@ class AddMusic(arcade.gui.UIView):
|
||||
self.loaded_sounds = loaded_sounds
|
||||
self.shuffle = shuffle
|
||||
|
||||
with open("settings.json", "r") as file:
|
||||
with open("settings.json", "r", encoding="utf-8") as file:
|
||||
self.settings_dict = json.load(file)
|
||||
|
||||
self.playlists = self.settings_dict.get("playlists", {})
|
||||
@@ -60,7 +60,7 @@ class AddMusic(arcade.gui.UIView):
|
||||
self.playlists[playlist].append(os.path.expanduser(music_path))
|
||||
self.settings_dict["playlists"] = self.playlists
|
||||
|
||||
with open("settings.json", "w") as file:
|
||||
with open("settings.json", "w", encoding="utf-8") as file:
|
||||
file.write(json.dumps(self.settings_dict))
|
||||
|
||||
def main_exit(self):
|
||||
|
||||
@@ -24,7 +24,7 @@ class Downloader(arcade.gui.UIView):
|
||||
self.pypresence_client = pypresence_client
|
||||
self.pypresence_client.update(state="Downloading music", start=self.pypresence_client.start_time)
|
||||
|
||||
with open("settings.json", "r") as file:
|
||||
with open("settings.json", "r", encoding="utf-8") as file:
|
||||
self.settings_dict = json.load(file)
|
||||
|
||||
self.tab_options = self.settings_dict.get("tab_options", ["~/Music", "~/Downloads"])
|
||||
@@ -88,7 +88,7 @@ class Downloader(arcade.gui.UIView):
|
||||
return None
|
||||
|
||||
try:
|
||||
with open("downloaded_music.mp3.info.json", "r") as file:
|
||||
with open("downloaded_music.mp3.info.json", "r", encoding="utf-8") as file:
|
||||
info = json.load(file)
|
||||
return info
|
||||
except (json.JSONDecodeError, OSError):
|
||||
|
||||
@@ -18,7 +18,7 @@ class Main(arcade.gui.UIView):
|
||||
super().__init__()
|
||||
self.pypresence_client = pypresence_client
|
||||
|
||||
with open("settings.json", "r") as file:
|
||||
with open("settings.json", "r", encoding="utf-8") as file:
|
||||
self.settings_dict = json.load(file)
|
||||
|
||||
if self.settings_dict.get('discord_rpc', True):
|
||||
|
||||
@@ -18,7 +18,7 @@ class NewTab(arcade.gui.UIView):
|
||||
self.loaded_sounds = loaded_sounds
|
||||
self.shuffle = shuffle
|
||||
|
||||
with open("settings.json", "r") as file:
|
||||
with open("settings.json", "r", encoding="utf-8") as file:
|
||||
self.settings_dict = json.load(file)
|
||||
|
||||
self.tab_options = self.settings_dict.get("tab_options", ["~/Music", "~/Downloads"])
|
||||
@@ -69,7 +69,7 @@ class NewTab(arcade.gui.UIView):
|
||||
self.playlists[self.new_tab_input.text] = []
|
||||
self.settings_dict["playlists"] = self.playlists
|
||||
|
||||
with open("settings.json", "w") as file:
|
||||
with open("settings.json", "w", encoding="utf-8") as file:
|
||||
file.write(json.dumps(self.settings_dict))
|
||||
|
||||
def main_exit(self):
|
||||
|
||||
@@ -20,7 +20,7 @@ class Settings(arcade.gui.UIView):
|
||||
self.loaded_sounds = loaded_sounds
|
||||
self.shuffle = shuffle
|
||||
|
||||
with open("settings.json", "r") as file:
|
||||
with open("settings.json", "r", encoding="utf-8") as file:
|
||||
self.settings_dict = json.load(file)
|
||||
|
||||
self.pypresence_client = pypresence_client
|
||||
@@ -213,7 +213,7 @@ class Settings(arcade.gui.UIView):
|
||||
|
||||
self.display_category(self.current_category)
|
||||
|
||||
with open("settings.json", "w") as file:
|
||||
with open("settings.json", "w", encoding="utf-8") as file:
|
||||
file.write(json.dumps(self.settings_dict, indent=4))
|
||||
|
||||
def update(self, setting=None, button_state=None, setting_type="bool"):
|
||||
@@ -261,7 +261,7 @@ class Settings(arcade.gui.UIView):
|
||||
self.key_layout.clear()
|
||||
self.value_layout.clear()
|
||||
|
||||
with open('CREDITS', 'r') as file:
|
||||
with open('CREDITS', 'r', encoding="utf-8") as file:
|
||||
text = file.read()
|
||||
|
||||
if self.window.width == 3840:
|
||||
|
||||
2
run.py
2
run.py
@@ -67,7 +67,7 @@ else:
|
||||
"discord_rpc": True
|
||||
}
|
||||
|
||||
with open("settings.json", "w") as file:
|
||||
with open("settings.json", "w", encoding="utf-8") as file:
|
||||
file.write(json.dumps(settings))
|
||||
|
||||
window = ControllerWindow(width=resolution[0], height=resolution[1], title='Music Player', samples=antialiasing, antialiasing=antialiasing > 0, fullscreen=fullscreen, vsync=vsync, resizable=False, style=style)
|
||||
|
||||
Reference in New Issue
Block a user