kevinabrandon / AboveTustin

ADS-B Twitter Bot. Uses dump1090-mutability to track airplanes and then tweets whenever an airplane flies overhead.
MIT License
72 stars 21 forks source link

Added support for config.ini. #2

Closed jprochazka closed 7 years ago

jprochazka commented 7 years ago

Please look over the changes before merging this request to make sure they are in line with your projects direction and what you were talking about when you mentioned adding a configuration file into the mix. The changes have been tested in my development environment but another pair of eyes wouldn't hurt to make sure they will work properly.

First off for the configuration file I used an ini file and configparser which is part of Python so there would be no need to add any third party modules into the mix. An example config.ini file is included named config.sample.ini which can be used as a template for the file config.ini. I tried to include any variables I deemed customizable but may have missed some so if you find any I missed feel free to add them or let me know and I will do so.

Changes in this request include:

If you have any questions, need any further changes before merging, or run into any issues with this request let me know.

jprochazka commented 7 years ago

Noticed a variable name was not matching the name found in the config.ini and changed it to match.

kevinabrandon commented 7 years ago

I just read through it and it looks great. Hopefully this weekend I'll get a chance to set it up on my system to test it out.

Thanks!

jprochazka commented 7 years ago

Cool will see about adding rudimentary custom hashtags next. You mentioned on reddit about adding different hashtags depending on altitude, heading, and ground speed. Not sure if you are just looking to change the text of the existing ones or rework the math figuring out when such hashtags are added. Without knowing I will leave this to you unless you could give some more clarity on this. Either way I can work on hashtags which do not relate to distance/altitude such as the following code...

hashtags.append(" #AboveTustin")
hashtags.append(" #RaspberryPi")
hashtags.append(" #ADSB")
hashtags.append(" #dump1090")

Making these so they are not hardcoded and configurable through the config.in file should be trivial to do. Your Thoughts on this?

But first with a configuration file available I will be taking some time to focus on adding the option to install your project using mine that is of course if you do not mind.

Also https://github.com/jprochazka/phantomjs-linux-armv7l contains an up to date v2.1.1 PhantomJS binary which I built on a Raspberry Pi 2 running Rasbian Jessie, which was not a fun experience to build until I figured out you can limit jobs, which made the build time quite longer but resulted in a clean build. It took a while but works great so far and is running on my Raspberry Pi 3 tweeting to @AboveElyria on twitter.

kevinabrandon commented 7 years ago

Hi Joe, I finally got around to playing with it tonight and the configuration file worked great!

I went ahead and added a couple things to the config file under a new heading [tweet].

  1. tweet_template. This is a simple substitution template where the user can add their own custom tweet. They're able to substitute flight names, heading, speed and other variables into it (see the sample config for an example, and all the options available to the user).
    1. default_hashtags. This is a place for users to add default hashtags. Simply add to this var all the hashtags separated by a space.

I'm still thinking about how to allow users to add conditional hashtags. You'll see that I still have some hardcoded in. I'm investigating some template packages that support conditionals, but so far the syntax looks very dense. If you have any ideas please let me know.

And of course, feel free to move forward with adding my project into your own. I'm super excited about it.