From dbf1a7d20b93fcb1bb6cdb3ca060b4164c296ce4 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Fri, 17 Oct 2025 09:18:33 -0400 Subject: [PATCH] [ROMM-2554] Remove htlb from manual search --- backend/endpoints/responses/search.py | 2 - backend/endpoints/rom.py | 9 ---- backend/endpoints/search.py | 21 -------- backend/handler/metadata/hltb_handler.py | 46 ---------------- .../__generated__/models/SearchRomSchema.ts | 2 - .../src/components/common/Game/Card/Base.vue | 6 +-- .../components/common/Game/Card/Sources.vue | 19 ------- .../common/Game/Dialog/MatchRom.vue | 52 ++----------------- frontend/src/services/api/rom.ts | 1 - 9 files changed, 5 insertions(+), 153 deletions(-) diff --git a/backend/endpoints/responses/search.py b/backend/endpoints/responses/search.py index e13c720dd..ca4983cf8 100644 --- a/backend/endpoints/responses/search.py +++ b/backend/endpoints/responses/search.py @@ -11,7 +11,6 @@ class SearchRomSchema(BaseModel): sgdb_id: int | None = None flashpoint_id: str | None = None launchbox_id: int | None = None - hltb_id: int | None = None platform_id: int name: str slug: str = "" @@ -22,7 +21,6 @@ class SearchRomSchema(BaseModel): sgdb_url_cover: str = "" flashpoint_url_cover: str = "" launchbox_url_cover: str = "" - hltb_url_cover: str = "" is_unidentified: bool is_identified: bool diff --git a/backend/endpoints/rom.py b/backend/endpoints/rom.py index 355b28fc6..5308aee1d 100644 --- a/backend/endpoints/rom.py +++ b/backend/endpoints/rom.py @@ -53,7 +53,6 @@ from handler.filesystem import fs_resource_handler, fs_rom_handler from handler.filesystem.base_handler import CoverSize from handler.metadata import ( meta_flashpoint_handler, - meta_hltb_handler, meta_igdb_handler, meta_launchbox_handler, meta_moby_handler, @@ -739,16 +738,8 @@ async def update_rom( "ss_id": data.get("ss_id", rom.ss_id), "launchbox_id": data.get("launchbox_id", rom.launchbox_id), "flashpoint_id": data.get("flashpoint_id", rom.flashpoint_id), - "hltb_id": data.get("hltb_id", rom.hltb_id), } - if ( - cleaned_data.get("hltb_id", "") - and int(cleaned_data.get("hltb_id", "")) != rom.hltb_id - ): - hltb_rom = await meta_hltb_handler.get_rom_by_id(cleaned_data["hltb_id"]) - cleaned_data.update(hltb_rom) - if ( cleaned_data.get("flashpoint_id", "") and cleaned_data.get("flashpoint_id", "") != rom.flashpoint_id diff --git a/backend/endpoints/search.py b/backend/endpoints/search.py index 41c65592e..0d958f51f 100644 --- a/backend/endpoints/search.py +++ b/backend/endpoints/search.py @@ -9,7 +9,6 @@ from handler.auth.constants import Scope from handler.database import db_rom_handler from handler.metadata import ( meta_flashpoint_handler, - meta_hltb_handler, meta_igdb_handler, meta_launchbox_handler, meta_moby_handler, @@ -17,7 +16,6 @@ from handler.metadata import ( meta_ss_handler, ) from handler.metadata.flashpoint_handler import FlashpointRom -from handler.metadata.hltb_handler import HLTBRom from handler.metadata.igdb_handler import IGDBRom from handler.metadata.launchbox_handler import LaunchboxRom from handler.metadata.moby_handler import MobyGamesRom @@ -63,7 +61,6 @@ async def search_rom( and not meta_moby_handler.is_enabled() and not meta_flashpoint_handler.is_enabled() and not meta_launchbox_handler.is_enabled() - and not meta_hltb_handler.is_enabled() ): log.error("Search error: No metadata providers enabled") raise HTTPException( @@ -94,7 +91,6 @@ async def search_rom( ss_matched_roms: list[SSRom] = [] flashpoint_matched_roms: list[FlashpointRom] = [] launchbox_matched_roms: list[LaunchboxRom] = [] - hltb_matched_roms: list[HLTBRom] = [] if search_by.lower() == "id": try: @@ -120,7 +116,6 @@ async def search_rom( ss_matched_roms, flashpoint_matched_roms, launchbox_matched_roms, - hltb_matched_roms, ) = await asyncio.gather( meta_igdb_handler.get_matched_roms_by_name( search_term, get_main_platform_igdb_id(rom.platform) @@ -135,7 +130,6 @@ async def search_rom( meta_launchbox_handler.get_matched_roms_by_name( search_term, rom.platform.slug ), - meta_hltb_handler.get_matched_roms_by_name(search_term, rom.platform.slug), ) merged_dict: dict[str, dict] = {} @@ -215,21 +209,6 @@ async def search_rom( **merged_dict.get(launchbox_name, {}), } - for hltb_rom in hltb_matched_roms: - if hltb_rom["hltb_id"]: - hltb_name = meta_hltb_handler.normalize_search_term( - hltb_rom.get("name", ""), - remove_articles=False, - ) - merged_dict[hltb_name] = { - **hltb_rom, - "is_identified": True, - "is_unidentified": False, - "platform_id": rom.platform_id, - "hltb_url_cover": hltb_rom.pop("url_cover", ""), - **merged_dict.get(hltb_name, {}), - } - async def get_sgdb_rom(name: str) -> tuple[str, SGDBRom]: return name, await meta_sgdb_handler.get_details_by_names([name]) diff --git a/backend/handler/metadata/hltb_handler.py b/backend/handler/metadata/hltb_handler.py index 210e7738d..db0fe7245 100644 --- a/backend/handler/metadata/hltb_handler.py +++ b/backend/handler/metadata/hltb_handler.py @@ -212,14 +212,6 @@ class HowLongToBeatHandler(MetadataHandler): return True - @staticmethod - def extract_hltb_id_from_filename(fs_name: str) -> int | None: - """Extract HLTB ID from filename tag like (hltb-12345).""" - match = HLTB_TAG_REGEX.search(fs_name) - if match: - return int(match.group(1)) - return None - async def _request(self, url: str, payload: dict) -> dict: """ Sends a POST request to HowLongToBeat API. @@ -386,21 +378,6 @@ class HowLongToBeatHandler(MetadataHandler): if not HLTB_API_ENABLED: return HLTBRom(hltb_id=None) - # Check for HLTB ID tag in filename first - hltb_id_from_tag = self.extract_hltb_id_from_filename(fs_name) - if hltb_id_from_tag: - log.debug(f"Found HLTB ID tag in filename: {hltb_id_from_tag}") - rom_by_id = await self.get_rom_by_id(hltb_id_from_tag) - if rom_by_id["hltb_id"]: - log.debug( - f"Successfully matched ROM by HLTB ID tag: {fs_name} -> {hltb_id_from_tag}" - ) - return rom_by_id - else: - log.warning( - f"HLTB ID tag found but no match: {fs_name} -> {hltb_id_from_tag}" - ) - # We replace " - " with ": " to match HowLongToBeat's naming convention search_term = fs_rom_handler.get_file_name_with_no_tags(fs_name).replace( " - ", ": " @@ -493,29 +470,6 @@ class HowLongToBeatHandler(MetadataHandler): return roms - async def get_rom_by_id(self, hltb_id: int) -> HLTBRom: - """ - Get ROM information by HowLongToBeat ID. - Note: HLTB doesn't have a direct "get by ID" endpoint, - so this method searches by the game name if we can find it. - - :param hltb_id: The HowLongToBeat game ID. - :return: A HLTBRom object. - """ - if not HLTB_API_ENABLED: - return HLTBRom(hltb_id=None) - - if not hltb_id: - return HLTBRom(hltb_id=None) - - # Unfortunately, HLTB doesn't provide a direct "get by ID" endpoint - # This is a limitation of their API - we would need to search and filter - # In practice, this method might not be very useful for HLTB - log.debug( - f"get_rom_by_id not fully supported for HowLongToBeat (ID: {hltb_id})" - ) - return HLTBRom(hltb_id=hltb_id) - async def price_check( self, hltb_id: int, steam_id: int = 0, itch_id: int = 0 ) -> HLTBPriceCheckResponse | None: diff --git a/frontend/src/__generated__/models/SearchRomSchema.ts b/frontend/src/__generated__/models/SearchRomSchema.ts index 7849d6ef3..b72f97950 100644 --- a/frontend/src/__generated__/models/SearchRomSchema.ts +++ b/frontend/src/__generated__/models/SearchRomSchema.ts @@ -10,7 +10,6 @@ export type SearchRomSchema = { sgdb_id?: (number | null); flashpoint_id?: (string | null); launchbox_id?: (number | null); - hltb_id?: (number | null); platform_id: number; name: string; slug?: string; @@ -21,7 +20,6 @@ export type SearchRomSchema = { sgdb_url_cover?: string; flashpoint_url_cover?: string; launchbox_url_cover?: string; - hltb_url_cover?: string; is_unidentified: boolean; is_identified: boolean; }; diff --git a/frontend/src/components/common/Game/Card/Base.vue b/frontend/src/components/common/Game/Card/Base.vue index 33d079f0d..a9d9a1c77 100644 --- a/frontend/src/components/common/Game/Card/Base.vue +++ b/frontend/src/components/common/Game/Card/Base.vue @@ -154,8 +154,7 @@ const largeCover = computed(() => { props.rom.moby_url_cover || props.rom.ss_url_cover || props.rom.launchbox_url_cover || - props.rom.flashpoint_url_cover || - props.rom.hltb_url_cover + props.rom.flashpoint_url_cover ); const pathCoverLarge = isWebpEnabled.value ? props.rom.path_cover_large?.replace(EXTENSION_REGEX, ".webp") @@ -270,8 +269,7 @@ onBeforeUnmount(() => { !rom.ss_url_cover && !rom.sgdb_url_cover && !rom.launchbox_url_cover && - !rom.flashpoint_url_cover && - !rom.hltb_url_cover) + !rom.flashpoint_url_cover) " class="translucent text-white" :class=" diff --git a/frontend/src/components/common/Game/Card/Sources.vue b/frontend/src/components/common/Game/Card/Sources.vue index 36123caff..1fa4ca8a4 100644 --- a/frontend/src/components/common/Game/Card/Sources.vue +++ b/frontend/src/components/common/Game/Card/Sources.vue @@ -101,24 +101,5 @@ defineProps<{ rom: SearchRomSchema }>(); - - - diff --git a/frontend/src/components/common/Game/Dialog/MatchRom.vue b/frontend/src/components/common/Game/Dialog/MatchRom.vue index 2442420e7..bd53e7295 100644 --- a/frontend/src/components/common/Game/Dialog/MatchRom.vue +++ b/frontend/src/components/common/Game/Dialog/MatchRom.vue @@ -25,7 +25,6 @@ type MatchedSource = { | "Screenscraper" | "Flashpoint" | "Launchbox" - | "HowLongToBeat" | "SteamGridDB"; logo_path: string; }; @@ -56,7 +55,6 @@ const isMobyFiltered = ref(true); const isSSFiltered = ref(true); const isFlashpointFiltered = ref(true); const isLaunchboxFiltered = ref(true); -const isHLTBFiltered = ref(true); const computedAspectRatio = computed(() => { const ratio = platfotmsStore.getAspectRatio(rom.value?.platform_id ?? -1) || @@ -101,20 +99,15 @@ function toggleSourceFilter(source: MatchedSource["name"]) { heartbeat.value.METADATA_SOURCES.LAUNCHBOX_API_ENABLED ) { isLaunchboxFiltered.value = !isLaunchboxFiltered.value; - } else if ( - source == "HowLongToBeat" && - heartbeat.value.METADATA_SOURCES.HLTB_API_ENABLED - ) { - isHLTBFiltered.value = !isHLTBFiltered.value; } + filteredMatchedRoms.value = matchedRoms.value.filter((rom) => { if ( (rom.igdb_id && isIGDBFiltered.value) || (rom.moby_id && isMobyFiltered.value) || (rom.ss_id && isSSFiltered.value) || (rom.flashpoint_id && isFlashpointFiltered.value) || - (rom.launchbox_id && isLaunchboxFiltered.value) || - (rom.hltb_id && isHLTBFiltered.value) + (rom.launchbox_id && isLaunchboxFiltered.value) ) { return true; } @@ -146,8 +139,7 @@ async function searchRom() { (rom.moby_id && isMobyFiltered.value) || (rom.ss_id && isSSFiltered.value) || (rom.flashpoint_id && isFlashpointFiltered.value) || - (rom.launchbox_id && isLaunchboxFiltered.value) || - (rom.hltb_id && isHLTBFiltered.value) + (rom.launchbox_id && isLaunchboxFiltered.value) ) { return true; } @@ -219,13 +211,6 @@ function showSources(matchedRom: SearchRomSchema) { logo_path: "/assets/scrappers/launchbox.png", }); } - if (matchedRom.hltb_url_cover) { - sources.value.push({ - url_cover: matchedRom.hltb_url_cover, - name: "HowLongToBeat", - logo_path: "/assets/scrappers/hltb.png", - }); - } if (sources.value.length == 1) { selectedCover.value = sources.value[0]; } @@ -277,7 +262,6 @@ async function updateRom( moby_id: selectedRom.moby_id || null, flashpoint_id: selectedRom.flashpoint_id || null, launchbox_id: selectedRom.launchbox_id || null, - hltb_id: selectedRom.hltb_id || null, name: selectedRom.name || null, slug: selectedRom.slug || null, summary: selectedRom.summary || null, @@ -288,7 +272,6 @@ async function updateRom( selectedRom.moby_url_cover || selectedRom.flashpoint_url_cover || selectedRom.launchbox_url_cover || - selectedRom.hltb_url_cover || null, }; @@ -500,35 +483,6 @@ onBeforeUnmount(() => { - -