Closed cosmo0 closed 1 year ago
I don't know if there is a logical way to move from packshot to square. There are three parts that cause problems:
05_packshots / 11_square_images games_13 / games_18 nintendo_switch_8 / nintendo_switch_5
The numbers change, and the number used for the packshot doesn't appear to be the same as what's used for square.
Probably the best way is to do it manually, sadly :(
The numbers change but they're always the same for all type of images. Packshots are always 05_packshots/games_13/nintendo_switch_8/PS_
, square images are always 11_square_images/games_18/nintendo_switch_5/SQ_
.
I've made a small JS program to demonstrate that you can always extract the square image from the large image: https://codepen.io/cosmo0/pen/mdjgKvY?editors=0011
Unfortunately it doesn't work from the URL because the game name casing changes :(
Ah thanks! I'll have a look at this when I get time.
Finally found some time to look at this. Your code is good (thanks!). One small thing, sometimes the header image is 1280 rather than 1600, so I've added a check for this in my version of the code.
I've got some further testing to do but I think I'll be able to get this done today or tomorrow.
Code is live and I've downloaded approx 100 missing square images.
Couple of issues I can't fix:
Hopping Girl Kohane EX https://www.switchscores.com/staff/games/detail/9440
Square URL should be: https://fs-prod-cdn.nintendo-europe.com/media/images/11_square_images/games_18/nintendo_switch_download_software/1x1_NSwitchDS_HoppingGirlKohaneEx_image500w.jpg
My code gives that result, but the image doesn't exist.
Same issue for Tears of the Kingdom. It may be that the images are missing.
From the search results, the image is:
The first "S" in "1x1NswitchDS" in in lower case. It makes me believe their system is manual, and they made a mistake while renaming it? That would be wild.
Based on the search, Tears of the Kingdom's square image is:
It has "BASE" in its title, while the large image has "Gamepage". It would demonstrate further that the images are manually renamed. For such a huge site, it blows my mind that basic operations like that are not automated.
OK, thanks. I'll need to do manual fixes for these, but the original issue is solved so I'll close this.
Some games have a "pack shot" instead of a square image ; example with Undernauts (see https://github.com/benbarden/switchscores/issues/140#issuecomment-1065513411)
All these games have a square image (visible in the Nintendo search results). It's possible to parse the pack shot URL and rebuild the square image.
Packshot:
Square:
A regex like that:
.*\/PS_([\w_]+)_PEGI\.jpg
catchesNSwitch_UndernautsLabyrinthOfYomi
in its first group, and then you can rebuild the square URL :"//fs-prod-cdn.nintendo-europe.com/media/images/11_square_images/games_18/nintendo_switch_5/SQ_" + $capture + "_image500w.jpg"