Pulling Select ROMs and Metadata from Backup
-
Hello! I have a general question related to development. I didn't think it belonged in Help & Support since this is purely quality of life, and something I'd like working on my setup, and figured others might, also.
So I'm far from the best with scripting and linux, and was wondering if someone may be able to help. Either general guidance, or maybe knows some linux-fu to one-line something in the CLI to make this happen.
I have a Retropie (of course) and a large number of games I've scraped metadata for, using a particular site (don't know the rules on linking to scraping sites), their DB and associated tools. They're pretty solid, but I'm also open to recommendations.
This leaves me with the following file structure:
~/RetroPie/roms/<console>/ ~/RetroPie/roms/<console>/<sub_folders> ~/RetroPie/roms/<console>/gamelist.xml ~/RetroPie/roms/<console>/media/folders ~/RetroPie/roms/<console>/media/images ~/RetroPie/roms/<console>/media/images/<sub_folders> #if applicable/game is in a sub folder ~/RetroPie/roms/<console>/media/marquee ~/RetroPie/roms/<console>/media/marquee/<sub_folders> #if applicable/game is in a sub folder ~/RetroPie/roms/<console>/media/videos ~/RetroPie/roms/<console>/media/videos/<sub_folders> #if applicable/game is in a sub folder
This is a tad different from the built-in scraper which puts things in these directories
/home/<user>/.emulationstation/downloaded_images/<console>/
The gamelist.XML is the standard format (I think)
<game> <path>./ROM_Name.zip</path> <name>ROM Name</name> <desc>Some game description goes here. </desc> <image>./media/images/ROM Name.png</image> <video>./media/videos/ROM Name.mp4</video> <marquee>./media/marquee/ROM Name.png</marquee> <rating>0.75</rating> <releasedate>19861102T000000</releasedate> <developer>Developer</developer> <publisher>Developer</publisher> <genre>Action</genre> <players>1-2</players> <playcount>1</playcount> <lastplayed>20180704T233201</lastplayed> </game>
There is one associated image, marquee, and video, per ROM title. There ARE sub folders, as I have containment on custom ROMS, translations, and other items (the path data in the gamelist.xml reflects this and there are appropriate sub folders in each media directory).
My question is this: how could I create a script so that if I query my backup for a single ROM title, I would get all the associated media, and properly update the gamelist.xml file with only that requested title? Let's say I have a brand new Retropie install, and I don't want all the associated games brought over. I just one, or maybe five (or whatever, arbitrary number >1). Or maybe it's is a few weeks after moving some other ROMs over, and I want to add a few more titles to the handful I brought over last time.
I think the best way to go about it would be querying the XML for a given title which would then pull down the ROM, the associated media, and somehow update the destination gamelist.XML. Doing this for more than one title at a time would, understandably, be a bear, and I'd almost put it beyond the scope of a simple script. Unless someone has ideas.
I just have no clue how to go about making something like this possible, and especially no idea how to append the information to the gamelist.xml file as an update, and (I assume this matters) append it in alphabetical order.
Is there an easy way to do this, or is it not worth the time and I should just move the desired ROMs over and re-scrape and re-download the associated data?
-
@webz0r I'm not sure how you would do this, but you don't need to worry about keeping the gamelist.xml in alphabetical order.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.