jingjok Posted May 14, 2020 Share Posted May 14, 2020 (edited) Hi, I am a new user and have just installed the latest LaunchBox, installed MAME and imported the full rom set for MAME in LaunchBox. Then I downloaded the media for the rom set. I have only installed a few roms in MAME currently, but I love the feature of Launchbox to view the rom info and screenshots of all available roms so I can then select and install more roms that I like. What I don't seem to be able is to figure out how to show only show / list the subset of roms that are actually installed in the MAME roms folder. There is an "installed" category, but all rom list entries have this field set to 'empty'. I could go in to each rom details and set this manually to "yes" for the roms I have installed, but is there no way to 'refresh installed roms field' to automatically set this ? I tried to use the function to import specific roms, but it does not set the "installed" flag either. Is this a bug in the newest version ? Is there any other way to filter the roms list by available roms (i.e. MAME rom files installed in the roms folder) only ? Edited May 15, 2020 by jingjok Quote Link to comment Share on other sites More sharing options...
Retro808 Posted May 14, 2020 Share Posted May 14, 2020 1 hour ago, jingjok said: Hi, I am a new user and have just installed the latest LaunchBox, installed MAME and imported the full rom set for MAME in LaunchBox. Then I downloaded the media for the rom set. I have only installed a few roms in MAME currently, but I love the feature of Launchbox to view the rom info and screenshots of all available roms so I can then select and install more roms that I like. What I don't seem to be able is to figure out how to show only show / list the subset of roms that are actually installed in the MAME roms folder. There is an "installed" category, but all rom list entries have this field set to 'empty'. I could go in to each rom details and set this manually to "yes" for the roms I have installed, but is there no way to 'refresh installed roms field' to automatically set this ? I tried to use the function to import specific roms, but it does not set the "installed" flag either. Is this a bug in the newest version ? Is there any other way to filter the roms list by available roms (i.e. MAME rom files installed in the roms folder) only ? That's not really the point of the full mame romset importer. It was meant for users that actually have a full mame rom set. Also the installed tag in the metadata screen is mainly for identifying pc games that are installed on your system when importing from programs such as Steam, Gog, Epic, and such. Quote Link to comment Share on other sites More sharing options...
jingjok Posted May 15, 2020 Author Share Posted May 15, 2020 Thanks for the clarification... It would be great if LaunchBox would support this out of the box, but until then here is my solution. As LaunchBox uses simple XML files for it's database and playlists, I wrote a python script that creates two playlists - one with all titles where rom files are present and one where roms are absent. It may be interesting for others as well, I have attached the script below. The script does not alter any other files, it just creates two playlist xml files, 'On My PC.xml' and 'Not On My PC.xml'. If these playlist file(s) exist, they are overwritten, so you can just run the script again after adding roms. Please exit LaunchBox before running the script, and adjust the 3 paths and filenames at the beginning of the script to match your setup. The script can be run in any folder as it uses absolute paths. If you get an error about bs4 when running the script, you may need to install the missing python module : pip install beautifulsoup4 If you get an error about xml, you need to install lxml : pip install lxml The script is adapted from a similar script from phlaange found here : https://forums.launchbox-app.com/topic/52395-howto-custom-playlist-creation-with-python/ # this python script reads a LaunchBox platform xml database and creates two playlist from it, # the 'On My PC' playlist contains all games where the rom files are present on your PC, and # the 'Not On My PC' contains all the remaining LaunchBox entries which do not have corresponding rom files on your PC # if these playlist(s) exist already they will be overwritten. # close LaunchBox before running this script import os from bs4 import BeautifulSoup as soup # change the following 3 paths according to your installation platformFilename = r"D:\LaunchBox\Data\Platforms\MAME.xml" playlistOnMyPcFilename = r"D:\LaunchBox\Data\Playlists\On My PC.xml" playlistNotOnMyPcFilename = r"D:\LaunchBox\Data\Playlists\Not On My PC.xml" f = open(platformFilename, encoding='UTF-8') xml_soup = soup(f, 'xml') games = xml_soup.findAll('Game', {}) fOnMyPc = open(playlistOnMyPcFilename, 'w') fOnMyPc.truncate() fNotOnMyPc = open(playlistNotOnMyPcFilename, 'w') fNotOnMyPc.truncate() header = '''<?xml version="1.0" standalone="yes"?> <LaunchBox> <Playlist> <PlaylistId>8c69ff33-581f-4b0d-bf69-6c6e63730bb0</PlaylistId> <Name>On My PC</Name> <NestedName>On My PC</NestedName> <SortBy>Default</SortBy> <Notes /> <VideoPath /> <IncludeWithPlatforms>true</IncludeWithPlatforms> <AutoPopulate>false</AutoPopulate> <SortTitle /> <IsAutogenerated>false</IsAutogenerated> </Playlist> ''' fOnMyPc.write(header) header = '''<?xml version="1.0" standalone="yes"?> <LaunchBox> <Playlist> <PlaylistId>1b9e6193-81d9-43b6-ba4a-f1a7a68d2c9f</PlaylistId> <Name>Not On My PC</Name> <NestedName>Not On My PC</NestedName> <SortBy>Default</SortBy> <Notes /> <VideoPath /> <IncludeWithPlatforms>true</IncludeWithPlatforms> <AutoPopulate>false</AutoPopulate> <SortTitle /> <IsAutogenerated>false</IsAutogenerated> </Playlist> ''' fNotOnMyPc.write(header) man_orderOnMyPC = 0 man_orderNotOnMyPC = 0 for game in games: g_id = str(game.ID.text) if hasattr (game.DatabaseID, 'text'): lb_id = str(game.DatabaseID.text) else: lb_id = "" g_title = str(game.Title.text) g_title = g_title.replace('&', '&') # print("Processing " + g_title) if len(game.ApplicationPath.text) > 0: g_filename = os.path.basename(game.ApplicationPath.text) bolRomExists = os.path.isfile(game.ApplicationPath.text) else: g_filename = "" bolRomExists = False g_platform = str(game.Platform.text) s = " <PlaylistGame>\n" s +=" <GameId>" + g_id + "</GameId>\n" if len(lb_id) > 0: s +=" <LaunchBoxDbId>" + lb_id + "</LaunchBoxDbId>\n" s +=" <GameTitle>" + g_title + "</GameTitle>\n" s +=" <GameFileName>" + g_filename + "</GameFileName>\n" s +=" <GamePlatform>" + g_platform + "</GamePlatform>\n" if bolRomExists: s +=" <ManualOrder>" + str(man_orderOnMyPC) + "</ManualOrder>\n" else: s +=" <ManualOrder>" + str(man_orderNotOnMyPC) + "</ManualOrder>\n" s +=" </PlaylistGame>\n" if bolRomExists: fOnMyPc.write(s) if man_orderOnMyPC == 0: man_orderOnMyPC = -1 else: fNotOnMyPc.write(s) if man_orderNotOnMyPC == 0: man_orderNotOnMyPC = -1 fOnMyPc.write("</LaunchBox>") fNotOnMyPc.write("</LaunchBox>") Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.