dyreschlock / schlock-bot

Robot code to run on Twitch, Discord, and host OBS overlays
0 stars 0 forks source link

Pocket : Libraries Generation #119

Closed dyreschlock closed 2 years ago

dyreschlock commented 2 years ago

Write a program that will (1) crawl through core directories from an SD card to catalog which roms have been sorted, (2) for each rom, download the box art from libretro, (3) create a Libraries entry for the game to be used on the Pocket.

dyreschlock commented 2 years ago

This is a 3 part process, as mentioned above.

Step 1 - CreatePocketEntries will run through each of the directories for each core listed in the PocketCore enum. Any rom that is in a folder that doesn't start with an underline, doesn't start with a dot, and has a file extension that matches what is listed in the PocketCore will have an entry created. The name of the game will be the filename minus the extension, the genre will be the folder name, and it will create an image name with the same name as the rom. These are all saved to the database.

Step 2 - CollectPocketThumbnails will grab all entries in the database that have been marked false for imageCopied. For each one, it will check if there's a thumbnail in the boxart folder. If not, it will check libretro-thumbnails on github for the image. The repo name is set in the PocketCore enum. If there's no image with that name online, it will fail and move on to the next. If it finds the file, it will download it to the boxart folder. If the download is successful, and the file exists in the boxart folder, imageCopied is marked true.

Step 3 - Unsure how to create library entries for the Pocket at this time. This could end up just being a shell script creation, and then we'll need a Step 4, which is running that script. We'll see.

dyreschlock commented 2 years ago

The Filename of the Library image for a Rom is the rom file's CRC32 hash.

dyreschlock commented 2 years ago

As part of the thumbnail collection process, this will check to see if the Library image exists. If it doesn't, it will copy the png with the rom hash into a directory ready to be processed by a shell script. After the program is complete, the script should be run, which will put the files in the appropriate directories. From there, running the program again will check to see if the Library image exists, and if it does, everything is good!

dyreschlock commented 2 years ago

Unsure how this will look on the Pocket, though. Possible issues include:

  1. Official Library Images used BMPs, not PNGs.
  2. Official Library Images are sized accordingly. I'm using full sized images.
dyreschlock commented 2 years ago

This has been moved to a new project: dyreschlock/pocket-utils