Skip to content

Commit

Permalink
transparently load tle source from leosatdata
Browse files Browse the repository at this point in the history
  • Loading branch information
dernasherbrezon committed Nov 24, 2024
1 parent e9b56ef commit 6324a26
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main/java/ru/r2cloud/cloud/LeoSatDataClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ private Tle readTle(JsonValue tle) {
Tle result = new Tle(new String[] { line1, line2, line3 });
// assume downloaded TLE is always fresh
result.setLastUpdateTime(clock.millis());
result.setSource(hostname);
result.setSource(tleObj.getString("source", null));
if (result.getSource() == null) {
result.setSource(hostname);
}
return result;
}

Expand Down
1 change: 1 addition & 0 deletions src/test/java/ru/r2cloud/cloud/LeoSatDataClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public void testLoadNewLaunch() throws Exception {
List<Satellite> result = client.loadNewLaunches(0);
assertEquals(2, result.size());
assertSatellite("LUCKY-7", true, result.get(0));
assertEquals("Satellite team", result.get(0).getTle().getSource());
// by default all enabled
assertSatellite("PAINANI 1", true, result.get(1));
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/r2cloudclienttest/newlaunch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"tle": {
"line1": "LUCKY-7",
"line2": "1 44406U 19038W 20069.88080907 .00000505 00000-0 32890-4 0 9992",
"line3": "2 44406 97.5270 32.5584 0026284 107.4758 252.9348 15.12089395 37524"
"line3": "2 44406 97.5270 32.5584 0026284 107.4758 252.9348 15.12089395 37524",
"source": "Satellite team"
},
"start": 1639300332000,
"end": 1639386732000
Expand Down

0 comments on commit 6324a26

Please sign in to comment.