ES-scraper
ES-scraper copied to clipboard
Fix for Emulation Station 2.x (es_systems.cfg in XML format)
Hi, I've just written a new readConfig function to correctly parse the es_systems.cfg file, now in XML format. Just replace the function readConfig with this:
def readConfig(file):
systems=[]
config = ET.parse(file)
configroot = config.getroot()
for child in configroot:
name = child.find('name').text
path = child.find('path').text
ext = child.find('extension').text
pid = child.find('platformid').text
if not pid:
continue
else:
system=(name,path,ext,pid)
systems.append(system)
print name, path, ext, pid
return systems
Note: you need to add the subnode
<system>
<fullname>Nintendo Entertainment System</fullname>
<name>nes</name>
<path>/media/usb/roms/nes</path>
<extension>.nes .NES</extension>
<command>..... </command>
<platform>nes</platform>
<platformid>7</platformid>
<theme>nes</theme>
</system>
I get an error when running after the change:
pi@raspberrypi:~$ python /home/pi/scraper.py
Traceback (most recent call last):
File "/home/pi/scraper.py", line 427, in
@sgtstadanko: This means your XML isn't well-formed. In other words, something is syntactically incorrect in your es_systems.cfg file.
I'd recommend you trim this file down to just the emulators you're actually using, and make sure you have a closing tag for all opening tags and they're properly nested.
<platformid>7</platformid>
etc.