Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix tinfoil issue with improper rom DL urls and support for rom folders #1316

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions backend/endpoints/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ async def extract_titledb(roms: list[Rom]) -> dict[str, TinfoilFeedTitleDBSchema
TinfoilFeedFileSchema(
url=str(
request.url_for(
"get_rom_content", id=rom.id, file_name=rom.file_name
"get_rom_content", id=rom.id, file_name=file.get('filename')
)
),
size=rom.file_size_bytes,
size=rom.files[0].get('size'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rom.files[0] here now needs to be file, after the latest changes.

)
for rom in roms
for rom in roms if rom.files and len(rom.files) > 0
for file in rom.files
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to expose all files to Tinfoil. Ideally, we could only include the ones with a valid extension that Tinfoil understands (in case users maintain other kind of resources within the rom folder).

],
directories=[],
success="RomM Switch Library",
Expand Down
10 changes: 7 additions & 3 deletions backend/handler/filesystem/roms_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,13 @@ def get_roms(self, platform_fs_slug: str) -> list[FSRom]:

return [
FSRom(
multi=rom["multi"],
gantoine marked this conversation as resolved.
Show resolved Hide resolved
file_name=rom["file_name"],
files=self.get_rom_files(rom["file_name"], roms_file_path),
multi=False if len(files := self.get_rom_files(rom["file_name"], roms_file_path)) == 1 else rom["multi"],
file_name=(
f"{rom['file_name']}/{files[0].get('filename')}"
if len(files) == 1 and rom["file_name"] != files[0].get('filename')
else rom["file_name"]
),
files=files,
)
for rom in fs_roms
]
Expand Down