Here is a simple code designed for multiple programming languages to fetch vatsim metar interface data. It addresses certain shortcomings in the FSD program. Please modify the weather section in the 'fsd.conf' file to '[weather] source=file'. This adjustment will enable you to access the necessary metar information within Euroscope.
- The python version requires you to install os, requests, and time modules, otherwise it cannot run
pip install os
pip install requests
pip install time
- After installing these modules, run the following code to execute FSD-Metar-GetMessage.py. It will fetch metar content for you and save it to metar.txt. (By default, it runs every 1800 seconds, and you can modify it according to your personal needs.)
python FSD-Metar-GetMessage.py
- Open the "Task Scheduler" application.
- Click on "Create Basic Task" and follow the prompts to set up a new task.
- Choose a name and description for the task.
- Select "Daily" and set the recurrence to occur every 1 day(s).
- Choose a start date and time for the task.
- Select "Start a Program" and click "Next."
- Browse and locate the program/script you want to run (curl.exe or wget.exe) in the "Program/script" field.
- In the "Add arguments (optional)" field, provide the URL path of your FSD-Metar-GetMessage.php script.
- Click "Next" and review your settings. Click "Finish" to create the task.
- Right-click on the newly created task, select "Properties," go to the "Triggers" tab, and modify the trigger to recur every 30 minutes instead of daily.
- Open the terminal.
- Run crontab -e to edit the cron jobs for the current user.
- Add a new line to the crontab with the following format:
*/30 * * * * curl https://your-server-path/FSD-Metar-GetMessage.php
Replace https://your-server-path/FSD-Metar-GetMessage.php with the actual URL path to your FSD-Metar-GetMessage.php script.
4. Save and exit the crontab editor.
Both of these methods will schedule the task to run every 30 minutes, triggering the specified URL path of FSD-Metar-GetMessage.php. Make sure you replace placeholders with the actual paths and URLs specific to your environment.
- Make sure you have Go installed on your system.
- Copy the code to a file named, for example, "main.go".
- Open a terminal and navigate to the directory containing the "main.go" file.
- Run the program using the command: go run main.go.
- Once the program is running, you can access the URL http://localhost:6327/fetch-metar in your browser or through an HTTP request tool to trigger the fetching and saving of metar data. The saved data will be in the "metar.txt" file.
- For implementing scheduled execution, you can refer to tutorials on how to achieve similar functionality using PHP. This will give you insights into creating scheduled tasks or cron jobs in a different programming language.
This script is provided under the GNU GENERAL PUBLIC LICENSE 3.0. You are free to use, modify, and distribute this code under the terms of this license. See LICENSE for more details.
Looking forward to your ⭐️ Star!