Skip to content

Commit

Permalink
Update the 'edit' functionality to allow creating a UUID if a game do…
Browse files Browse the repository at this point in the history
…es not have a value in gamelist.xml (similar to how it's done on upload)

Also create the new <game> element on a new line in the XML (make it slightly prettier)
  • Loading branch information
pkegg authored and dhwz committed Mar 10, 2022
1 parent e326575 commit a375824
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,18 @@ def upload_rom(system):
game = root.find(".//game/[path=\"./%s\"]" % rom.raw_filename)
else:
game = SubElement(root, 'game', attrib={ 'id': str(uuid4()) })
game.tail = "\n"
entry = SubElement(game, 'path')
entry.text = "./%s" % rom.raw_filename
rom_filename = rom.raw_filename
elif existing_rom:
game = root.find(".//game/[path=\"./%s\"]" % existing_rom)
rom_filename = existing_rom
if not game:
game = SubElement(root, 'game', attrib={ 'id': str(uuid4()) })
game.tail = "\n"
entry = SubElement(game, 'path')
entry.text = "./%s" % existing_rom
else:
return redirect('/')

Expand Down

0 comments on commit a375824

Please sign in to comment.