@muldjord
Thank you for your answer. And congratulations on your fantastic work on the Skyscraper, the best multi-platform scraping tool, in my opinion.
Actually, I'm not very comfortable with the process of adding a .m3u file to each of my 2500+ individual Amstrad CPC games (or to every game in my other retro-collections).
And, @mitu, I'm not comfortable neither with the idea of adding a non-standard extension to my games, just to have ES showing the .m3u playlists only. I understand that ".cd1", ".cd2", etc. are like a standard now in PSX multi-disc games, but I suspect a home-made ".dsm", ".disk1" or whatever I could invent in my room for Amstrad CPC/MSX/other Libretro would drive me to a lot of issues when I update/scrape/configure something in the future. The same applies to hidden folders: if I want to update the scraping info, I would have to rename the folder before, re-hide the folder after... Even the idea to manage ".disk1" or ".disk2" sounds laborious when you have hundreds of folders, thousands of files...
But, I still think one scrapped entry in ES for a multi-disc game sounds like the most elegant solution.
So, I share here the solution I took:
1- As mentioned before, I create a .m3u playlist for each multi-disc game and put all the files, including the .m3u, inside a folder with the same basename (I do this with the script in my first post)
2- As @mitu told me, I edit the Skyscraper's config.ini to add the .m3u extension at the platform I want to scrap.
3- I scrap everything. So regular files, regular files in subfolders, and .m3u files get an image+description in gamelist.xml.
4- I duplicate the information related to the .m3u files in the gamelist.xml to create new <folder> sections with the same scraped information. Here is the command lines I used to do this:
# extract the XML sections about .m3u files to a new tmp.xml file
perl -ne 'BEGIN{$/="</game>\n";} print m|(<game>.*m3u.*$/)|ms' gamelist.xml >> tmp.xml
# change any <game> tag to a <folder> tag
sed -i .bak "s/<game>/<folder>/g" tmp.xml
# change any </game> tag to a </folder> tag
sed -i .bak "s/<\/game>/<\/folder>/g" tmp.xml
# crop any .m3u filename to keep the path only
sed -i .bak 's/\/[[:alnum:][:blank:]\.\+\&,\(\);_-]*.m3u//g' tmp.xml
# delete the closing tag at the end of gamelist.xml
sed -i .bak '/^<\/gameList>/d' gamelist.xml
# add the content of tmp.xml to the end of gamelist.xml
cat tmp.xml >> gamelist.xml
# add the closing tag at the end of gamelist.xml
echo "</gameList>" >> gamelist.xml
And I must say, I'm quite happy with the result : now I have in ES only one scraped entry for any mono-disc game as I have one scraped entry for any subfolder (multi-disc game). When I select a game that is a multi-disc game, It opens the sublist - that is also scraped with the same information - and I just have to select the first entry to run the game.
I hope all this sounds useful.