From 757163c68e167412d7f5d24b12cf9be187c7216f Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Tue, 4 Feb 2025 11:13:25 -0500 Subject: [PATCH] backend: Remove SteamGridDBManager --- bottles/backend/managers/meson.build | 1 - bottles/backend/managers/steamgriddb.py | 54 ------------------------- 2 files changed, 55 deletions(-) delete mode 100644 bottles/backend/managers/steamgriddb.py diff --git a/bottles/backend/managers/meson.build b/bottles/backend/managers/meson.build index f423165c8a7..8772ae1d333 100644 --- a/bottles/backend/managers/meson.build +++ b/bottles/backend/managers/meson.build @@ -5,7 +5,6 @@ bottles_sources = [ '__init__.py', 'manager.py', 'sandbox.py', - 'steamgriddb.py', ] install_data(bottles_sources, install_dir: managersdir) diff --git a/bottles/backend/managers/steamgriddb.py b/bottles/backend/managers/steamgriddb.py deleted file mode 100644 index f87277c9959..00000000000 --- a/bottles/backend/managers/steamgriddb.py +++ /dev/null @@ -1,54 +0,0 @@ -# steamgriddb.py -# -# Copyright 2022 brombinmirko -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, in version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -import os -import uuid -import requests - -from bottles.backend.models.config import BottleConfig -from bottles.backend.utils.manager import ManagerUtils - - -class SteamGridDBManager: - @staticmethod - def get_game_grid(name: str, config: BottleConfig): - try: - res = requests.get(f"https://steamgrid.usebottles.com/api/search/{name}") - except: - return - - if res.status_code == 200: - return SteamGridDBManager.__save_grid(res.json(), config) - - @staticmethod - def __save_grid(url: str, config: BottleConfig): - grids_path = os.path.join(ManagerUtils.get_bottle_path(config), "grids") - if not os.path.exists(grids_path): - os.makedirs(grids_path) - - ext = url.split(".")[-1] - filename = str(uuid.uuid4()) + "." + ext - path = os.path.join(grids_path, filename) - - try: - r = requests.get(url) - with open(path, "wb") as f: - f.write(r.content) - except Exception: - return - - return f"grid:{filename}"