feat: enhance logging for save uploads and improve missing firmware/platform indications in UI

This commit is contained in:
zurdi committed 2025-06-12 14:33:50 +00:00
1 parent fdb795dff1
commit cbc7b9c6cd
3 files changed
+29 -31

No files matched your search

+3 -1
View File
@@ -58,7 +58,9 @@ async def add_save(
if not rom:
raise RomNotFoundInDatabaseException(rom_id)
log.info(f"Uploading save {hl(saveFile.filename)} for {hl(rom.name, color=BLUE)}")
log.info(
f"Uploading save {hl(saveFile.filename)} for {hl(str(rom.name), color=BLUE)}"
)
saves_path = fs_asset_handler.build_saves_file_path(
user=request.user,
+20 -29
View File
@@ -130,6 +130,7 @@ async def _identify_firmware(
scan_stats.scanned_firmware += 1
scan_stats.added_firmware += 1 if not firmware else 0
scanned_firmware.missing = False
db_firmware_handler.add_firmware(scanned_firmware)
return scan_stats
@@ -453,27 +454,21 @@ async def _identify_platform(
socket_manager=socket_manager,
)
# Only purge entries if there are some file remaining in the library
# This protects against accidental deletion of entries when
# the folder structure is not correct or the drive is not mounted
if len(fs_roms) > 0:
missing_roms = db_rom_handler.mark_missing_roms(
platform.id, [rom["fs_name"] for rom in fs_roms]
)
if len(missing_roms) > 0:
log.warning("Missing roms not found in the filesystem:")
for r in missing_roms:
log.warning(f" - {r.fs_name}")
missing_roms = db_rom_handler.mark_missing_roms(
platform.id, [rom["fs_name"] for rom in fs_roms]
)
if len(missing_roms) > 0:
log.warning(f"{hl('Missing')} roms from filesystem:")
for r in missing_roms:
log.warning(f" - {r.fs_name}")
# Same protection for firmware
if len(fs_firmware) > 0:
missing_firmware = db_firmware_handler.mark_missing_firmware(
platform.id, [fw for fw in fs_firmware]
)
if len(missing_firmware) > 0:
log.warning("Missing firmware not found in the filesystem:")
for f in missing_firmware:
log.warning(f" - {f}")
missing_firmware = db_firmware_handler.mark_missing_firmware(
platform.id, [fw for fw in fs_firmware]
)
if len(missing_firmware) > 0:
log.warning(f"{hl('Missing')} firmware from filesystem:")
for f in missing_firmware:
log.warning(f" - {f}")
return scan_stats
@@ -550,15 +545,11 @@ async def scan_platforms(
socket_manager=sm,
)
# Only purge platforms if there are some platforms remaining in the library
# This protects against accidental deletion of entries when
# the folder structure is not correct or the drive is not mounted
if len(fs_platforms) > 0:
missed_platforms = db_platform_handler.mark_missing_platforms(fs_platforms)
if len(missed_platforms) > 0:
log.warning("Missing platforms not found in the filesystem:")
for p in missed_platforms:
log.warning(f" - {p.slug}")
missed_platforms = db_platform_handler.mark_missing_platforms(fs_platforms)
if len(missed_platforms) > 0:
log.warning(f"{hl('Missing')} platforms from filesystem:")
for p in missed_platforms:
log.warning(f" - {p.slug}")
log.info(emoji.emojize(":check_mark: Scan completed "))
await sm.emit("scan:done", scan_stats.__dict__)
@@ -2,6 +2,7 @@
import type { FirmwareSchema } from "@/__generated__";
import DeleteFirmwareDialog from "@/components/common/Platform/Dialog/DeleteFirmware.vue";
import UploadFirmwareDialog from "@/components/common/Platform/Dialog/UploadFirmware.vue";
import MissingFromFSIcon from "@/components/common/MissingFromFSIcon.vue";
import storeAuth from "@/stores/auth";
import storeGalleryView from "@/stores/galleryView";
import storeRoms from "@/stores/roms";
@@ -114,6 +115,11 @@ function deleteSelectedFirmware() {
<v-list-item :tabindex="tabIndex" role="listitem" class="px-0">
<v-row no-gutters>
<v-col>
<missing-from-f-s-icon
v-if="item.missing"
class="mr-1"
text="Missing firmware from filesystem"
/>
<span>{{ item.file_name }}</span>
</v-col>
</v-row>
@@ -144,7 +150,6 @@ function deleteSelectedFirmware() {
</v-chip>
</v-col>
</v-row>
<template> </template>
<template #append>
<template v-if="mdAndUp">
<v-chip size="x-small" tabindex="-1" label>{{