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>")