From 0db636b375dc8ee1e91ae1ba05ba7c860084842f Mon Sep 17 00:00:00 2001 From: kramo <93832451+kra-mo@users.noreply.github.com> Date: Sat, 10 Jun 2023 19:13:25 +0200 Subject: [PATCH] Port bottles fix from main --- src/importer/sources/bottles_source.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/importer/sources/bottles_source.py b/src/importer/sources/bottles_source.py index d77bee3..b664651 100644 --- a/src/importer/sources/bottles_source.py +++ b/src/importer/sources/bottles_source.py @@ -41,11 +41,20 @@ class BottlesSourceIterator(SourceIterator): game = Game(values, allow_side_effects=False) # Get official cover path + try: + # This will not work if both Cartridges and Bottles are installed via Flatpak + # as Cartridges can't access directories picked via Bottles' file picker portal + bottles_location = Path( + yaml.safe_load( + (self.source.location / "data.yml").read_text("utf-8") + )["custom_bottles_path"] + ) + except (FileNotFoundError, KeyError): + bottles_location = self.source.location / "bottles" + bottle_path = entry["bottle"]["path"] image_name = entry["thumbnail"].split(":")[1] - image_path = ( - self.source.location / "bottles" / bottle_path / "grids" / image_name - ) + image_path = bottles_location / bottle_path / "grids" / image_name additional_data = {"local_image_path": image_path} # Produce game