stop RA from crashing when not available

This commit is contained in:
Georges-Antoine Assi
2025-06-05 11:44:47 -04:00
parent 3c2f32053b
commit 8c817c7f4b
3 changed files with 16 additions and 9 deletions

View File

@@ -94,12 +94,18 @@ class RAHasherService:
f"Executing {hl('RAHasher', color=LIGHTMAGENTA)} for platform: {hl(RA_ID_TO_SLUG[platform_id])} - file: {hl(file_path.split('/')[-1])}"
)
args = (str(platform_id), file_path)
proc = await asyncio.create_subprocess_exec(
"RAHasher",
*args,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
try:
proc = await asyncio.create_subprocess_exec(
"RAHasher",
*args,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
except FileNotFoundError:
log.error("RAHasher executable not found in PATH")
return ""
return_code = await proc.wait()
if return_code != 1:
if proc.stderr is not None:

View File

@@ -147,7 +147,7 @@ class FSResourcesHandler(FSHandler):
shutil.rmtree(cover_path)
except FileNotFoundError:
log.warning(
f"Couldn't remove cover from '{hl(entity.name or entity.id, color=BLUE)}' since '{cover_path}' doesn't exists."
f"Couldn't remove cover from '{hl(entity.name or str(entity.id), color=BLUE)}' since '{cover_path}' doesn't exists."
)
return {"path_cover_s": "", "path_cover_l": ""}

View File

@@ -160,6 +160,7 @@ async def scan_platform(
platform_attrs["igdb_id"]
or platform_attrs["moby_id"]
or platform_attrs["ss_id"]
or platform_attrs["ra_id"]
):
log.info(
emoji.emojize(
@@ -264,12 +265,12 @@ async def scan_rom(
"summary": rom.summary,
"igdb_metadata": rom.igdb_metadata,
"moby_metadata": rom.moby_metadata,
"url_cover": rom.url_cover,
"url_manual": rom.url_manual,
"path_cover_s": rom.path_cover_s,
"path_cover_l": rom.path_cover_l,
"path_screenshots": rom.path_screenshots,
"url_cover": rom.url_cover,
"url_screenshots": rom.url_screenshots,
"url_manual": rom.url_manual,
}
)