Jump to content
LaunchBox Community Forums

Series field for non-arcade games


Dinhani

Recommended Posts

It seems that only Arcade/MAME games have the Series field populated.

I was expecting to find console games like Pokemon, Donkey Kong Country, Paper Mario and several other to have this field populated, but it is always empty.

Is there a way to start populating this field for non-arcade games in the official metadata database?

  • Like 1
Link to comment
Share on other sites

With some Python scripting, I was able to populate other platforms series based on Wikipedia/Wikidata data.

First I exported a CSV file with all available games and series from Wikidata with this SPARQL query.

Then I wrote a script that gets the WikipediaURL field from games metadata and tries to match it with the Wikipedia URL in the Series CSV file. Based on the matches I populate the Series field.

Now almost all games have the field populated.


The query I used in case it goes offline on Wikidata:

SELECT
    (?Game AS ?GameID) ?GameLabel ?GameLink (?Series AS ?SeriesID) ?SeriesLabel
WHERE {
    SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . }
    ?Game wdt:P31 wd:Q7889 .
    OPTIONAL {
        ?GameLink schema:about ?Game .
        ?GameLink schema:inLanguage 'en' .
        ?GameLink schema:isPartOf <https://en.wikipedia.org/> .
    }
    ?Game wdt:P179 ?Series .
}

Edited by Dinhani
  • Like 1
Link to comment
Share on other sites

Wow, that's amazing! Would it be possible that you share the script you used. I don't really know anything about coding but I don't mind taking a look to see if I can get this  to work

Edited by GlauberC
misspelling
Link to comment
Share on other sites

Nice job with the script there, that is a very cool idea! To clarify, the LaunchBox Games DB doesn't contain any series information (even for arcade). The series info you see for arcade is coming from MAME, as MAME has a built-in function that generates a giant text file filled with a ton of info about all the games they support and we generate that file from MAME and use it to populate all metadata fields.

The reason we don't populate the LaunchBox games DB with series information is that it is incredibly subjective (some people prefer the main series, others want each individual sub-series, and some want them both). So right now we leave it up to the user to define. That said, we could certainly do a better job of offering some ways for users to grab this info, and arguably it is a bit confusing that we fill it in for arcade (albeit via MAME) but not others.

But great job on the script there, I haven't had a chance to test it myself but seems like it could fill a good use-case 🙌

Link to comment
Share on other sites

@GlauberC 

I attached in this post the script and data for you to use.

You need to adjust the value on line 13 with the path to your LaunchBox installation.

Please be careful because it will read and write all you imported games and it will clear the Series field from all games before updating.

Make a backup of all your data before running it.

launchbox-set-series-field.py Series.csv

Edited by Dinhani
  • Thanks 1
Link to comment
Share on other sites

thanks!! i ran into a few problems regarding python and some syntax as well (I think that the problem was that I was using "\" insted of "/" in the path folder but I'm not sure)

just in case someone have the same problem I did, make sure to get lxml and polars after installing python
 

pip install lxml
pip install polars

(not 100% sure if that's actually needed because I'm not a programmer but it did work for me)

Link to comment
Share on other sites

@GlauberC

Your instructions are correct, these two commands are necessary to install the dependencies to parse the CSV and XML files.

For the path, you can use "/" as you mentioned, or in case of backslashes, you can use double backslask "\\" because single backslash have special meaning in programming languages.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...