Last active
May 27, 2022 15:17
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
cd %~dp0 | |
python.exe %~dpn0.py %1 %2 %3 %4 %5 %6 %7 %8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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