feat: Add Nintendo Switch 2 filename support - #79
Open
gamebits wants to merge 2 commits into
Open
Conversation
### Summary * Parse the trailing L suffix on Switch 2 screenshot and video filenames so the correct 32-character game ID is used for lookups in game\_ids.json. * Add an optional \-s / \--split-consoles flag to organize output into Switch 1/ and Switch 2/ subdirectories under the output folder. * Document the new flag and Switch 2 filename format in the README. ### Background Switch 2 media filenames use a 33rd character — L — immediately after the game ID (e.g. 2026032021282700-D30779535ABCA881A866788668CA6F50L.jpg). The previous parser always read exactly 32 characters after the dash, which truncated the ID and caused valid games to appear as unknown. ### Changes **organize\_screenshots.py** * Add parse\_filename() to validate filename structure and detect Switch 1 vs. Switch 2 media. * Strip the L suffix before looking up the game ID; lookups still use the existing 32-character keys in game\_ids.json. * Skip malformed filenames instead of misclassifying them. * Add \-s / \--split-consoles to optionally write files to Output/Switch 1//</kbd> or <kbd class="slate-kbd">Output/Switch 2/<title>/</kbd>.</div></li><li class="slate-li"><div style="position:relative">Default behavior is unchanged when <kbd class="slate-kbd">-s</kbd> is not passed.</div></li></ul><p class="slate-paragraph"><kbd class="slate-kbd"><strong class="slate-bold">README.md</strong></kbd></p><ul class="slate-ul"><li class="slate-li"><div style="position:relative">Document <kbd class="slate-kbd">-s</kbd> / <kbd class="slate-kbd">--split-consoles</kbd>.</div></li><li class="slate-li"><div style="position:relative">Explain the Switch 2 <kbd class="slate-kbd">L</kbd> suffix in the game IDs section.</div></li></ul></x-turndown>
Collaborator
Author
|
@RenanGreca, this PR was entirely vibecoded with Cursor in privacy mode. Feel free to close without merging if you prefer this repo to be AI-free! |
Owner
|
Hi @gamebits, thanks for the contribution. I'm ok with AI usage if it's carefully considered and tested. I assume you have tested it with your own screenshots, but I'll also give it a go with mine and merge if everything is OK. |
Logic error in the previous commit resulted in the `L` being stripped from the filename before looking in the JSON for a matching ID. Fixed.
Collaborator
Author
This was an unwise change that is now fixed in bd43eb5. Here's a screencast of this functionality now working as expected. switch-2-screenshots.mp4 |
Collaborator
Author
|
The above demo was produced using the JSON file from #81. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lsuffix on Switch 2 screenshot and video filenames so the correct 32-character game ID is used for lookups ingame_ids.json.-s/ --split-consolesflag to organize output into Switch 1/ and Switch 2/ subdirectories under the output folder.Background
Switch 2 media filenames use a 33rd character —
L— immediately after the game ID (e.g.2026032021282700-D30779535ABCA881A866788668CA6F50L.jpg). The previous parser always read exactly 32 characters after the dash, which truncated the ID and caused valid games to appear as unknown.Changes
organize_screenshots.pyparse_filename()to validate filename structure and detect Switch 1 vs. Switch 2 media.Lsuffix before looking up the game ID; lookups still use the existing 32-character keys ingame_ids.json.-s/--split-consolesto optionally write files toOutput/Switch 1/orOutput/Switch 2/.-sis not passed.README.md-s/--split-consoles.Lsuffix in the game IDs section.