Author Topic: Improving the TLE download batch files  (Read 2530 times)

0 Members and 1 Guest are viewing this topic.

Offline Tim Long

  • Newbie
  • *
  • Posts: 1
  • Welcome to the Satellite Tracker Forum
Improving the TLE download batch files
« on: March 08, 2016, 01:38:57 AM »
When editing the batch files to insert my credentials, it occurred to me that they all do pretty much exactly the same thing, so it would make a lot of sense to apply the DRY (Don't Repeat Yourself) principle and factor out all the common code. One benefit of this is that it's only necessary to enter user credentials once, in one file. And I've done the work for you :) The common file is called WgetData.bat and is as follows:

SET Id=YOUR-ID-HERE
SET Password=YOUR-PASSWORD-HERE
"wget1pt15.exe" --no-check-certificate --post-data "identity=%Id%&password=%Password%" --keep-session-cookies --save-cookies=cookies.txt https://www.space-track.org/ajaxauth/login -o login.txt
"wget1pt15.exe" --no-check-certificate --keep-session-cookies --load-cookies=cookies.txt -O %1 %2
del login
del login.txt
del cookies.txt

As you can see, I've parameterized the user-id and password fields, and accept the output file name and the URL used to retrieve the data as command line parameters, therefore the batch fill should be invoked thus:

WgetData.bat output.txt "http://whatever/the/url/should/be"

Each of the other batch files then becomes a simple one-liner that calls WgetData. I've attached my edited anonymized files, they should just drop straight into the SatTrk directory. Only the WgetData.bat file needs to be edited, to insert your username and password in the first two lines of the file.


Offline John Eccles

  • Owner of Satellite Tracker and Yahoo Satellite Tracker
  • Administrator
  • *****
  • Posts: 154
    • Satellite Tracker
Re: Improving the TLE download batch files
« Reply #1 on: March 08, 2016, 12:52:07 PM »
Tim,

Yes, someone else told me about this quite a while ago so I will already be incorporating this and will be available on the next release. I didn't want to release another version just for that.
Regards, John Eccles, Owner of Satellite Tracker Application, the Satellite Tracker Forum, and the Yahoo Groups called Satellite Tracker