RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    a gamelist.xml cleaner tool

    Scheduled Pinned Locked Moved Ideas and Development
    gamelist.xmlscript
    56 Posts 21 Posters 25.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      Vodkanakas @Sano
      last edited by Vodkanakas

      @sano yes seelphs scraper has an option to use the Rom folder for the gamelists and images so that's why I know they are there. It accesses the images folder just not the gamelist.xml

      Edit: If i try just ./images-cleaner.sh -t i get a no such file or directory

      1 Reply Last reply Reply Quote 0
      • AndersHPA
        AndersHP @Sano
        last edited by AndersHP

        I tried running the ./images-cleaner.sh -tcontaining the code that @meleu linked to here, after removing a bunch of roms from different system folders via SSH, but the script didn't report anything to delete.

        I would suppose it both deleted the redundant artwork as well as cleaning up the gamelist files, right?

        Does this script not work if roms are placed on USB? Art+gamelists are placed under emulationstation/gamelists and /downloaded_images

        My "Bubble Bobble" Themed Bartop Arcade
        My Gameboy

        meleuM 1 Reply Last reply Reply Quote 0
        • meleuM
          meleu @AndersHP
          last edited by

          @andershp according to the --help you can specify an arbitrary directory with --images. Try it ;)

          • Useful topics
          • joystick-selection tool
          • rpie-art tool
          • achievements I made
          AndersHPA 1 Reply Last reply Reply Quote 0
          • AndersHPA
            AndersHP @meleu
            last edited by

            @meleu the images are in the default place - it's the ROMs that are on USB..

            My "Bubble Bobble" Themed Bartop Arcade
            My Gameboy

            1 Reply Last reply Reply Quote 0
            • greenieG
              greenie
              last edited by

              @meleu I've just been through and cleaned all my gamelist.xml files - congrats for creating such a time-saving tool!

              However, I've just noticed that (although it says the entry is removed from the .xml file during processing) any entry with & in the name is not removed from the .xml file.

              Is there any way around this?

              Cheers.

              1 Reply Last reply Reply Quote 0
              • greenieG
                greenie
                last edited by

                @meleu That last comment was meant to say "& amp ;" but the post has changed it to "&".

                1 Reply Last reply Reply Quote 0
                • greenieG
                  greenie
                  last edited by

                  @meleu I've now tried this on several PCs, (including the Windows Subsystem for Linux!) and it's the same result on all of them.

                  To reproduce...

                  Download one of the gamelist.xml and downloaded_images files/folders from the this master repository: https://github.com/recalbox/recalbox-gamelists/tree/master/gamelists .

                  Drop them in your system's ROMS folder. This is based on the no-intro romset, which my collection is based on.

                  You should now have the gamelist.xml file, downloaded_images folder and ROMs under your ROMS folder (in this example I'm using the NES system).

                  Run the gamelist-cleaner.sh script after editing the settings to point at your ROMS folder.

                  The script appears to run perfectly. I can watch the output in Terminal with glee!

                  But, after inspecting the new xml file, you'll see that entries such as Advanced Dungeons & Dragons - DragonStrike (USA).zip are still present even though, in my case, I don't have the ROM for that game.

                  Is this a formatting issue? Has anyone else experienced this?

                  Any advice would be hugely appreciated as this is the last step I need to nail before my system is finished. I'll be editing out the remaining entries in the mean time.

                  Thanks.

                  meleuM 1 Reply Last reply Reply Quote 0
                  • meleuM
                    meleu @greenie
                    last edited by

                    @greenie
                    Regarding the & char, it's a known issue and I posted about it here. In the linked post you can see a workaround to fix this issue (I agree that it isn't the ideal solution, though).

                    And thanks for this report. ;-)

                    • Useful topics
                    • joystick-selection tool
                    • rpie-art tool
                    • achievements I made
                    greenieG 1 Reply Last reply Reply Quote 0
                    • greenieG
                      greenie @meleu
                      last edited by

                      @meleu Thanks for the response. I don't think this is exactly the same issue, I'm not sure what workaround you refer to on your post either.

                      The problem I was getting is that anything in the gamelist.xml file with "& amp ;" in the name was not getting removed. It could see the entry, and list it as removed in the terminal, but the entry remained.

                      I have managed to find my own workaround:

                      • Find/Replace on gamelist.xml, changing all "& amp ;" to "ampersand".
                      • Use A Better Finder Rename on the Mac (I'm sure there are similar tools out there, but I have this handy) to replace all "&" in ROM file names to "ampersand".
                      • Run your script, then reverse the above steps.

                      Bish bash bosh. Done.

                      1 Reply Last reply Reply Quote 0
                      • T
                        Tim
                        last edited by

                        I'm new to RetroPie, but wanted to say thank you for this tool. My OCD thanks you as well. Sweet, sweet, clean gamelist!

                        1 Reply Last reply Reply Quote 1
                        • AndersHPA
                          AndersHP
                          last edited by

                          @meleu could my issues here relate to the symlink issues I have in the other thread regarding launching images?

                          My "Bubble Bobble" Themed Bartop Arcade
                          My Gameboy

                          1 Reply Last reply Reply Quote 0
                          • chipsnblipC
                            chipsnblip
                            last edited by chipsnblip

                            i think i might have found the culprit regarding games that have an ampersand in the filename (& in the gamelist.xml)

                            line 221 in the script reads:

                            xmlstarlet ed -L -d "/gameList/game[path=\"$path\"]" "$clean_gamelist"
                            

                            but if i change it to:

                            xmlstarlet ed -L -d "/gameList/game[path=\"$full_path\"]" "$clean_gamelist"
                            

                            they are handled properly. i'm not a programmer by any means (just a computer enthusiast), so hopefully someone with more knowledge than myself can confirm that it's working.

                            1 Reply Last reply Reply Quote 1
                            • D
                              duiz
                              last edited by

                              I suffer from some rather messy gamelists, but I am a newbie when it comes to these commandline things... Is it possible to request a small step by step guide to get this up and running for a beginner with little experience in github and etc?

                              1 Reply Last reply Reply Quote 0
                              • hansolo77H
                                hansolo77
                                last edited by

                                Wow, @meleu releases another script I didn't even know about! :) Can't wait to try it out tomorrow when I'm more awake.

                                Who's Scruffy Looking?

                                1 Reply Last reply Reply Quote 0
                                • D
                                  Degsy
                                  last edited by Degsy

                                  @chipsnblip Nearly right.. and that led me on to the fix

                                  If you instead add in this above the xmlstarlet line, it will handle it correctly.

                                  path="$(echo "$path" | sed 's@&@\&@g')"
                                  

                                  If you want to go further and want to see feedback onscreen when its triggered, then INSTEAD add in this block above the xmlstarlet line:

                                  	#& fix
                                  	if [[ $path == *"&"* ]]; then
                                  		path="$(echo "$path" | sed 's@&@\&@g')" 
                                  		echo "& fix applied"
                                  	fi	
                                  

                                  The reason why it was failing was that either bash or xmlstarlet was translating it incorrectly.
                                  The $full_path that you were using already has the & translated back to &, but that variable also includes the full path of the rom (/home/pi/RetroPie/roms/… etc) which does not match what is in the XML (didn't match mine anyway).

                                  1 Reply Last reply Reply Quote 1
                                  • paffleyP
                                    paffley
                                    last edited by paffley

                                    @meleu I like the look of this so thank you.
                                    I have it installed on my pi.
                                    I have my gamelist.xml in my roms folder along with all my artwork (boxart/cartart/snap etc).

                                    Please could you let me know what I type in the command line to run the script?

                                    I've tried all but failed miserably haha :P

                                    Update: I believe I have sorted it, its running the script now as I type :)

                                    Update 2: This script is amazing! Thank you so much, works flawlessly with @Degsy fix in the above post.

                                    1 Reply Last reply Reply Quote 1
                                    • F
                                      fefitohh
                                      last edited by

                                      Hi

                                      Is it possible to use this tool to remove certain tags contained in every available gamelist.xml?

                                      What I would like to do is to remove the scraped "raiting" from all my gamlists.

                                      mituM 1 Reply Last reply Reply Quote 0
                                      • mituM
                                        mitu Global Moderator @fefitohh
                                        last edited by

                                        @fefitohh Not with this script, but someone posted something similar here for the lastplayed and playcount tags. You can adapt it to remove the rating instead.

                                        1 Reply Last reply Reply Quote 0
                                        • hansolo77H
                                          hansolo77 @meleu
                                          last edited by

                                          @meleu said in a gamelist.xml cleaner tool:

                                          NOTE: the script doesn't work if the gamelist.xml has invalid xml characters. Such as & in Track & Field. I will try to take a look at it soon.

                                          Fortunately I implemented the --update feature, then the users can always try to run the script with that argument to get the latest version :-)

                                          EDIT: HA! Looks like EmulationStation auto fix the gamelist.xml files with invalid xml characters as soon as it needs to update a gamelist.xml file. Then I'm not worried about this issue for a while! :D

                                          This "bug" is bugging me. I have a huge Nintendo DS collection I've been going through. I have a lot of duplicate games as a result of different regions (USA, Europe, Japan). So after scraping, I'm going through my gamelist and removing all the extra non-USA versions where possible. I'm up to the letter P now, after about 4 days lol. I was editing the gamelist.xml manually until letter G before I remembered this script! Anyway, when I'm running the script, it's always missing some roms. I tried re-running it multiple times with the same result. I couldn't find a repo in your github to report it as an error, so I looked here. I discovered that any games with the & symbol in the filename (designated as & it would report as removed but wouldn't be). Sure enough, you already recognized it. So I'm just confirming that the issue still remains. I've even tried running the -u flag to update but it doesn't look like you've done anything with yet (cough 2 years). :)

                                          I can still edit these out manually, but a fix would be nice for other people too. Hope you're doing well. Have a good one!


                                          Example output of games NOT getting removed:

                                          The game with <path> = "/home/pigaming/RetroPie/roms/nds/Gakken Chuugokugo Zanmai DS - Kiki &amp; Kaki Training (Japan) [b].zip" has been removed from xml.
                                          The game with <path> = "/home/pigaming/RetroPie/roms/nds/Gakken Hangul Zanmai DS - Kiki &amp; Kaki Training (Japan) [b].zip" has been removed from xml.
                                          The game with <path> = "/home/pigaming/RetroPie/roms/nds/Happy Party with Hello Kitty &amp; Friends! (Europe) (En,Fr,De,Es,It,Nl).zip" has been removed from xml.
                                          The game with <path> = "/home/pigaming/RetroPie/roms/nds/My Baby 2 - Boy &amp; Girl (Europe) (En,Fr,De,Es,It,Nl).zip" has been removed from xml.
                                          The game with <path> = "/home/pigaming/RetroPie/roms/nds/My Best Friends - Cats &amp; Dogs (Europe) (En,Fr,De,Es,It).zip" has been removed from xml.
                                          The game with <path> = "/home/pigaming/RetroPie/roms/nds/Nintendogs - Labrador &amp; Friends (Europe) (En,Fr,De,Es,It).zip" has been removed from xml.
                                          The game with <path> = "/home/pigaming/RetroPie/roms/nds/Nintendogs - Miniature Dachshund &amp; Friends (Japan).zip" has been removed from xml.
                                          The game with <path> = "/home/pigaming/RetroPie/roms/nds/Nintendogs - Shiba &amp; Friends (Japan).zip" has been removed from xml.
                                          The game with <path> = "/home/pigaming/RetroPie/roms/nds/Percy Jackson &amp; the Lightning Thief (Europe) (En,Fr,De,Es,It).zip" has been removed from xml.
                                          

                                          Who's Scruffy Looking?

                                          S 1 Reply Last reply Reply Quote 0
                                          • S
                                            shantigilbert @hansolo77
                                            last edited by shantigilbert

                                            @hansolo77 I was having the same isue but I think I found a solution that works for me, I just need to confirm that it works on other setups, could you do a ls -la in your NDS rom folder and post the result to pastebin ? also paste your gamelist.xml

                                            EDIT: I just opened a PR to deal with this issue

                                            https://github.com/meleu/share/pull/12

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.