mihaip / infinite-mac

A classic Mac loaded with everything you'd want
https://infinitemac.org
Apache License 2.0
1.12k stars 66 forks source link

import-cd-roms fails on missing resource (with proposed fix) #313

Closed skullk1d closed 2 months ago

skullk1d commented 2 months ago

When running import-cd-roms, if a CD-ROM resource is missing, the entire setup aborts and doesn't allow generation of the JSON manifest, which doesn't allow me to finish setup.

The script fails with the error
Failed to download https://archive.org/download/fam-cd/FAM_CD.ISO

The traceback leads to a failed http request initiated by import-cd-roms.py

Indeed, the CD image is not available at the above URL.

Local commit hash:

commit 718d1a0f15c9e67178e69db8f29f6d739f942c2b (origin/main, origin/HEAD, main)
Author: Mihai Parparita <mihai@persistent.info>
Date:   Sun Mar 10 18:15:36 2024 -0700

    Allowlist another external disk image domain

Proposed diff for import-cd-roms.py:

def main():
    shutil.rmtree(paths.COVERS_DIR, ignore_errors=True)
    os.mkdir(paths.COVERS_DIR)

    input_manifests = load_manifests()
    output_manifests = {}
    for folder_path, input_manifest in input_manifests:
        try:
            output_manifest = get_output_manifest(input_manifest)
            output_manifests[folder_path] = output_manifest
        except Exception:
            continue

# ...

I recommend a simple try-catch where you initiate the request, however I'm sure you can do it in a more clean way than I did.
The above allowed me to get the project up and running.

Sorry for sitting on this fix for so long.
Really appreciate your work!

mihaip commented 2 months ago

Thanks for filing this. Someone else noticed the problem with that CD-ROM and filed #304 about it. I implemented something very similar to your fix in 9f48d553c973b50e2a8a67a2b3657d8c6897bdf6, if you pull the latest changes it should work now.