Use utf-8 everywhere
This commit is contained in:
@@ -110,7 +110,7 @@ class game(Gtk.Box): # pylint: disable=invalid-name
|
||||
if not games_dir.exists():
|
||||
return
|
||||
|
||||
data = json.loads((games_dir / f"{self.game_id}.json").read_text())
|
||||
data = json.loads((games_dir / f"{self.game_id}.json").read_text("utf-8"))
|
||||
|
||||
data["hidden"] = not data["hidden"]
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ def bottles_parser(parent_widget):
|
||||
bottles_dir = Path(schema.get_string("bottles-location")).expanduser()
|
||||
current_time = int(time())
|
||||
|
||||
data = (bottles_dir / "library.yml").read_text()
|
||||
data = (bottles_dir / "library.yml").read_text("utf-8")
|
||||
|
||||
library = yaml.load(data, Loader=yaml.Loader)
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ def create_details_window(parent_widget, game_id=None):
|
||||
path = parent_widget.data_dir / "cartridges" / "games" / f"{game_id}.json"
|
||||
|
||||
if path.exists():
|
||||
data = json.loads(path.read_text())
|
||||
data = json.loads(path.read_text("utf-8"))
|
||||
data.update(values)
|
||||
save_game(parent_widget, data)
|
||||
else:
|
||||
|
||||
@@ -33,7 +33,7 @@ def get_games(parent_widget, game_ids=None):
|
||||
game_files = games_dir.iterdir()
|
||||
|
||||
for game in game_files:
|
||||
data = json.loads(game.read_text())
|
||||
data = json.loads(game.read_text("utf-8"))
|
||||
games[data["game_id"]] = data
|
||||
|
||||
return games
|
||||
|
||||
@@ -58,7 +58,7 @@ def heroic_parser(parent_widget):
|
||||
if not schema.get_boolean("heroic-import-epic"):
|
||||
pass
|
||||
elif (heroic_dir / "lib-cache" / "library.json").exists():
|
||||
data = (heroic_dir / "lib-cache" / "library.json").read_text()
|
||||
data = (heroic_dir / "lib-cache" / "library.json").read_text("utf-8")
|
||||
library = json.loads(data)
|
||||
|
||||
try:
|
||||
@@ -111,7 +111,7 @@ def heroic_parser(parent_widget):
|
||||
if not schema.get_boolean("heroic-import-gog"):
|
||||
pass
|
||||
elif (heroic_dir / "gog_store" / "installed.json").exists():
|
||||
data = (heroic_dir / "gog_store" / "installed.json").read_text()
|
||||
data = (heroic_dir / "gog_store" / "installed.json").read_text("utf-8")
|
||||
installed = json.loads(data)
|
||||
|
||||
importer.total_queue += len(installed["installed"])
|
||||
@@ -131,7 +131,7 @@ def heroic_parser(parent_widget):
|
||||
continue
|
||||
|
||||
# Get game title and developer from library.json as they are not present in installed.json
|
||||
data = (heroic_dir / "gog_store" / "library.json").read_text()
|
||||
data = (heroic_dir / "gog_store" / "library.json").read_text("utf-8")
|
||||
library = json.loads(data)
|
||||
for game in library["games"]:
|
||||
if game["app_name"] == app_name:
|
||||
@@ -162,7 +162,7 @@ def heroic_parser(parent_widget):
|
||||
if not schema.get_boolean("heroic-import-sideload"):
|
||||
pass
|
||||
elif (heroic_dir / "sideload_apps" / "library.json").exists():
|
||||
data = (heroic_dir / "sideload_apps" / "library.json").read_text()
|
||||
data = (heroic_dir / "sideload_apps" / "library.json").read_text("utf-8")
|
||||
library = json.loads(data)
|
||||
|
||||
importer.total_queue += len(library["games"])
|
||||
|
||||
@@ -26,5 +26,5 @@ def save_game(parent_widget, game):
|
||||
games_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
(games_dir / f'{game["game_id"]}.json').write_text(
|
||||
json.dumps(game, indent=4, sort_keys=True)
|
||||
json.dumps(game, indent=4, sort_keys=True), "utf-8"
|
||||
)
|
||||
|
||||
@@ -46,7 +46,7 @@ def get_game(
|
||||
):
|
||||
values = {}
|
||||
|
||||
data = appmanifest.read_text()
|
||||
data = appmanifest.read_text("utf-8")
|
||||
for datatype in datatypes:
|
||||
value = re.findall(f'"{datatype}"\t\t"(.*)"\n', data)
|
||||
values[datatype] = value[0]
|
||||
|
||||
Reference in New Issue
Block a user