mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 14:56:01 +00:00
feat(pm_handler): allow disabling playmatch via env
This commit is contained in:
@@ -72,6 +72,9 @@ REFRESH_RETROACHIEVEMENTS_CACHE_DAYS: Final = int(
|
||||
os.environ.get("REFRESH_RETROACHIEVEMENTS_CACHE_DAYS", 30)
|
||||
)
|
||||
|
||||
# PLAYMATCH
|
||||
PLAYMATCH_ENABLED: Final = str_to_bool(os.environ.get("PLAYMATCH_ENABLED", "true"))
|
||||
|
||||
# MOBYGAMES
|
||||
MOBYGAMES_API_KEY: Final = os.environ.get("MOBYGAMES_API_KEY", "").strip()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from enum import Enum
|
||||
from typing import NotRequired, Optional, TypedDict, cast
|
||||
from typing import Final, NotRequired, Optional, TypedDict, cast
|
||||
|
||||
import httpx
|
||||
import yarl
|
||||
@@ -7,6 +7,10 @@ from fastapi import HTTPException, status
|
||||
from logger.logger import log
|
||||
from utils.context import ctx_httpx_client
|
||||
|
||||
from backend.config import PLAYMATCH_ENABLED
|
||||
|
||||
PM_ENABLED: Final = bool(PLAYMATCH_ENABLED)
|
||||
|
||||
|
||||
class PlaymatchProvider(str, Enum):
|
||||
"""
|
||||
@@ -72,6 +76,10 @@ class PlaymatchHandler:
|
||||
:return: The IGDB provider ID if a match is found, otherwise None.
|
||||
:raises HTTPException: If the request fails or the service is unavailable.
|
||||
"""
|
||||
if not PM_ENABLED:
|
||||
log.debug("Playmatch is not enabled, skipping identification.")
|
||||
return None
|
||||
|
||||
url = f"{self.base_url}/identify/ids"
|
||||
|
||||
response = await self._request(
|
||||
|
||||
@@ -21,6 +21,9 @@ SCREENSCRAPER_PASSWORD=
|
||||
# SteamGridDB
|
||||
STEAMGRIDDB_API_KEY=
|
||||
|
||||
# Playmatch
|
||||
PLAYMATCH_ENABLED=
|
||||
|
||||
# RetroAchievements
|
||||
RETROACHIEVEMENTS_API_KEY=
|
||||
|
||||
|
||||
Reference in New Issue
Block a user