From 44fcda26d40b764cc961731ab40d426f20714434 Mon Sep 17 00:00:00 2001 From: Jogi Hofmüller Date: Tue, 23 Aug 2011 10:10:52 +0000 Subject: - added creation of tle.js to MmdSatellite.py git-svn-id: https://svn.spreadspace.org/mur.sat@144 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- tools/mmd/MmdSatellite.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tools') diff --git a/tools/mmd/MmdSatellite.py b/tools/mmd/MmdSatellite.py index 9e9a041..e3f46af 100644 --- a/tools/mmd/MmdSatellite.py +++ b/tools/mmd/MmdSatellite.py @@ -151,6 +151,21 @@ class Satellite: return self._compareAndLinkNewTLEFile (filename) return False + def _createOrbtrackTLEFile (self): + tle_file = open (self.tel_filename).read () + orbtrack_file = open ("/var/www/hofos.at/mmd/static/tle.js", "w") + orbtrack_file.write ("\\\\{0}\nPLib.tleData = \n[".format (time.strftime ("%Y%m%d - %H%M%S"))) + count = 0 + for line in tle_file.readlines (): + if count == 2: + orbtrack_file.write (line[:-1]) + else: + orbtrack_file.write (line) + count += 1 + orbtrack_file.write ("];") + tel_file.close () + orbtrack_file.close () + def _compareAndLinkNewTLEFile (self, filename): ''' we should use field 21-32 from first line of TLE to @@ -164,6 +179,7 @@ class Satellite: return False os.unlink (self.tle_filename) os.symlink (filename, self.tle_filename) + self._createOrbtrackTLEFile () return True def _updateTrajectory (self): -- cgit v1.2.3