you could run a script like below, it should add all files found in given path and create playlists based on the paths, e.g. if you have folders:
/storage/roms
/storage/roms/NES
/storage/roms/NES/hacks
/storage/roms/Genesis
/storage/roms/Genesis/homebrew
And run
./scriptname /storage/roms
it will create playlists:
NES.lpl
NES-hacks.lpl
Genesis.lpl
Genesis-homebrew.lpl
It is untested, just written from top of my head, not sure if it works when there are spaces in folder names… Feel free to enhance/fix/adjust
#!/bin/bash
if [ -z "${1}" ]
then
echo "Run as ${0} /path/to/romfolders"
exit 1
fi
if [ ! -d ${1} ]
then
echo "Folder '${1}' not found!"
exit 2
fi
# make sure the given path does not end with slash
given_path=${1%/}
# find all folders under the given path, but exclude the top level folder from scanning
folders="$(find ${given_path} -type d | tail -n +2)"
# where to save generated playlists
playlist_storage=/storage/playlists
# generate playlist for each folder
for romfolder in ${folders}
do
(
# double check if it is a directory
if [ -d ${romfolder} ]
then
cd ${romfolder}
# get subpath only, will be used as playlist name
subfolder=${romfolder//${given_path}\//}
# replace slashes with dashes in subpath
playlist_name=${subfolder//\//-}
playlist_file=${playlist_prefix}/${playlist_name}.lpl
for romfile in *
do
# add only files, not folders
if [ -f ${romfile} ]
then
# full path to the rom file
fullpath="${romfolder}/${romfile}"
# name shown in the playlist - filename without suffix
gamename="${romfile%.*}"
# which core will be used for launching (empty)
corepath=""
# crc / hash for matching - none
crc="DETECT"
# write playlist entry
echo -e "${fullpath}\n${gamename}\n${corepath}\n${playlist_name}\n${crc}\n${playlist_name}.lpl" >> ${playlist_file}
fi
done
fi
)
done