Skip to content

Commit 3e16a43

Browse files
committed
cleanup
1 parent 15d945a commit 3e16a43

3 files changed

Lines changed: 22 additions & 30 deletions

File tree

backend/handler/metadata/hasheous_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class HasheousRom(BaseRom):
6060
ra_id: NotRequired[int | None]
6161
ra_metadata: NotRequired[RAMetadata]
6262
tgdb_id: NotRequired[int | None]
63+
ss_id: NotRequired[int | None]
6364
hasheous_metadata: NotRequired[HasheousMetadata]
6465

6566

@@ -431,7 +432,7 @@ def _jeu_to_ss_rom(self, rom: Rom, response: dict) -> SSRom:
431432
return build_ss_game(rom, jeu)
432433

433434
async def get_ss_game(
434-
self, rom: Rom, platform_ss_id: int, files: list[RomFile]
435+
self, rom: Rom, platform_ss_id: int | None, files: list[RomFile]
435436
) -> SSRom:
436437
"""Fetch ScreenScraper metadata for a ROM through the Hasheous proxy.
437438

backend/handler/scan_handler.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,9 @@ async def fetch_hasheous_hash_match() -> HasheousRom:
444444
platform.slug, get_match_files()
445445
)
446446

447-
return HasheousRom(hasheous_id=None, igdb_id=None, tgdb_id=None, ra_id=None)
447+
return HasheousRom(
448+
hasheous_id=None, igdb_id=None, tgdb_id=None, ra_id=None, ss_id=None
449+
)
448450

449451
_added_rom = db_rom_handler.add_rom(Rom(**rom_attrs))
450452
_added_rom.is_identifying = True
@@ -640,17 +642,9 @@ async def fetch_moby_rom(playmatch_rom: PlaymatchRomMatch) -> MobyGamesRom:
640642
return MobyGamesRom(moby_id=None)
641643

642644
async def fetch_ss_rom(playmatch_rom: PlaymatchRomMatch) -> SSRom:
643-
# When the user has no ScreenScraper credentials, fall back to fetching
644-
# ScreenScraper metadata through the Hasheous proxy (credential-free).
645-
ss_via_hasheous = (
646-
not meta_ss_handler.is_enabled()
647-
and meta_hasheous_handler.is_enabled()
648-
and rom.platform_slug in HASHEOUS_PLATFORM_LIST
649-
)
650645
if (
651646
MetadataSource.SS in metadata_sources
652647
and platform.ss_id
653-
and (meta_ss_handler.is_enabled() or ss_via_hasheous)
654648
and (
655649
newly_added
656650
or scan_type == ScanType.COMPLETE
@@ -662,12 +656,12 @@ async def fetch_ss_rom(playmatch_rom: PlaymatchRomMatch) -> SSRom:
662656
)
663657
)
664658
):
665-
if ss_via_hasheous:
666-
if scan_type == ScanType.UPDATE and rom.ss_id:
667-
return await meta_hasheous_handler.get_ss_rom_by_id(rom, rom.ss_id)
668-
return await meta_hasheous_handler.get_ss_game(
669-
rom, platform.ss_id, get_match_files()
670-
)
659+
# if ss_via_hasheous:
660+
# if scan_type == ScanType.UPDATE and rom.ss_id:
661+
# return await meta_hasheous_handler.get_ss_rom_by_id(rom, rom.ss_id)
662+
# return await meta_hasheous_handler.get_ss_game(
663+
# rom, platform.ss_id, get_match_files()
664+
# )
671665

672666
# Use the ID to refetch metadata
673667
if scan_type == ScanType.UPDATE and rom.ss_id:
@@ -815,20 +809,20 @@ async def fetch_hasheous_rom(hasheous_rom: HasheousRom) -> HasheousRom:
815809
(
816810
igdb_game,
817811
ra_game,
812+
ss_game,
818813
) = await asyncio.gather(
819814
meta_hasheous_handler.get_igdb_game(hasheous_rom),
820815
meta_hasheous_handler.get_ra_game(hasheous_rom),
816+
meta_hasheous_handler.get_ss_game(
817+
rom, platform.ss_id, get_match_files()
818+
),
821819
)
822820

823-
return HasheousRom(
824-
{
825-
**hasheous_rom,
826-
**ra_game,
827-
**igdb_game,
828-
}
829-
)
821+
return HasheousRom({**hasheous_rom, **ra_game, **igdb_game, **ss_game})
830822

831-
return HasheousRom(hasheous_id=None, igdb_id=None, tgdb_id=None, ra_id=None)
823+
return HasheousRom(
824+
hasheous_id=None, igdb_id=None, tgdb_id=None, ra_id=None, ss_id=None
825+
)
832826

833827
# Run metadata fetches concurrently
834828
(

frontend/src/stores/heartbeat.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,9 @@ export default defineStore("heartbeat", {
144144
name: "Screenscraper",
145145
value: "ss",
146146
logo_path: "/assets/scrappers/ss.png",
147-
// Usable with own credentials, or credential-free via the Hasheous proxy.
148-
disabled:
149-
!this.value.METADATA_SOURCES?.SS_API_ENABLED &&
150-
!this.value.METADATA_SOURCES?.HASHEOUS_API_ENABLED
151-
? i18n.global.t("scan.api-key-missing")
152-
: "",
147+
disabled: !this.value.METADATA_SOURCES?.SS_API_ENABLED
148+
? i18n.global.t("scan.api-key-missing")
149+
: "",
153150
},
154151
{
155152
name: "Mobygames",

0 commit comments

Comments
 (0)