diff --git a/backend/endpoints/responses/search.py b/backend/endpoints/responses/search.py
index ab4c1cb6b..7976f5626 100644
--- a/backend/endpoints/responses/search.py
+++ b/backend/endpoints/responses/search.py
@@ -7,6 +7,7 @@ class SearchRomSchema(BaseModel):
moby_id: int | None = None
ss_id: int | None = None
sgdb_id: int | None = None
+ flashpoint_id: str | None = None
platform_id: int
name: str
slug: str = ""
@@ -15,6 +16,9 @@ class SearchRomSchema(BaseModel):
moby_url_cover: str = ""
ss_url_cover: str = ""
sgdb_url_cover: str = ""
+ flashpoint_url_cover: str = ""
+ is_unidentified: bool
+ is_identified: bool
class SearchCoverSchema(BaseModel):
diff --git a/backend/endpoints/search.py b/backend/endpoints/search.py
index ee1f4fcbb..77221e38c 100644
--- a/backend/endpoints/search.py
+++ b/backend/endpoints/search.py
@@ -13,7 +13,10 @@ from handler.metadata import (
meta_sgdb_handler,
meta_ss_handler,
)
-from handler.metadata.flashpoint_handler import FlashpointRom
+from handler.metadata.flashpoint_handler import (
+ FLASHPOINT_API_ENABLED,
+ FlashpointRom,
+)
from handler.metadata.igdb_handler import IGDB_API_ENABLED, IGDBRom
from handler.metadata.moby_handler import MOBY_API_ENABLED, MobyGamesRom
from handler.metadata.sgdb_handler import STEAMGRIDDB_API_ENABLED, SGDBRom
@@ -52,7 +55,12 @@ async def search_rom(
list[SearchRomSchema]: List of matched roms
"""
- if not IGDB_API_ENABLED and not SS_API_ENABLED and not MOBY_API_ENABLED:
+ if (
+ not IGDB_API_ENABLED
+ and not SS_API_ENABLED
+ and not MOBY_API_ENABLED
+ and not FLASHPOINT_API_ENABLED
+ ):
log.error("Search error: No metadata providers enabled")
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
@@ -126,6 +134,8 @@ async def search_rom(
)
merged_dict[igdb_name] = {
**igdb_rom,
+ "is_identified": True,
+ "is_unidentified": False,
"platform_id": rom.platform_id,
"igdb_url_cover": igdb_rom.pop("url_cover", ""),
**merged_dict.get(igdb_name, {}),
@@ -139,6 +149,8 @@ async def search_rom(
)
merged_dict[moby_name] = {
**moby_rom,
+ "is_identified": True,
+ "is_unidentified": False,
"platform_id": rom.platform_id,
"moby_url_cover": moby_rom.pop("url_cover", ""),
**merged_dict.get(moby_name, {}),
@@ -152,6 +164,8 @@ async def search_rom(
)
merged_dict[ss_name] = {
**ss_rom,
+ "is_identified": True,
+ "is_unidentified": False,
"platform_id": rom.platform_id,
"ss_url_cover": ss_rom.pop("url_cover", ""),
**merged_dict.get(ss_name, {}),
@@ -165,6 +179,8 @@ async def search_rom(
)
merged_dict[flashpoint_name] = {
**flashpoint_rom,
+ "is_identified": True,
+ "is_unidentified": False,
"platform_id": rom.platform_id,
"flashpoint_url_cover": flashpoint_rom.pop("url_cover", ""),
**merged_dict.get(flashpoint_name, {}),
diff --git a/backend/handler/metadata/flashpoint_handler.py b/backend/handler/metadata/flashpoint_handler.py
index d9726a095..b69ee127f 100644
--- a/backend/handler/metadata/flashpoint_handler.py
+++ b/backend/handler/metadata/flashpoint_handler.py
@@ -240,13 +240,18 @@ class FlashpointHandler(MetadataHandler):
log.debug(f"No good match found for '{search_term}' on Flashpoint")
return FlashpointRom(flashpoint_id=None)
- async def get_matched_roms_by_name(self, search_term: str) -> list[FlashpointRom]:
+ async def get_matched_roms_by_name(self, fs_name: str) -> list[FlashpointRom]:
"""
Get ROM information by name from Flashpoint.
"""
+ from handler.filesystem import fs_rom_handler
+
if not FLASHPOINT_API_ENABLED:
return []
+ search_term = fs_rom_handler.get_file_name_with_no_tags(fs_name)
+ search_term = self.normalize_search_term(search_term, remove_punctuation=False)
+
games = await self.search_games(search_term)
return [
FlashpointRom(
diff --git a/frontend/src/__generated__/models/SearchRomSchema.ts b/frontend/src/__generated__/models/SearchRomSchema.ts
index c25ed48cc..79210d02c 100644
--- a/frontend/src/__generated__/models/SearchRomSchema.ts
+++ b/frontend/src/__generated__/models/SearchRomSchema.ts
@@ -8,6 +8,7 @@ export type SearchRomSchema = {
moby_id?: (number | null);
ss_id?: (number | null);
sgdb_id?: (number | null);
+ flashpoint_id?: (string | null);
platform_id: number;
name: string;
slug?: string;
@@ -16,5 +17,8 @@ export type SearchRomSchema = {
moby_url_cover?: string;
ss_url_cover?: string;
sgdb_url_cover?: string;
+ flashpoint_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 a3cd5c573..227f2ed16 100644
--- a/frontend/src/components/common/Game/Card/Base.vue
+++ b/frontend/src/components/common/Game/Card/Base.vue
@@ -99,7 +99,7 @@ const computedAspectRatio = computed(() => {
return parseFloat(ratio.toString());
});
const fallbackCoverImage = computed(() =>
- props.rom.igdb_id || props.rom.moby_id || props.rom.ss_id
+ props.rom.is_identified
? getMissingCoverImage(props.rom.name || props.rom.slug || "")
: getUnmatchedCoverImage(props.rom.name || props.rom.slug || ""),
);
diff --git a/frontend/src/components/common/Game/Card/Sources.vue b/frontend/src/components/common/Game/Card/Sources.vue
index ec897aa61..12ace5d2f 100644
--- a/frontend/src/components/common/Game/Card/Sources.vue
+++ b/frontend/src/components/common/Game/Card/Sources.vue
@@ -48,5 +48,18 @@ defineProps<{ rom: SearchRomSchema }>();
>
+
+
+
+
+
+
+
diff --git a/frontend/src/components/common/Game/Dialog/MatchRom.vue b/frontend/src/components/common/Game/Dialog/MatchRom.vue
index d30bddd43..ac337ba5e 100644
--- a/frontend/src/components/common/Game/Dialog/MatchRom.vue
+++ b/frontend/src/components/common/Game/Dialog/MatchRom.vue
@@ -19,7 +19,7 @@ import { getMissingCoverImage } from "@/utils/covers";
type MatchedSource = {
url_cover: string | undefined;
- name: "IGDB" | "Mobygames" | "Screenscraper" | "SteamGridDB";
+ name: "IGDB" | "Mobygames" | "Screenscraper" | "Flashpoint" | "SteamGridDB";
logo_path: string;
};
@@ -47,6 +47,7 @@ const heartbeat = storeHeartbeat();
const isIGDBFiltered = ref(true);
const isMobyFiltered = ref(true);
const isSSFiltered = ref(true);
+const isFlashpointFiltered = ref(true);
const computedAspectRatio = computed(() => {
const ratio =
platfotmsStore.getAspectRatio(rom.value?.platform_id ?? -1) ||
@@ -60,10 +61,9 @@ emitter?.on("showMatchRomDialog", (romToSearch) => {
// Use name as search term, only when it's matched
// Otherwise use the filename without tags and extensions
- searchText.value =
- romToSearch.igdb_id || romToSearch.moby_id || romToSearch.ss_id
- ? (romToSearch.name ?? "")
- : romToSearch.fs_name_no_tags;
+ searchText.value = romToSearch.is_identified
+ ? (romToSearch.name ?? "")
+ : romToSearch.fs_name_no_tags;
});
const missingCoverImage = computed(() =>
getMissingCoverImage(rom.value?.name || rom.value?.fs_name || ""),
@@ -82,12 +82,18 @@ function toggleSourceFilter(source: MatchedSource["name"]) {
heartbeat.value.METADATA_SOURCES.SS_API_ENABLED
) {
isSSFiltered.value = !isSSFiltered.value;
+ } else if (
+ source == "Flashpoint" &&
+ heartbeat.value.METADATA_SOURCES.FLASHPOINT_API_ENABLED
+ ) {
+ isFlashpointFiltered.value = !isFlashpointFiltered.value;
}
filteredMatchedRoms.value = matchedRoms.value.filter((rom) => {
if (
(rom.igdb_id && isIGDBFiltered.value) ||
(rom.moby_id && isMobyFiltered.value) ||
- (rom.ss_id && isSSFiltered.value)
+ (rom.ss_id && isSSFiltered.value) ||
+ (rom.flashpoint_id && isFlashpointFiltered.value)
) {
return true;
}
@@ -117,7 +123,8 @@ async function searchRom() {
if (
(rom.igdb_id && isIGDBFiltered.value) ||
(rom.moby_id && isMobyFiltered.value) ||
- (rom.ss_id && isSSFiltered.value)
+ (rom.ss_id && isSSFiltered.value) ||
+ (rom.flashpoint_id && isFlashpointFiltered.value)
) {
return true;
}
@@ -175,6 +182,13 @@ function showSources(matchedRom: SearchRomSchema) {
logo_path: "/assets/scrappers/sgdb.png",
});
}
+ if (matchedRom.flashpoint_url_cover) {
+ sources.value.push({
+ url_cover: matchedRom.flashpoint_url_cover,
+ name: "Flashpoint",
+ logo_path: "/assets/scrappers/flashpoint.png",
+ });
+ }
if (sources.value.length == 1) {
selectedCover.value = sources.value[0];
}
@@ -232,6 +246,7 @@ async function updateRom(
selectedRom.igdb_url_cover ||
selectedRom.ss_url_cover ||
selectedRom.moby_url_cover ||
+ selectedRom.flashpoint_url_cover ||
null,
};
@@ -379,6 +394,35 @@ onBeforeUnmount(() => {
+
+
+
+
+
+
diff --git a/frontend/src/services/api/rom.ts b/frontend/src/services/api/rom.ts
index e554f1faf..ab5f1b6c4 100644
--- a/frontend/src/services/api/rom.ts
+++ b/frontend/src/services/api/rom.ts
@@ -253,6 +253,8 @@ async function updateRom({
if (rom.ss_id) formData.append("ss_id", rom.ss_id.toString());
if (rom.launchbox_id)
formData.append("launchbox_id", rom.launchbox_id.toString());
+ if (rom.flashpoint_id)
+ formData.append("flashpoint_id", rom.flashpoint_id.toString());
formData.append("name", rom.name || "");
formData.append("fs_name", rom.fs_name);
formData.append("summary", rom.summary || "");