Skip to content

Commit e473cbe

Browse files
committed
Move url_cover checks to scan_handler
1 parent fe65a0a commit e473cbe

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

backend/endpoints/rom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ async def update_rom(
737737

738738
cleaned_data.update(
739739
{
740-
"url_cover": f"http://local.internal/{path_cover_s}", # Fake url_cover to avoid overwriting
740+
"url_cover": "",
741741
"path_cover_s": path_cover_s,
742742
"path_cover_l": path_cover_l,
743743
}

backend/handler/scan_handler.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -675,13 +675,20 @@ async def fetch_hasheous_rom(hasheous_rom: HasheousRom) -> HasheousRom:
675675
if field_value:
676676
rom_attrs[field] = field_value
677677

678-
# Don't overwrite existing base fields on partial scans
679-
if not newly_added and scan_type == ScanType.PARTIAL:
678+
# Don't overwrite existing base fields on partial and unidentified scans
679+
if not newly_added and (
680+
scan_type == ScanType.PARTIAL or scan_type == ScanType.UNIDENTIFIED
681+
):
680682
rom_attrs.update(
681683
{
682684
"name": rom.name or rom_attrs.get("name") or None,
683685
"summary": rom.summary or rom_attrs.get("summary") or None,
684-
"url_cover": rom.url_cover or rom_attrs.get("url_cover") or None,
686+
# Don't overwrite existing manually uploaded cover image
687+
"url_cover": (
688+
rom.url_cover
689+
if rom.path_cover_s
690+
else rom_attrs.get("url_cover") or None
691+
),
685692
"url_manual": rom.url_manual or rom_attrs.get("url_manual") or None,
686693
"url_screenshots": rom.url_screenshots
687694
or rom_attrs.get("url_screenshots")
@@ -712,8 +719,6 @@ async def fetch_sgdb_details() -> SGDBRom:
712719
MetadataSource.SGDB in metadata_sources
713720
and newly_added
714721
or scan_type == ScanType.COMPLETE
715-
or (scan_type == ScanType.PARTIAL and not rom.sgdb_id)
716-
or (scan_type == ScanType.UNIDENTIFIED and rom.is_unidentified)
717722
):
718723
game_names = [
719724
igdb_handler_rom.get("name", None),

0 commit comments

Comments
 (0)