Skip to content

Instantly share code, notes, and snippets.

@BenMcLean
Last active May 27, 2022 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BenMcLean/533abb209b1c57559b107ba952c65155 to your computer and use it in GitHub Desktop.
Save BenMcLean/533abb209b1c57559b107ba952c65155 to your computer and use it in GitHub Desktop.
RetroPie EmulationStation Menu Item Names Un-Skraper a.k.a. the Anti-Scraper
@ECHO OFF
cd %~dp0
python.exe %~dpn0.py %1 %2 %3 %4 %5 %6 %7 %8
# -*- coding: utf-8 -*-
"""RetroPie EmulationStation Menu Item Names Un-Skraper a.k.a. the Anti-Scraper
This script "un-scrapes" your EmulationStation menu item names, replacing them with the your ROM file names.
It expects the path to the gameslist.xml file as a command line argument.
"""
import argparse
import xml.etree.ElementTree
parser = argparse.ArgumentParser(description='Input XML file')
parser.add_argument('file', metavar='N', type=str, nargs='+', help='Input XML file')
filename = parser.parse_args().file[0]
et = xml.etree.ElementTree.parse(filename)
for game in et.getroot().iter('game'):
game.find('name').text = game.find('path').text[2:-4]
et.write(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment