Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue49 #53

Merged
merged 7 commits into from
Mar 19, 2017
Merged

Issue49 #53

merged 7 commits into from
Mar 19, 2017

Conversation

oyvkar
Copy link
Contributor

@oyvkar oyvkar commented Mar 19, 2017

Fix #49

Adds a python script for getting transponder information from db.satnogs.org/api.

Copy link
Member

@bjorgan bjorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice, but I have some minor comments.

previous_norad_id = False

# Iterate through SatNOGS database
for i in sorteddata:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use something else than i, satellite or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit commit 2c7cf97

Renaming i to transponder

previous_norad_id = i['norad_cat_id']

# Add transponder data
db.write("%s - Inverting = %r " %(i['description'], i['invert']))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Write "inverting" when inverting = True, but not otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2c7cf97

if not i['baud']:
db.write("- Baud = %s " %i['baud'])
if not i['alive']:
db.write("Not currently alive\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Write only "(dead)"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2c7cf97

db.write("No weekly schedule\n")
db.write("No orbital schedule\n")

db.write("end\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also the file be closed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File is automatically closed when stepping down to the same indentation level with open was called from.


#Step 1: Fetch JSON transponder information from SatNOGS db.
request = urllib2.urlopen("https://db.satnogs.org/api/transmitters")
data = json.load(request)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of these two lines seem to hang indefinitely (or near indefinitely) when internet is unavailable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could not reproduce with python 2.7.13

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, probably network configuration errors on my own end. Fails properly on other configurations.


# Add transponder data
db.write("%s - Inverting = %r " %(i['description'], i['invert']))
if not i['baud']:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to write "Baud = 0" to the file regardless.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2c7cf97

else:
db.write(" - Non-inverting")
if transponder['baud']>0:
db.write(" - Baud = %s " %transponder['baud'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove superfluous space after the baud string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7304193

@oyvkar oyvkar merged commit af2f68a into master Mar 19, 2017
@oyvkar oyvkar deleted the issue49 branch March 19, 2017 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants