Entire system data to MySQL database

General discussion for players of Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
pleiadian
Deadly
Deadly
Posts: 143
Joined: Mon Feb 20, 2017 2:14 pm

Entire system data to MySQL database

Post by pleiadian » Tue Nov 14, 2017 12:49 pm

So I just finished what I wanted to do quite some time ago. I created a PHP script aiding you in the fantastic task of inserting Oolite's entire solar system information (planetinfo.plist) into a MySQL database of your choosing.

I'm sure this opens the door to quite some interesting 3rd party web-based tool creation possibilities.

Here it is:
https://github.com/thepleiadian/convert_planetinfo

The repo contains the current planetinfo.plist as well as a .sql file of the finished result.

Obviously open-sourced. Enjoy!


// EDIT:
I know the script is not perfect, but probably a good starting point. The defaults are - database: oolite_data, table: oolite_maps

User avatar
pleiadian
Deadly
Deadly
Posts: 143
Joined: Mon Feb 20, 2017 2:14 pm

Re: Entire system data to MySQL database

Post by pleiadian » Wed Nov 15, 2017 12:44 pm

Updated the script so that each solar system now has a unique ID. This might be useful for other tools such as trade, or item databases. GitHub includes updated script and new version of the SQL-file.

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5394
Joined: Wed Feb 28, 2007 7:54 am

Re: Entire system data to MySQL database

Post by another_commander » Wed Nov 15, 2017 1:31 pm

I think that what might be useful here could be the ability to re-export the SQL file as a planetinfo.plist, after changes have been applied. This could help with changing large chunks of the plist or per-system-specific changes. One could use database software to make queries and maybe changes, then export back the result to a format understandable by Oolite. An example could be the relatively recent change where we reduced the default ambient light in all systems to 0.25. I had to write a quick'n'dirty little program to do it, but that could have been handled maybe as described above.

Possible?

User avatar
pleiadian
Deadly
Deadly
Posts: 143
Joined: Mon Feb 20, 2017 2:14 pm

Re: Entire system data to MySQL database

Post by pleiadian » Wed Nov 15, 2017 2:09 pm

That shouldn't present too much of a problem. Simply perform the changes in the SQL DB, and then hit the button... I think I can manage that

User avatar
pleiadian
Deadly
Deadly
Posts: 143
Joined: Mon Feb 20, 2017 2:14 pm

Re: Entire system data to MySQL database

Post by pleiadian » Mon Nov 20, 2017 10:14 am

I have added a script that does what you asked for. It pumps out a valid planetinfo.plist file inside your browser... just save it as that file and you're good to go.

https://github.com/thepleiadian/convert ... _plist.php

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5394
Joined: Wed Feb 28, 2007 7:54 am

Re: Entire system data to MySQL database

Post by another_commander » Mon Nov 20, 2017 1:36 pm

Can't test it right now, but thanks for doing that. It should hopefully make editing of the tricky planetinfo datafile much easier.

Post Reply