[HOTFIX] Fix platform versions endpoint + run scans sync in DEV_MODE

This commit is contained in:
Georges-Antoine Assi
2025-02-23 23:43:01 -05:00
parent 6cdc467850
commit fd05737f6b
2 changed files with 18 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ from typing import Any, Final
import emoji
import socketio # type: ignore
from config import REDIS_URL, SCAN_TIMEOUT
from config import DEV_MODE, REDIS_URL, SCAN_TIMEOUT
from endpoints.responses.platform import PlatformSchema
from endpoints.responses.rom import SimpleRomSchema
from exceptions.fs_exceptions import (
@@ -545,13 +545,13 @@ async def scan_handler(_sid: str, options: dict):
roms_ids = options.get("roms_ids", [])
metadata_sources = options.get("apis", [])
# Uncomment this to run scan in the current process
# await scan_platforms(
# platform_ids=platform_ids,
# scan_type=scan_type,
# roms_ids=roms_ids,
# metadata_sources=metadata_sources,
# )
if DEV_MODE:
return await scan_platforms(
platform_ids=platform_ids,
scan_type=scan_type,
roms_ids=roms_ids,
metadata_sources=metadata_sources,
)
return high_prio_queue.enqueue(
scan_platforms,

View File

@@ -211,8 +211,9 @@ class IGDBHandler(MetadataHandler):
def __init__(self) -> None:
self.BASE_URL = "https://api.igdb.com/v4"
self.platform_endpoint = f"{self.BASE_URL}/platforms"
self.platform_version_endpoint = f"{self.BASE_URL}/platform_versions"
self.platforms_fields = PLATFORMS_FIELDS
self.platform_version_endpoint = f"{self.BASE_URL}/platform_versions"
self.platform_version_fields = PLATFORMS_VERSION_FIELDS
self.games_endpoint = f"{self.BASE_URL}/games"
self.games_fields = GAMES_FIELDS
self.search_endpoint = f"{self.BASE_URL}/search"
@@ -415,7 +416,7 @@ class IGDBHandler(MetadataHandler):
# Check if platform is a version if not found
platform_versions = await self._request(
self.platform_version_endpoint,
data=f'fields {",".join(self.platforms_fields)}; where slug="{slug.lower()}";',
data=f'fields {",".join(self.platform_version_fields)}; where slug="{slug.lower()}";',
)
version = pydash.get(platform_versions, "[0]", None)
if version:
@@ -747,6 +748,13 @@ PLATFORMS_FIELDS = (
"platform_logo.url",
)
PLATFORMS_VERSION_FIELDS = (
"id",
"name",
"url",
"platform_logo.url",
)
GAMES_FIELDS = (
"id",
"name",