Metadata for ROM parent folder
AirmanRWP last edited by
Tried running a search for this, but with 50 pages of results...sorry if I am repeating a request.
I organise my ROMs into folders based on 'unique titles'. e.g. Many ROM packs have one unique game with different Versions, Regions, Fixes etc. I like to select the folder first and from there choose which version to use. The autoscraper will apply box art and description to unique ROM files within the folders themselves, is there any way for the parent folder to 'inherit' the metadata from one of the ROMs it contains? (e.g. first result)
That's a very niche use case. I don't believe a function like that exists in any of the scraping methods. You'll likely need to customize that manually or by selecting the folder in Emulation Station, scraping it and entering the desired game title.
AirmanRWP last edited by AirmanRWP
Thanks for the heads up,
I went ahead and created a little Python Script that modifies gamelist.xml based on my specific needs.
For anyone else in a similar situation, the python code is below (note it is very very hacky - I haven't done any programming in a while - please make a backup of your gamelist folder if you're going to run it on your pi).
EDIT: Removed code because the code tags make it look like garbage - whats the correct syntax? : \
Just one more thing - EmulationStation isn't properly displaying folder names that have full stops in the file name
e.g. "Dr. Mario 64" is properly displaying on my server storage via windows, but shows up only as "Dr " on Emulation Station. Is there any way to fix that?
cyperghost last edited by
AirmanRWP last edited by
Not that it's a big deal for me now, because my Folder Metadata generation script seems to force ES to display the folder properly, but in future it would be nice for a way to disable that via settings or something...
Here is the updated Python Code. This works for me only because:
I generated the folder names based off the ROM names (stripping them of the region suffix tags etc)
Have already moved all the ROMS into their respective folder.
Folder metadata will only be applied if the ROM it contains already has been scraped
#Code Start import xml.etree.ElementTree as ET from xml.etree.ElementTree import Element from xml.etree.ElementTree import ElementTree tree = ET.parse('gamelist.xml') root = tree.getroot() subPathGames =  def makefolder(element): print("Folder Metadata Not Found for ", element, "-> making folder") folder_created = False for game in root.findall('game'): for path in game.findall('path'): if all([element == path.text.split('/'), folder_created == False]): #print ("Game Data" , game.tostring(xml).decode()) #Construct with this indexes data folder_tag = ET.Element("folder") name_tag = ET.Element("name") name_tag.text = path.text.split('/').strip() folder_tag.append(name_tag) image_tag = ET.Element("image") if game.find('image') == None: print("img not found") else: image_tag.text = game.find('image').text folder_tag.append(image_tag) desc_tag = ET.Element("desc") if game.find('desc') == None: print("desc not found") else: desc_tag.text = game.find('desc').text folder_tag.append(desc_tag) rating_tag = ET.Element("rating") if game.find('rating') == None: print("rating not found") else: rating_tag.text = game.find('rating').text folder_tag.append(rating_tag) releasedate_tag = ET.Element("releasedate") if game.find('releasedate') == None: print("release date not found") else: releasedate_tag.text = game.find('releasedate').text folder_tag.append(releasedate_tag) developer_tag = ET.Element("developer") if game.find('developer') == None: print("dev date not found") else: developer_tag.text = game.find('developer').text folder_tag.append(developer_tag) publisher_tag = ET.Element("publisher") if game.find('publisher') == None: print("pub date not found") else: publisher_tag.text = game.find('publisher').text folder_tag.append(publisher_tag) genre_tag = ET.Element("genre") if game.find('genre') == None: print("genre not found") else: genre_tag.text = game.find('genre').text folder_tag.append(genre_tag) players_tag = ET.Element("players") if game.find('players') == None: print("players not found") else: players_tag.text = game.find('players').text folder_tag.append(players_tag) path_tag = ET.Element("path") path_tag.text = "./" + path.text.split('/').strip() folder_tag.append(path_tag) root.append(folder_tag) folder_created = True return for game in root.findall('game'): for path in game.findall('path'): if path.text.count('/') > 1: subPathGames.append(path.text.split('/')) else: continue #de-duplicate subPathGames = list(set(subPathGames)) print("Unique List of Games in Subfolder:\n", subPathGames) for element in subPathGames: #no folder elements at all! lets start one! if root.findall('folder') == None: print("Creating first folder metadata in gamelist.xml") makefolder(element) continue else: exists = False for folder in root.findall('folder'): #print("ELEMENT: " ,element, " NAME: ", folder.find('name').text) if element == folder.find('name').text: print ("Folder Already Exists! Next Question! Faster!") exists = True break if not exists: makefolder(element) print ("All folders made - now writing to file") new_root = ElementTree(root) new_root.write("gamelist-new.xml") #Code End
I suppose can be run straight from the Pi if Python is installed. or else just use WinSCP to transfer, modify and return the gamelist.xml file as normal.