Hello, I'm new here and this is my first post. I've been digging into the code for pi-star quite a bit and have made some progress, but would like to reach out for some potential support or ideas.
What I'm looking to do is store what is displayed in the dashboard for contacts to a MySql database table. I've managed to do this by inserting code in the lh.php script (lastHeard). However, this is, by default, called once a second, I believe it is, in the dashboard. So, I get duplicate entries every time the script is called for the same transmission entry. I mainly am interested in time, callsign, and duration of transmission. From my digging through the code, it seems the dashboard display is derived from the existing log file that is created.
My question here is can anyone point me in the right direction as to where to insert my database entry code or easily access the information displayed on the dashboard? I know it is all stored in the lastheard array. I'm just struggling to find the best place to have this constantly run, ideally in the background without even having to have the dashboard open.
Trying to Store Log to Database
Re: Trying to Store Log to Database
The simple answer is, dont do it from the dashboard.
There are a number of reasons for this, not least that the dashboard is updated, and your code will vanish at some point, but also that is entirely driven by a user interacting with the dashboard. What you want to do is to read the log file and process each new line - thats not entirely trivial either, but it is possible.
You will probably need to write some kind of tool do to the job and then run it as a daemon.
Again I wouldn't suggest PHP for that, you can run PHP on the command line but there are better ways.
Hope that helps.
There are a number of reasons for this, not least that the dashboard is updated, and your code will vanish at some point, but also that is entirely driven by a user interacting with the dashboard. What you want to do is to read the log file and process each new line - thats not entirely trivial either, but it is possible.
You will probably need to write some kind of tool do to the job and then run it as a daemon.
Again I wouldn't suggest PHP for that, you can run PHP on the command line but there are better ways.
Hope that helps.