Looking for playlist creation program advice

Today I made a small program to automatically create a playlist based on the files in a given directory. I’ve never made anything like this before (my programming experience is in another area), and I know it is nothing to write home about, but I’m proud of it :).

At this point I am specifically looking to make a MAME playlist. It works, but as of right now, it simply gives the zip file name as the game name. Is there any way i can delve into the zip file and get a game title?

Also, is there anything I should watch out for when making a program like this?

Currently, this program is a console program. I think I’m going to turn it into a windows program and add some bells and whistles :).

Thanks for taking the time to do this - it gets you experience and it benefits us all.

You may want to read about my situation I ran into recently - http://libretro.com/forums/showthread.php?t=7207 A fresh install of the latest build wouldn’t load roms from an older playlist. Turns out, it looks like they no longer support the (zip_file#rom_name) format.

In it I point to a powershell script I use to create my playlists, and it delves into the zip archive. Maybe a feature of your creator could be asking for Lakka version, and if older than X, create the playlist in (zip#rom) format, else use the newer format of just (zip)

Good luck

Thanks! I’ll check into it and see if I can use anything from it. I think I may have found a way to get into the zip files, but what I need to know is if there is something specific to look for within those zip files that I can read that can give me a game’s title.

This little project has been a lot of fun. I’ve never tackled a program like this, but I’ve always wanted to. I’ve already made my windows version of my little playlist creator, plus some bells and whistles…whatever comes to mind :).

I’m not aware of a standard metadata that exists inside roms like it does in JPGs or MP3s. I think the best approach would be what Lakka does and have a database of hashes. Hash the file inside the zip, and then use that in a query to the database that returns whatever info you want (Title, genera, year released, etc) I’ve not used it myself - but GoodTools may be worth investigating for that database (https://en.wikipedia.org/wiki/GoodTools#Good_codes) It also seems a version - may not be the latest - can be downloaded here http://www.emuparadise.me/extras/GoodTools/

I’ve seen the term “hash” used every now and then, but am not entirely sure what it is or how it works. From what you are saying, it sounds like a key (primary?) in the database you are talking about. I am also not sure how to hash (verb) a file, but I’ll look into it. I’ll also look into the Good Tools you mentioned :).

hashing is when you run a file through an algorithm that spits out a mathematical representation of the file. CRC32 is a common one, and it has the added bonus of being a part of the zip specification. Zip archives keep CRC32 hashes of each of the files they contain inside the zip header, so you just need to be able to parse the zip header rather than decompressing the archive, hashing the resulting file and then deleting the file afterward.

Looks like I have some research to do :). I spent the last week without wifi, and I was able to tinker around a bit with my program, but I’ve never tried to delve into hashes, .dat files, or the like. This has been a heckuva learning experience for me and I’ve already accomplished what I initially set out to do (simply create a playlist file from files in a given directory, and simply uses file names as the game titles). It is quick, and it works, but it leaves you without any real game titles in your list. But in a crunch, it can make you something LOL. But I’d like to learn more about how to program something that works better. I’d like to try the whole hash/.dat file thing. Any advice on where I should start? Currently I’m creating a program using C#. I’ve opened up one of the game .dat files and have a few ideas on how I want to approach things, but I get the feeling that I’d be going about it in a very complicated, round-about way LOL.

It sounds like you’re on the right track! The best way to learn to program is to pick a thing you want to do and then solve all of the problems involved, and then try to make it better.

With so many people offering their knowledge/time in programming, I would recommend researching a Nuget package (Check out Nuget Package Manager inside Visual Studio, or browse www.nuget.org) that could be added to your C# package that handles hashing and checksums. Personally I look at it like trying to do that part myself would be reinventing the wheel and take time/focus away from your ultimate goal of a kick-butt playlist generator. That being said, to be a responsible developer, I do believe you should have an understanding of what the concepts are and how to use them before just slapping something into your project- which it sounds like you are already well on that path.

Will do! :slight_smile:

Been continuing to do some work on this (more for myself than anything…I want to become a better programmer and this gives me something to work on), and I’m pretty proud of it so far :).

First, it should be noted that this little program isn’t intended to replace the built-in Lakka playlist generation system. Instead, it is “plan B” if Lakka doesn’t crank out a playlist for you for whatever reason.

What it won’t do:

This program will NOT do all the work for you, like the Lakka playlist generator does (such as select the appropriate core automatically). You’ll have to select most of it manually.

What it will do:

It’s a Windows program! I’m sure many are like me where Linux is a very foreign environment and most (or all) of our roms are stored on Windows machines before we migrate them to Lakka. This program will let Windows users generate playlists.

You can select if you want to use the zip file itself or files within the zip file. Never tried delving into a zip file via code before. Was a new experience for me :). It should be noted that this program will create a separate entry for whatever it finds in a zip file. It doesn’t know the difference (yet) for what is a valid rom and what isn’t.

You can select a folder and the program will create a playlist based on everything it finds in there. So if you have a folder full Atari rom files, it’ll make a playlist entry for each one. Again, it doesn’t know what is a valid rom file or not, so that part will be up to you to keep your folder “clean” LOL.

You will enter the path where you plan to store the rom files within Lakka. This will be applied to every entry within the playlist.

You will enter or select the name of the core that you’ll use. This will be applied to every entry within the playlist.

You will enter or select the name of the LPL file that you’ll generate.

Some new functionality I’ve added, you can check your file names against a DAT file and it will try to match up the name of your rom file with the associated game title name. (This isn’t done very well and is only about 95% accurate…could be done better! Just don’t know how at the moment) If you don’t do this, the program will simply use the file name for each playlist entry.

It creates a report on the generated playlist.

You can also crank out a playlist preview. This is VERY slow, but it works.

You can also check your directory of roms against an existing playlist file and it will list all the rom files from that directory that aren’t in the playlist. This is useful if you perhaps have manually tweaked a playlist and don’t want to generate a fresh one and undo all of your work. This will show you what else you can add manually.

Checking md5sums! Inspired by another post, I decided to figure out how to code this myself (was surprisingly easy). Now there is a small feature to quickly check the md5sum of a file that you browse to :).

This small little program already does WAY more than I initially intended. First, it was fun. Second, like I said, I want to become a better programmer. So adding new features worked in both areas.

Future ideas:

I’d like to figure out how to work with DAT files better. As of right now, I am most likely (actually, I am almost certain LOL) going through a DAT file very inefficiently. I check a given rom file name from a directory against a DAT file. If I find the file name text within the DAT file, I manually extract the line 15 lines above the file name. Most of the time (the 95% I mentioned earlier), the game title for that file is on that line. I parse the line and extract the game’s title and use it in the playlist.

I would also like to work with the md5sum capabilities, that way the generated playlist will be more accurate. As of right now, the names picked from the DAT file rely soley on the rom’s file name being correct.

I’d like some advice…what would be the right way (or “a” right way) to go about grabbing the information I need from a DAT file? I know I could take a file, get the md5sum from it, and run it against a DAT file and do some of the trickery I mentioned above to get a file name. But I don’t like doing that. The DAT files I’ve seen so far look like HTML. I’m thinking there has to be a better way to go about getting the information from these files than what I’ve been doing. So being very new to this, I’m out of ideas at the moment. Any advice would be welcome :).

So that is my blurb on my little program that I thought I’d share. I’d love some ideas and critiquing so I can continue to work on it and get some practice.

And here’s a pic of the program and its somewhat cluttered controls :).


Been continuing to do some work on this (more for myself than anything…I want to become a better programmer and this gives me something to work on), and I’m pretty proud of it so far :).

First, it should be noted that this little program isn’t intended to replace the built-in Lakka playlist generation system. Instead, it is “plan B” if Lakka doesn’t crank out a playlist for you for whatever reason.

What it won’t do:

This program will NOT do all the work for you, like the Lakka playlist generator does (such as select the appropriate core automatically). You’ll have to select most of it manually.

What it will do:

It’s a Windows program! I’m sure many are like me where Linux is a very foreign environment and most (or all) of our roms are stored on Windows machines before we migrate them to Lakka. This program will let Windows users generate playlists.

You can select if you want to use the zip file itself or files within the zip file. Never tried delving into a zip file via code before. Was a new experience for me :). It should be noted that this program will create a separate entry for whatever it finds in a zip file. It doesn’t know the difference (yet) for what is a valid rom and what isn’t.

You can select a folder and the program will create a playlist based on everything it finds in there. So if you have a folder full Atari rom files, it’ll make a playlist entry for each one. Again, it doesn’t know what is a valid rom file or not, so that part will be up to you to keep your folder “clean” LOL.

You will enter the path where you plan to store the rom files within Lakka. This will be applied to every entry within the playlist.

You will enter or select the name of the core that you’ll use. This will be applied to every entry within the playlist.

You will enter or select the name of the LPL file that you’ll generate.

Some new functionality I’ve added, you can check your file names against a DAT file and it will try to match up the name of your rom file with the associated game title name. (This isn’t done very well and is only about 95% accurate…could be done better! Just don’t know how at the moment) If you don’t do this, the program will simply use the file name for each playlist entry.

It creates a report on the generated playlist.

You can also crank out a playlist preview. This is VERY slow, but it works.

You can also check your directory of roms against an existing playlist file and it will list all the rom files from that directory that aren’t in the playlist. This is useful if you perhaps have manually tweaked a playlist and don’t want to generate a fresh one and undo all of your work. This will show you what else you can add manually.

Checking md5sums! Inspired by another post, I decided to figure out how to code this myself (was surprisingly easy). Now there is a small feature to quickly check the md5sum of a file that you browse to :).

This small little program already does WAY more than I initially intended. First, it was fun. Second, like I said, I want to become a better programmer. So adding new features worked in both areas.

Future ideas:

I’d like to figure out how to work with DAT files better. As of right now, I am most likely (actually, I am almost certain LOL) going through a DAT file very inefficiently. I check a given rom file name from a directory against a DAT file. If I find the file name text within the DAT file, I manually extract the line 15 lines above the file name. Most of the time (the 95% I mentioned earlier), the game title for that file is on that line. I parse the line and extract the game’s title and use it in the playlist.

I would also like to work with the md5sum capabilities, that way the generated playlist will be more accurate. As of right now, the names picked from the DAT file rely soley on the rom’s file name being correct.

I’d like some advice…what would be the right way (or “a” right way) to go about grabbing the information I need from a DAT file? I know I could take a file, get the md5sum from it, and run it against a DAT file and do some of the trickery I mentioned above to get a file name. But I don’t like doing that. The DAT files I’ve seen so far look like HTML. I’m thinking there has to be a better way to go about getting the information from these files than what I’ve been doing. So being very new to this, I’m out of ideas at the moment. Any advice would be welcome :).

So that is my blurb on my little program that I thought I’d share. I’d love some ideas and critiquing so I can continue to work on it and get some practice.

And here’s a pic of the program and its somewhat cluttered controls :).

EDIT: The forum wouldn’t let me upload a larger image, so it is pretty small.


I’ve been enjoying your thread!

If you haven’t seen this other tool yet, maybe it will be of use to you: http://libretro.com/forums/showthread.php?t=5434

I had been planning to figure out how to adapt that tool for use with Lakka but I haven’t gotten a chance to yet.

No, sure haven’t seen that. That’s pretty cool! Looks like I had some of the same ideas that they did (so I reinvented the wheel LOL…but that is ok, this was more for me and the pleasure of tacking the task than anything :slight_smile: ). I do like their “rom extension” field. I might have to implement that. And I totally forgot to have “DETECT” as an option for the core line!

I’ve got a little bit more work to do :).

Sooo…how do i get this nifty little program Waylander bro?

Cool program!

Yes, the best way to work with the dat files would be using something that natively supports working with XML, rather than parsing through it all as a text file. I basically went through the same exercise earlier this year and used PowerShell, which plays quite nicely with XML.

My script isn’t necessarily the most user friendly thing in the world, but it definitely works well enough and has a few features such as ignoring clones, specifying a date range, etc…