-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0244c0b
Showing
11 changed files
with
610 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bin/ | ||
secret.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
windows: | ||
mkdir -p bin/windows | ||
env GOOS=windows GOARCH=amd64 go build -o bin/windows/realweather.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# DCS Real Weather Updater | ||
|
||
## About | ||
|
||
Replaces static weather data in DSC mission file with METAR reported data from | ||
ICAO of choice. | ||
|
||
Not extensively tested. | ||
|
||
## Usage | ||
|
||
Edit config.json and replace API key with one generated from | ||
[checkwx](https://www.checkwxapi.com/). Update ICAO with icao of airport of your | ||
choosing. By default the program will set the mission time to system time, but | ||
this can be adjusted by changing the time-offset in config file to an integer. | ||
This integer will ofset time by x hours. | ||
|
||
Put binary into own directory with config and move "mission.miz" into directory | ||
before executing. It will produce a new missionfile called mission.miz. | ||
|
||
It is recommended to use an external script to call this program. An example | ||
batch file is provided inside /examples. Note that the binary will expect the | ||
curent working directory to be inside its parent directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"api-key": "", | ||
"icao": "", | ||
"time-offset": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"api-key": "some string from checkwx", | ||
"icao": "UGKO", | ||
"time-offset": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@echo off | ||
|
||
:: Assumes following directory structure: | ||
:: - parent-dir/ | ||
:: - Missions/ | ||
:: - backups/ | ||
:: - mission.miz | ||
:: - realweather/ | ||
:: - realweather.exe | ||
:: - replace_mission.bat | ||
|
||
:: Make backup of current mission file | ||
copy "Missions\mission.miz" "Missions\backups\mission.miz" | ||
set d=%date:~-4,4%%date:~0,2%%date:~-7,2% | ||
set d=%d: =_% | ||
set t=%time:~0,2%%time:~3,2%%time:~6,2% | ||
set t=%t: =0% | ||
rename "Missions\backups\mission.miz" "%d%_%t%_mission.miz" | ||
|
||
:: Move mission into realweather working directory and move updated mission | ||
:: back into missions folder | ||
move "Missions\mission.miz" "realweather\mission.miz" :: realweather expects "mission.miz" | ||
cd realweather :: CWD must be parent directory of binary | ||
call realweather.exe | ||
cd .. | ||
move "realweather\realweather.miz" "Missions\DSMC_Gorgas_001.miz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/evogelsa/DCS-real-weather | ||
|
||
go 1.14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/evogelsa/DCS-real-weather/miz" | ||
"github.com/evogelsa/DCS-real-weather/util" | ||
"github.com/evogelsa/DCS-real-weather/weather" | ||
) | ||
|
||
func main() { | ||
// get METAR report | ||
data := weather.GetWeather() | ||
|
||
// unzip mission file | ||
_, err := miz.Unzip() | ||
util.Must(err) | ||
|
||
// update mission file with weather data | ||
miz.Update(data) | ||
|
||
// repack mission file contents and form realweather.miz output | ||
miz.Zip() | ||
|
||
// remove unpacked contents from directory | ||
miz.Clean() | ||
} |
Oops, something went wrong.