Python script to make FBA playlist

I made this python script that will make a playlist for the FBA games using the names from the database.

To get the database you need to download the FBA emulator for the version of the romset you have, run it and go to Misc -> Generate dat file -> Generate dat (Arcade only)… Save it as “fba.dat” Copy the code below and save it as “dat2lpl.py” in the same folder as the dat you saved earlier. You can run it simply with “python dat2lpl.py” The playlist generated is for the complete romset and it will ignore bios roms.

import sys, codecs

path = '/storage/roms/FBA/'
playlist = 'FB Alpha - Arcade Games.lpl'


out = codecs.open(playlist, 'w', 'utf-8')


dat = open('fba.dat', 'r')
lines = dat.readlines()


for i in range(0,len(lines)):
  line = lines[i].strip()
  if line.startswith('<game') and not 'isbios="yes"' in line:
    name = line.split('"')[1]
    i = i + 1
    line = lines[i].strip()
    description = line[13:-14]
    out.write(path + name + '.zip' + '
')
    out.write(description + '
')
    out.write('/tmp/cores/fba_libretro.so' + '
')
    out.write('Arcade (FB Alpha - SVN)' + '
')
    out.write('DETECT' + '
')
    out.write(playlist + '
')
dat.close()
out.close()

You should change the line that says path = ‘/storage/roms/FBA/’ with the path where you have your FBA roms in lakka

The result looks like this (not the complete playlist):

/storage/roms/FBA/stratvoxb.zip
Stratovox (bootleg)
/tmp/cores/fba_libretro.so
Arcade (FB Alpha - SVN)
DETECT
FB Alpha - Arcade Games.lpl
/storage/roms/FBA/streakng.zip
Streaking (set 1) [Bad Colours]
/tmp/cores/fba_libretro.so
Arcade (FB Alpha - SVN)
DETECT
FB Alpha - Arcade Games.lpl
/storage/roms/FBA/streaknga.zip
Streaking (set 2) [Bad Colours]
/tmp/cores/fba_libretro.so
Arcade (FB Alpha - SVN)
DETECT
FB Alpha - Arcade Games.lpl
/storage/roms/FBA/sfj.zip
Street Fighter (Japan)
/tmp/cores/fba_libretro.so
Arcade (FB Alpha - SVN)
DETECT
FB Alpha - Arcade Games.lpl
/storage/roms/FBA/sfp.zip
Street Fighter (Prototype) [Prototype]
/tmp/cores/fba_libretro.so
Arcade (FB Alpha - SVN)
DETECT

In lakka it will show the full name of the game instead of the name of the zip file.

1 Like

Oh nice! Would you mind uploading the dat somewhere? That would save people from having to download the standalone emu just to generate it.

Problem is each version of the emulator uses it’s own database just like mame (in fact they use the same romsets and keep it synced to the latest version of mame) So there’s a dat for each version.

Also this is useful if you’re going to have all the roms, otherwise you would have to delete what you don’t want from the playlist.

Right, but we only have 2 versions libretro-ized and we don’t keep up with FBA git or anything, so it should just be those 2 dats. But whatever, it’s not that hard for someone to generate their own.

Ok, here I uploaded a zip with the 2 dats, the script and the 2 playlists. Here’s the link https://mega.nz/#!1UEmSDyb!QzJWw3flMRQTr0fLp8Qnfwqjk1kgozBEI9xVGI_wf2E

I’m kinda confused about which version is used in which core so this are the instructions for now: You’ll have to edit the playlist file with the correct name of the core depending on the operating system. There’s fb_alpha_libretro.dll and fba_libretro.dll on windows and they’re .so on other systems, but I don’t know which one is for each version. You’ll also have to edit the name of the playlist “FB Alpha - Arcade Games.lpl” both in the filename and inside the file for one of the versions (I think this it’s right for the older version and you have to edit the one for the newer one). In both cases just do a Replace All with your text editor and be sure it gets saved correctly as a UTF8 file with no \r in the newlines because that caused me problems.

Sweet. :smiley:

thanks for sharing them!

very useful very useful very useful

Thank you for this!

One question about Python, which version should I be running? The latest is 2.7.15 but there are others that are at 3.x.