LPL Editor
RetroArch playlist filter and stream editor.
What is LPL Editor?
"LPL Editor" (or lpled for short) is a command line application written in
Rust to view, combine, filter, edit and remix "RetroArch Playlist" files. Add
options and patterns to filter content or customize output, inspired by tools
like grep and jq. This is not a ROM or media files manager. Games need
to be imported into Playlists through RetroArch first.
{
{
}
{
}
}
)
)
)
)
Features
- merge multiple playlists
- search filters with regex support
- sort game entries
- remove duplicate game entries
- check for missing ROM files
- respect default core for "DETECT" values
- output data in color or custom format
- fuzzy finder selection menu
- play game directly with RetroArch
- and more...
What is a RetroArch Playlist?
Libretro Docs:
RetroArch brings many emulators adapted as
"core" plugins together and manages user configuration in a cohesive
environment. Games are organized into "RetroArch Playlists". Playlists show up
in the user interface as clickable game entries and contain information such as
location of ROM files and their associated cores. These files are regular text
data encoded in JSON format with file extension ".lpl". Each data field consist
of a "key": "value" pair. In example "label" would be the name of the key
and "Fantastic Night Dreams - Cotton (USA)" it's associated value.
Installation
Download (simple)
Get pre-compiled binaries:
- Go to Releases Page
- Download the archive file for your operating system
- Extract and run
lpled
Compile from source (advanced)
Compile process downloads lot of library dependencies.
Pre-requisites
- Rustup (
rustcandcargo): Download -> Install Rust compiler and toolchain - On Windows only: Microsoft Visual Studio Build Tools (
msvc): Download -> Install with "Desktop development with C++" option enabled (MS account login is not required)
Build
Option 1: Automatic compile and install from Crates io
Option 2: Manually compile from Github
Option 3: Cross compilation
First install the required tools for the build script. A Linux environment is expected:
- Cross (
cross) | cross -> cross compile to other platforms - Podman
podman| podman -> container system used by Cross on Linux - Zip (
zip) -> needed to create the Zip package for Windows
Look into the build.sh Bash script and adapt it for your needs, especially
the TARGETS variable. List available targets with:
Run script to build all targets and create packages for distribution:
Usage
Let's break down following command to its components:
option name
(expects argument)
|
program name | argument to option
| | |
----- ------- ------------
lpled -f --write "output.lpl" "playlist.lpl"
-- ---------------------- --------------
| |
| input filename
flag option
(without argument)
Standard operations
When loading files, standard operations are executed and applied to modify data. Original file on disk is not modified by default.
- Load list of files. Additionally read data or paths from stdin.
- Apply default values to each game entry: replace
"DETECT"incore_nameandcore_pathwith their defaults, fill emptylabelfrom filename atpathand fill emptycrc32with"00000000|crc" - Add key
originto each game entry temporary. By default this will be removed before output. - Multiple files are merged into single data.
- Non printable characters are escaped for safe screen output. Note: By default files written to disk are not affected.
- Final playlist data is printed to stdout.
Default behaviours can be changed with options.
Examples
Note: The #-line is a comment explaining the command.
# Show list of all available options.
# Multiple input files are merged.
# Add coloring to the data output.
# Filter entries by Regular Expression.
# Sort by multiple key factors.
# Save any changes to data as a new file.
# Output in custom template format.
# Pick menu to select a game entry interactively.
# Run and play top most game with RetroArch command.
See more usage examples at EXAMPLES.md.
What are Templates?
Output can be freely formatted and structured on the fly. Format instructions
are given by option --template FORMAT (or -F for short). To access an
associated value, put name of key between curly braces { and }, such as
"{label}", which loops over each game entry automatically and prints content
to screen. Newline "\n" and "\t" can be added for additional formatting.
Other text is output literally.
)
Learn more about this at TEMPLATE.md.
Additional notes, workarounds and quirks
Non printable characters in JSON
There are characters that can't be displayed in RetroArch or in your terminal
output. Upon reading the files those characters are encoded as a special
Unicode sequence in form of "\u00xx". This is not common at all, but I got a
a few files that include such characters. This special encoding makes it more
robust to display them on the terminal. However on file output for saving on
disk, the data is unchanged and no special encoding is done.
Current state, future plans and contributions
Builds are developed and mainly tested on a Linux machine. The Windows build needs some more testing with real data from real Windows users.
At the current moment, I am not much interested into adding more features. I would consider new features only if either I am interested myself or if its a big deal to others. And only if the implementation isn't too complicated, does not break existing usage or test cases. Exceptions can be made.
If you find a bug, need documentation or have any kind of problems using this tool, please report.
See also
- ROMs, Playlists, and Thumbnails at Libretro Docs: Official Libretro documentation explaining basics of what playlists are and how to work with them in RetroArch.
- RetroArch Playlist Editor by Marc Robledo: A pretty neat third party application in the browser with a graphical user interface. It is simple, it is easy to use, and it can edit entries. Highly recommended to check out.