Giter Club home page Giter Club logo

jxck-s / plane-notify Goto Github PK

View Code? Open in Web Editor NEW
2.5K 60.0 437.0 2.02 MB

Notify if a selected plane has taken off or landed using ADS-B data. Compares older data to newer data to determine if a landing or takeoff has occurred. As well as nav modes, emergency squawk and resolution advisory notifications. Can output to Twitter, Discord, Mastodon, and Telegram

License: GNU General Public License v3.0

Python 99.31% Dockerfile 0.69%
opensky-api ads-b adsbexchange adsb plane opensky adsbx opensky-network airport land

plane-notify's Issues

Chromium failing to screenshot

Device

Tested on Raspberrypi 3B+ and Ubuntu 20.04.4 (both with the correct arch for Chromium)

Bug description

When a landing event occurs, the screenshot function fails as Chromium (browser/driver) isn't correctly recognized, and so crash without taking the screenshot to send it over Twitter, also quitting the program.

Output for Raspberrypi

====== WebDriver manager ======
Could not get version for google-chrome.Is google-chrome installed?
Get LATEST chromedriver version for None google-chrome
There is no [linux32] chromedriver for browser None in cache
Trying to download new driver from https://chromedriver.storage.googleapis.com/102.0.5005.61/chromedriver_linux32.zip
Traceback (most recent call last):
  File "/home/pi/plane-notify/__main__.py", line 217, in <module>
    raise e
  File "/home/pi/plane-notify/__main__.py", line 165, in <module>
    obj.run_opens(dataState)
  File "/home/pi/plane-notify/planeClass.py", line 98, in run_opens
    self.run_check()
  File "/home/pi/plane-notify/planeClass.py", line 440, in run_check
    get_adsbx_screenshot(self.map_file_name, url_params, overrides=self.overrides)
  File "/home/pi/plane-notify/defSS.py", line 21, in get_adsbx_screenshot
    browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
  File "/home/pi/.local/share/virtualenvs/plane-notify-lBc-1MAR/lib/python3.9/site-packages/webdriver_manager/chrome.py", line 32, in install
    driver_path = self._get_driver_path(self.driver)
  File "/home/pi/.local/share/virtualenvs/plane-notify-lBc-1MAR/lib/python3.9/site-packages/webdriver_manager/manager.py", line 23, in _get_driver_path
    file = download_file(driver.get_url(), driver.ssl_verify)
  File "/home/pi/.local/share/virtualenvs/plane-notify-lBc-1MAR/lib/python3.9/site-packages/webdriver_manager/utils.py", line 102, in download_file
    validate_response(response)
  File "/home/pi/.local/share/virtualenvs/plane-notify-lBc-1MAR/lib/python3.9/site-packages/webdriver_manager/utils.py", line 90, in validate_response
    raise ValueError("There is no such driver by url {}".format(resp.url))
ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/102.0.5005.61/chromedriver_linux32.zip

Output for Ubuntu 20.04.4

====== WebDriver manager ======
Could not get version for google-chrome.Is google-chrome installed?
Get LATEST chromedriver version for None google-chrome
Driver [/home/user/.wdm/drivers/chromedriver/linux64/102.0.5005.61/chromedriver] found in cache
Traceback (most recent call last):
  File "/home/user/Documents/plane-notify/__main__.py", line 217, in <module>
    raise e
  File "/home/user/Documents/plane-notify/__main__.py", line 172, in <module>
    obj.run_empty()
  File "/home/user/Documents/plane-notify/planeClass.py", line 276, in run_empty
    self.run_check()
  File "/home/user/Documents/plane-notify/planeClass.py", line 440, in run_check
    get_adsbx_screenshot(self.map_file_name, url_params, overrides=self.overrides)
  File "/home/user/Documents/plane-notify/defSS.py", line 21, in get_adsbx_screenshot
    browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
  File "/home/user/.local/share/virtualenvs/plane-notify-IzQ_oObS/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/home/user/.local/share/virtualenvs/plane-notify-IzQ_oObS/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 93, in __init__
    RemoteWebDriver.__init__(
  File "/home/user/.local/share/virtualenvs/plane-notify-IzQ_oObS/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 269, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/user/.local/share/virtualenvs/plane-notify-IzQ_oObS/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 360, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/user/.local/share/virtualenvs/plane-notify-IzQ_oObS/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 425, in execute
    self.error_handler.check_response(response)
  File "/home/user/.local/share/virtualenvs/plane-notify-IzQ_oObS/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/local/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x55a23b5dbf33 <unknown>
#1 0x55a23b326118 <unknown>
#2 0x55a23b349678 <unknown>
#3 0x55a23b344d5a <unknown>
#4 0x55a23b37fd3a <unknown>
#5 0x55a23b379e63 <unknown>
#6 0x55a23b34f82a <unknown>
#7 0x55a23b350985 <unknown>
#8 0x55a23b6204cd <unknown>
#9 0x55a23b6245ec <unknown>
#10 0x55a23b60a71e <unknown>
#11 0x55a23b625238 <unknown>
#12 0x55a23b5ff870 <unknown>
#13 0x55a23b641608 <unknown>
#14 0x55a23b641788 <unknown>
#15 0x55a23b65bf1d <unknown>
#16 0x7f7c5ac7d609 <unknown>


Observations

Chromedriver works fine (and is the same version as browser in case of).

/usr/lib/chromium-browser/chromedriver
Starting ChromeDriver 102.0.5005.63 (898ca5734597d1583932dfeaec82dd24db2e5d62-refs/heads/main@{#999047}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

As there's no GUI on the raspberrypi, Chromium browser can't run by himself (shouldn't be a problem considering defSS.py).

chromium-browser
/etc/chromium.d/README: line 1: Any: command not found
[27639:27639:0608/175454.647174:ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY
[27639:27639:0608/175454.657399:ERROR:env.cc(225)] The platform failed to initialize.  Exiting.


Any idea about this issue ? Thanks.

feature request:

calculate and announce released CO2 per flight. should be pretty easy to do.

xdg-open errors when taking screenshot

This doesn't seem to prevent a screenshot from being taken, the logs are being littered with statements when a screenshot is being taken.

Example:

/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening '/tmp/tmp_4uaq8w5.PNG'

I believe this is caused by f600964 but haven't dug enough to know for sure

credentials can be accidentially checked in

both main and plane configs need to be updated with secrets. Doing so requires modification of versioned files which can be easily checked in by accident. It would be nice if these files weren't versioned to prevent this from happening

Export Data into mysql-DB?

Hi!
I use this script on my own server. It works good!
Is it possible to add an option in the ini file to export the data into an mysql-database? The aircraft-data without the taken picture.

Regards,
Lars

Ubuntu 22.10 Python 3.10

When I try to run all the commands from the plane-notify readMe, it tell me I need to be running Python 3.9 instead of Python 3.10. Has anybody else run into this problem? If so, how did/do you solve it? I tried uninstalling Python 3.10, but that made Ubuntu 22.10 basically useless. How do I downgrade? Thanks!

No Output and Attibute Error Message

Hi

Firstly, I'm very new to Python so forgive me.

I think I have the program running and it seems to be checking regularly as expected; however, as soon as the Plane takes off (I presume it then starts to output and thats when the error is triggered. I am using PushBullet to receive the output, the program stops with the following error below.

I am using OpenSky as the source currently.

C:\PythonPrograms\plane-notify-multi>python main.py
Already have Roboto-Regular.ttf continuing
Already have airports.csv continuing
Already have regions.csv continuing
Already have ADSBX_Logo.png continuing
Already have Mictronics_db.zip continuing
C:\PythonPrograms\plane-notify-multi
Route lookup is disabled
Source is set to OPENS
Found the following configs
./configs\plane1.ini
1 Planes configured
-------- 1 -------- 12:55:58 PM --------------------------------------------------------------------
---BEGIN---------./configs\plane1.ini------------------------------------------------ICAO: 4006C2---
Traceback (most recent call last):
File "C:\PythonPrograms\plane-notify-multi_main_.py", line 217, in
raise e
File "C:\PythonPrograms\plane-notify-multi_main_.py", line 165, in
obj.run_opens(dataState)
File "C:\PythonPrograms\plane-notify-multi\planeClass.py", line 83, in run_opens
self.dict.update({'icao' : ac_dict.icao24.upper(), 'callsign' : ac_dict.callsign, 'latitude' : ac_dict.latitude, 'longitude' : ac_dict.longitude, 'on_ground' : bool(ac_dict.on_ground), 'squawk' : ac_dict.squawk, 'track' : float(ac_dict.heading)})
AttributeError: 'StateVector' object has no attribute 'heading'

This error happens as I'm literally watching the flight from ADBS take off;

image

As soon as the plane takes off, I manually check the JSON for this plane and it returns the following;

image

This would show the plane as on the ground?? So that tells me their API has not updated?

I can see ADS-B API is preferred, but I cannot see where I can purchase a key (one that is not RapidAPI)? Or is there a test one I can use.

Any advise of what is happening here would be gratefully received!

Thank you in advance!

RapidAPI

Someone creating integration with RapidAPI?

Bug: defOpenSky.py not applying correct username and password

The defOpenSky.py file used to interact with the OpenSkyApi has a bug that prevents OpenSky authentication.

Expected behavior:
When properly authenticated, the OpenSky user account should be used to gather the data so the X-Rate-Limit-Remaining API header would be adjusted to the user settings at OpenSky with a 1000 or 2000 requests per day limit. When not authenticated only 100 requests are available per day.

The error is in line 8 of the defOpenSky.py:
opens_api = OpenSkyApi(username= None if main_config.get('OPENSKY', 'USERNAME').upper() == "NONE" else main_config.get('OPENSKY', 'USERNAME'), password= None if main_config.get('OPENSKY', 'PASSWORD').upper() == "NONE" else main_config.get('OPENSKY', 'PASSWORD').upper())
It should be replaced with:
opens_api = OpenSkyApi(username= None if main_config.get('OPENSKY', 'USERNAME').upper() == "NONE" else main_config.get('OPENSKY', 'USERNAME'), password= None if main_config.get('OPENSKY', 'PASSWORD').upper() == "NONE" else main_config.get('OPENSKY', 'PASSWORD'))

Removing the last .upper().

After applying the change the OpenSkyAPI behaves as expected.

Greetings
ElPartal

feature request:

Lot of people have a problem with setting it up. Could you do a .exe version?
With a place to put a ID of a plane. I think a lot of people would be grateful. :)

Is there a way to purchase a development account on Twitter to run this?

Since Elon banned ElonJet even though he claims to be a bastion of free speech, we need to multiply. He lied to us after claiming he wouldn't ban it:

https://twitter.com/elonmusk/status/1589414958508691456

Elon is a liar and must be punished :) How can we purchase access to the Twitter API? The official approval process probably isn't being staffed by anyone at the moment. If someone could point me to how I can purchase a bot account from a third party (who is reputable obviously) that would be great.

Change Screenshot from ADSBX

With the recent sale of ADSBX, I was curious what it would take to change what site it takes a screenshot of. I know you can use Google Maps instead, but I'd like to use one of the other ADSB sites coming online. I tried making a few changes that I thought would fix it, but it crashed instead. There is a growing list of maps now out there running ADSB software that could be used.

Thoughts on this change?

Error Exiting: an integer is required (got type NoneType) Failed on C8277E

This message keeps popping up and making the program crash

2022-04-17 07:42:04,755 - an integer is required (got type NoneType)
2022-04-17 07:42:04,756 - Traceback (most recent call last):
File "/root/RSC/main.py", line 163, in
obj.run_opens(dataState)
File "/root/RSC/planeClass.py", line 71, in run_opens
self.last_pos_datetime = datetime.fromtimestamp(ac_dict.time_position)

Install problem: What am I missing or doing wrong?

I'm trying to install plane-notify on RasPiOS Bullseye (Lite, but with X11 stuff install, if it matters), but without success.

Up front: I'm reasonably Linux and Python literate, but have never used pipenv, which of course is where I'm running into problems.

The README says to do pipenv install before doing the clone. When I do that pipenv creates the virtualenv in the user's directory. Then I clone, run screen, and pipenv run gets

p83~/plane-notify# pipenv run python __main__.py
Creating a virtualenv for this project...
Pipfile: /root/plane-notify/Pipfile
Using /bin/python3.9 (3.9.2) to create virtualenv...
⠇ Creating virtual environment...created virtual environment CPython3.9.2.final.0-64 in 412ms
  creator CPython3Posix(dest=/root/.local/share/virtualenvs/plane-notify-3tWUBZ4y, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: pip==22.3.1, setuptools==65.6.3, wheel==0.38.4
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: /root/.local/share/virtualenvs/plane-notify-3tWUBZ4y
Traceback (most recent call last):
  File "/root/plane-notify/__main__.py", line 3, in <module>
    from colorama import Fore, Back, Style
ModuleNotFoundError: No module named 'colorama'

OK, so it looks like the virtualenv is created in the current directory, so try 2: clone and then do pipenv install inside the plane-notify directory. So, on a fresh OS install I install everything, then clone, then cd plane-notify and do pipenv install.

pipenv install gets a literal TON of errors (see the bottom of this issue), and not surprisingly when I screen and pipenv run I get

p83~/plane-notify# pipenv run python __main__.py
Traceback (most recent call last):
  File "/root/plane-notify/__main__.py", line 3, in <module>
    from colorama import Fore, Back, Style
ModuleNotFoundError: No module named 'colorama'
p83~/plane-notify#

Also tried it on RasPiOS Buster, but that failed in ways that convinced me Buster was a no-go.

I'm befuddled at the moment, and would appreciate any and all guidance on how to get this installed and running.

Thanks!

Output from pipenv install in try 2 (done after the clone, in the plane-notify directory)

p83~/plane-notify# pipenv install
Creating a virtualenv for this project...
Pipfile: /root/plane-notify/Pipfile
Using /bin/python3.9 (3.9.2) to create virtualenv...
⠇ Creating virtual environment...created virtual environment CPython3.9.2.final.0-64 in 2017ms
  creator CPython3Posix(dest=/root/.local/share/virtualenvs/plane-notify-3tWUBZ4y, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: pip==22.3.1, setuptools==65.6.3, wheel==0.38.4
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: /root/.local/share/virtualenvs/plane-notify-3tWUBZ4y

Installing dependencies from Pipfile.lock (02fd05)...
An error occurred while installing appdirs==1.4.4 --hash=sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128 --hash=sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41! Will try again.
An error occurred while installing apscheduler==3.6.3 --hash=sha256:3bb5229eed6fbbdafc13ce962712ae66e175aa214c69bed35a06bffcf0c5e244 --hash=sha256:e8b1ecdb4c7cb2818913f766d5898183c7cb8936680710a4d3a966e02262e526! Will try again.
An error occurred while installing async-generator==1.10 ; python_version >= '3.5' --hash=sha256:01c7bf666359b4967d2cda0000cc2e4af16a0ae098cbffcb8472fb9e8ad6585b --hash=sha256:6ebb3d106c12920aaae42ccb6f787ef5eefdcdd166ea3d628fa8476abe712144! Will try again.
An error occurred while installing attrs==22.1.0 ; python_version >= '3.5' --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c! Will try again.
An error occurred while installing beautifulsoup4==4.11.1 --hash=sha256:ad9aa55b65ef2808eb405f46cf74df7fcb7044d5cbc26487f96eb2ef2e436693 --hash=sha256:58d5c3d29f5a36ffeb94f02f0d786cd53014cf9b3b3951d42e0080d8a9498d30! Will try again.
An error occurred while installing cachetools==4.2.2 ; python_version ~= '3.5' --hash=sha256:61b5ed1e22a0924aed1d23b478f37e8d52549ff8a961de2909c69bf950020cff --hash=sha256:2cc0b89715337ab6dbba85b5b50effe2b0c74e035d83ee8ed637cf52f12ae001! Will try again.
An error occurred while installing certifi==2022.9.14 ; python_version >= '3.6' --hash=sha256:e232343de1ab72c2aa521b625c80f699e356830fd0e2c620b465b304b17b0516 --hash=sha256:36973885b9542e6bd01dea287b2b4b3b21236307c56324fcc3f1160f2d655ed5! Will try again.
... a bunch more "an error occurred" ...
Installing initially failed dependencies...
[pipenv.exceptions.InstallError]: Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
[pipenv.exceptions.InstallError]: Ignoring cffi: markers 'os_name == "nt" and implementation_name != "pypy"' don't match your environment
[pipenv.exceptions.InstallError]: Collecting appdirs==1.4.4
[pipenv.exceptions.InstallError]:   Using cached https://www.piwheels.org/simple/appdirs/appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
[pipenv.exceptions.InstallError]: Collecting apscheduler==3.6.3
[pipenv.exceptions.InstallError]:   Using cached https://www.piwheels.org/simple/apscheduler/APScheduler-3.6.3-py2.py3-none-any.whl (58 kB)
[pipenv.exceptions.InstallError]: Collecting async-generator==1.10
[pipenv.exceptions.InstallError]:   Using cached https://www.piwheels.org/simple/async-generator/async_generator-1.10-py3-none-any.whl (18 kB)
[pipenv.exceptions.InstallError]: Collecting attrs==22.1.0
[pipenv.exceptions.InstallError]:   Using cached https://www.piwheels.org/simple/attrs/attrs-22.1.0-py2.py3-none-any.whl (58 kB)
[pipenv.exceptions.InstallError]: ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
[pipenv.exceptions.InstallError]:     attrs==22.1.0 from https://www.piwheels.org/simple/attrs/attrs-22.1.0-py2.py3-none-any.whl#sha256=6d9391612040005651f4f45d6bfc257484a8f93f15ffdcf3f8dbd21f9e20ce39 (from -r /tmp/pipenv-fla9g0hr-requirements/pipenv-txn2p6rs-hashed-reqs.txt (line 4)):
[pipenv.exceptions.InstallError]:         Expected sha256 29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6
[pipenv.exceptions.InstallError]:         Expected     or 86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c
[pipenv.exceptions.InstallError]:              Got        6d9391612040005651f4f45d6bfc257484a8f93f15ffdcf3f8dbd21f9e20ce39
...Followed by another large block of errors...
ERROR: Couldn't install package: [Requirement(_name='appdirs', vcs=None, req=NamedRequirement(name='appdirs', version='==1.4.4', req=Requirement.parse('appdirs==1.4.4'), extras=[], editable=False, _parsed_line=<Line (editable=False, name=appdirs, path=None, uri=None, extras=(), markers=None, vcs=None, specifier===1.4.4, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=appdirs==1.4.4)>), markers=None, _specifiers='==1.4.4', index=None, editable=False, hashes=frozenset({'sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128', 'sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41'}), extras=(), abstract_dep=None, _line_instance=<Line (editable=False, name=appdirs, path=None, uri=None, extras=(), markers=None, vcs=None, specifier===1.4.4, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=appdirs==1.4.4)>, _ireq=None), Requirement(_name='apscheduler', vcs=None, req=NamedRequirement(name='apscheduler', version='==3.6.3', req=Requirement.parse('apscheduler==3.6.3'), extras=[], editable=False, _parsed_line=<Line (editable=False, name=apscheduler, path=None, uri=None, extras=(), markers=None, vcs=None, specifier===3.6.3, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=apscheduler==3.6.3)>), 
...plus a lot more which I'm not including for brevity
...followed by
  Package installation failed...
/usr/lib/python3.9/subprocess.py:1052: ResourceWarning: subprocess 4540 is still running
  _warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.FileIO name=4 mode='rb' closefd=True>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.FileIO name=7 mode='rb' closefd=True>
ResourceWarning: Enable tracemalloc to get the object allocation traceback

With Windows

Hi! How can I use this software with windows?

ModuleNotFoundError: No module named 'colorama'

Traceback (most recent call last):
File "/mnt/k/SIT/Megaprojects/dev-envoirnment/plane-notify/main.py", line 4, in
from colorama import Fore, Back, Style
ModuleNotFoundError: No module named 'colorama'

System does not post if Sleep time is high

Due to the high cost of the API, we are integrating with RapidAPI. It already works, but if you set the Sleep time to a time close to 60 seconds. If you multiply that by 30 aircraft, it's still very expensive, more than $1900 a month. So thinking about putting every 10 minutes. The system gets the data, but nothing is posted on Discord, neither takeoff nor landing.

image

Is there public API for this?

Is there public API for this?

Would make spreading this way easier if there was a public (REST-like) API.

Also saw in the readme instructions to creating a Telegram bot. Does such bot exist? Searching on Telegram for possible names shows up a bunch of crypto scams but no bot that actually seems to work.

Crash when no lat/long from opensky

Looking into the details but stderr:

Traceback (most recent call last):
  File "/plane-notify/__main__.py", line 274, in <module>
    raise e
  File "/plane-notify/__main__.py", line 219, in <module>
    obj.run_opens(dataState)
  File "/plane-notify/planeClass.py", line 111, in run_opens
    self.run_check()
  File "/plane-notify/planeClass.py", line 627, in run_check
    coords.append((float(trace[1]), float(trace[2])))
TypeError: float() argument must be a string or a number, not 'NoneType'

last couple of log outputs (stdout only)

-------- 1379 -------- 10:22:43 PM -----------------------------------------------------------------
---BEGIN---------./configs/planeACC306.ini-------------------------------------------ICAO: ACC306---
╒═══════════════╤═══════════════════╕
│ ICAO          │ ACC306            │
├───────────────┼───────────────────┤
│ Callsign      │ N921MT            │
├───────────────┼───────────────────┤
│ Reg           │ N921MT            │
├───────────────┼───────────────────┤
│ Coordinates   │ 28.4067, -81.3265 │
├───────────────┼───────────────────┤
│ Last Contact  │ 15:20:02          │
├───────────────┼───────────────────┤
│ Baro Altitude │ 175 ft            │
╘═══════════════╧═══════════════════╛
---END-------------------------------------------------------------------------------ICAO: ACC306---

---BEGIN---------./configs/planeA99ADB.ini-------------------------------------------ICAO: A99ADB---
╒═══════════════╤═══════════════════╕
│ ICAO          │ A99ADB            │
├───────────────┼───────────────────┤
│ Callsign      │ N718MC            │
├───────────────┼───────────────────┤
│ Reg           │ N718MC            │
├───────────────┼───────────────────┤
│ Coordinates   │ 32.8388, -96.8355 │
├───────────────┼───────────────────┤
│ Last Contact  │ 4 days, 2:50:30   │
├───────────────┼───────────────────┤
│ Baro Altitude │ 175 ft            │
╘═══════════════╧═══════════════════╛
---END-------------------------------------------------------------------------------ICAO: A99ADB---

-------- 1379 -------- 10:22:44 PM ------------------------Elapsed Time- 0.802 ---------------------
Slept for 120
-------- 1380 -------- 10:24:44 PM -----------------------------------------------------------------
---BEGIN---------./configs/planeACC306.ini-------------------------------------------ICAO: ACC306---
╒═══════════════╤══════════╕
│ ICAO          │ ACC306   │
├───────────────┼──────────┤
│ Callsign      │          │
├───────────────┼──────────┤
│ Reg           │ N921MT   │
├───────────────┼──────────┤
│ Squawk        │          │
├───────────────┼──────────┤
│ Last Contact  │ 15:22:05 │
├───────────────┼──────────┤
│ On Ground     │ False    │
├───────────────┼──────────┤
│ Baro Altitude │ 175 ft   │
╘═══════════════╧══════════╛
AGL nearest airport: 154
Tookoff by data acquisition
Country Code: GH State: Western Region Municipality: Sekondi-Takoradi
Took off near Sekondi-Takoradi, Western Region, GH.
Getting Screenshot of https://globe.adsbexchange.com/?largeMode=2&hideButtons&hideSidebar&mapDim=0&zoom=10&icao=ACC306&overlays=null&limitupdates=0
Couldn't remove Google Ads
Reg from tar1090 is N921MT
Mastodon message successfully sent.
Track change of -179.0° which is left

Pipenv doesn't support introspection

Using the latest docker build, i'm getting the following log messages on start:

plane-notify-plane-notify-1  | /usr/local/lib/python3.11/site-packages/pipenv/vendor/attr/_make.py:778: RuntimeWarning: Running interpreter doesn't sufficiently support code object introspection.  Some features like bare super() or accessing __class__ will not work with slotted classes.
plane-notify-plane-notify-1  |   set_closure_cell(cell, cls)

This seems to be caused by pypa/pipenv#5449

How do I delay a tweet?

How do I delay a tweet? I have plane bot that I don't want suspended. It's still live. How do I delay the tweet? Also, I heard you have to delay by 24 hours. Is that true?

Feature request

Hey Jack,
How about adding an "e-mail" module to send an e-mail alert instead of twitter, telegram, etc.
That would be cool

ValueError in fuel calc

Running the latest code crashes when calculating fuel

logs:

Running fuel info calc
Current nationwide Jet-A fuel price avg per G is $ 6.69
Fuel info {'fuel_price': 7195, 'fuel_used_kg': 3270, 'fuel_used_gal': 1076, 'fuel_used_lters': 4071, 'fuel_used_lbs': 7208, 'c02_tons': 11}
Traceback (most recent call last):
  File "/plane-notify/__main__.py", line 281, in <module>
    raise e
  File "/plane-notify/__main__.py", line 208, in <module>
    obj.run_adsbx_v2(data_indexed[key.upper()])
  File "/plane-notify/planeClass.py", line 175, in run_adsbx_v2
    self.run_check()
  File "/plane-notify/planeClass.py", line 498, in run_check
    fuel_message = fuel_message(fuel_info)
  File "/plane-notify/fuel_calc.py", line 46, in fuel_message
    lbs = "{:,  }".format(fuel_info['fuel_used_lbs'])
ValueError: Invalid format specifier

seems to be caused by
https://github.com/Jxck-S/plane-notify/blob/multi/fuel_calc.py#L46

feature request

Hey
It be great if you can code it so we can use rapidapi.com so it be more cheaper for us.
thanks

Mark Shuttleworth Private Jet

What do you think about making a Twitter account bot for Mark Shuttleworth's private jet?

https://www.airliners.net/photo/Untitled/Bombardier-Global-Express-BD-700-1A10/805262/L

https://en.wikipedia.org/wiki/Mark_Shuttleworth

He has a private jet, a Bombardier Global Express, which is often referred to as Canonical One but is in fact owned through his HBD Venture Capital company.[34][35][36] The small dragon depicted on the side of the plane near the door is Norman, the HBD Venture Capital mascot.[37]

Feature Request: Slack & Wordpress Integration

As I have time, I'm going to start taking a stab at integrating Slack and Wordpress. Both can use Webhooks, so shouldn't be horribly difficult. If anyone is working on these and has made any progress, let me know.

❤️

Well Jack. I'm sending love regarding this project & the way you have not budged.

I hope any fears of being sued etc (which seem doubtful.) do not budge your project or stance. 👌

Pretty ironic someone that claims to be pro - free speech has literally went out of their ways to make rules on their platform to limit a CERTAIN piece of content that MIGHT or MIGHT NOT affect their life.

(for anyone reading this - Twitter has added a rule that bans any post that shares live location data... hmmm I wonder why? Who might be upset bout this? 😂😭)

One might argue they don't want a Tesla car seeing them on the street incase a rogue employee etc gets access to the data and is able to TRACK you down from your generalized location last known from a Tesla Car etc...

My support is with you and I'm sure MANY other people in the software and other communities respect your decision to not CONFORM.✌️

I think / hope you stick this through. I have a feeling you'll get a lot more than one car as requested. (Probably woulda cost him / her less too.)

Anyways sorry for the rant / issue but I have been following this repo and the story closely since it has started.

Docker crash when taking screenshot

When running in docker, after a few screenshots, it will crash will the following (truncated) stack trace

Traceback (most recent call last):
  File "/plane-notify/__main__.py", line 281, in <module>
    raise e
  File "/plane-notify/__main__.py", line 208, in <module>
    obj.run_adsbx_v2(data_indexed[key.upper()])
  File "/plane-notify/planeClass.py", line 161, in run_adsbx_v2
    self.run_check()
  File "/plane-notify/planeClass.py", line 427, in run_check
    get_adsbx_screenshot(self.map_file_name, url_params)
  File "/plane-notify/defSS.py", line 24, in get_adsbx_screenshot
    browser.get(url)
  File "/root/.local/share/virtualenvs/plane-notify-eL1Vmn07/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 437, in get
  ...
  File "/root/.local/share/virtualenvs/plane-notify-eL1Vmn07/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
  (Session info: headless chrome=102.0.5005.115)

It looks like this is caused by running out of shm space https://stackoverflow.com/a/53970825/1769531

Not giving the expected output

I recently tried using this program to post status of a particular plane on one of my Discord channels, but the issue is, it isn't giving any output.
On cross-verifying with adsb-exchange, although the plane being is in thr air it doesn't display any output, neither on the virtual machine nor
on the channel. If you could please look into this matter and let me if there's any wrong being done on my part, it would be
really helpful.

On running the program, the webhook set for bot alerts gives me a notification of it starting and therafter shows nothing on
the channel but this is the view from the instance

image

It isn't showing any flight-data even though the plane in question is still in the air.
image

Discord Channel Output
image

Thanks in advance✌️

Map config pulled from wrong config

the example config has the map config in the plane configuration. Some of planeClass.py pulls from the main config while the rest pulls from the correct place. If there is no map config in the main config, the application will crash when there is an event to generate a map.

Updating code to work with newer versions of Python-Telegram-Bot lib

I wrote the Telegram part of the code to add the posting to Telegram feature last year, but I don't run this project myself for months. But in order to keep it updated, I wrote what I believe it's a working code, but I don't have means to actually try it. Python-Telegram-Bot (PTB) had a massive update from version 20, since when async is the base of the library. The code I'm posting here should be able to identify if the installed version is newer or older than 20 and act accordingly. The code was tested by a friend and it seems to be working for newer PTB versions. Can someone running an older version try this code on defTelegram.py please? If it works I'll submit a pull request.
Thanks!

def sendTeleg(photo, message, config):
    try:
        from telegram import __version_info__
    except ImportError:
        __version_info__ = (0, 0, 0, 0, 0)
    if __version_info__ < (20, 0, 0, "alpha", 5):
        sent = sendTelegOld(photo, message, config)
        return sent
    else:
        import asyncio
        sent = asyncio.run(t_send_photo(photo,message,config))
        return sent

def sendTelegOld(photo, message, config):
    import telegram
    sent = False
    retry_c = 0
    while sent == False:
        try:
            bot = telegram.Bot(token=config.get('TELEGRAM', 'BOT_TOKEN'), request=telegram.utils.request.Request(connect_timeout=20, read_timeout=20))
            sent = bot.send_photo(chat_id=config.get('TELEGRAM', 'ROOM_ID'), photo=photo, caption=message, parse_mode=telegram.ParseMode.MARKDOWN, timeout=20)
        except Exception as err:
            print('err.args:')
            print(err.args)
            print(f"Unexpected {err=}, {type(err)=}")
            print("\nString err:\n"+str(err))
            if retry_c > 4:
                print('Telegram attempts exceeded. Message not sent.')
                break
            elif str(err) == 'Unauthorized':
                print('Invalid Telegram bot token, message not sent.')
                break
            elif str(err) == 'Timed out':
                retry_c += 1
                print('Telegram timeout count: '+str(retry_c))
                pass
            elif str(err) == 'Chat not found':
                print('Invalid Telegram Chat ID, message not sent.')
                break
            elif str(err)[:35] == '[Errno 2] No such file or directory':
                print('Telegram module couldn\'t find an image to send.')
                break
            elif str(err) == 'Media_caption_too_long':
                print('Telegram image caption length exceeds 1024 characters. Message not send.')
                break
            else:
                print('[X] Unknown Telegram error. Message not sent.')
                break
        else:
            print("Telegram message successfully sent.")
    return sent

async def t_send_photo(photo,message,config):
    import telegram
    sent = False
    retry_c = 0
    while sent == False:
        try:
            bot = telegram.Bot(token=config.get('TELEGRAM', 'BOT_TOKEN'))
            sent = await bot.send_photo(chat_id=config.get('TELEGRAM', 'ROOM_ID'), photo=photo, caption=message)
        except Exception as err:
            print('err.args:')
            print(err.args)
            print(f"Unexpected {err=}, {type(err)=}")
            print("\nString err:\n"+str(err))
            if retry_c > 4:
                print('Telegram attempts exceeded. Message not sent.')
                break
            elif str(err) == 'Unauthorized':
                print('Invalid Telegram bot token, message not sent.')
                break
            elif str(err) == 'Timed out':
                retry_c += 1
                print('Telegram timeout count: '+str(retry_c))
                pass
            elif str(err) == 'Chat not found':
                print('Invalid Telegram Chat ID, message not sent.')
                break
            elif str(err)[:35] == '[Errno 2] No such file or directory':
                print('Telegram module couldn\'t find an image to send.')
                break
            elif str(err) == 'Media_caption_too_long':
                print('Telegram image caption length exceeds 1024 characters. Message not send.')
                break
            else:
                print('[X] Unknown Telegram error. Message not sent.')
                break
        else:
            print("Telegram message successfully sent.")
    return sent

Feature request: Mastodon API

The fediverse is gaining a lot of attention lately, with microblogging services like Mastodon and Pleroma being recognized as potential Twitter alternatives. Hence, it would be cool to connect plane-notify to the fedi as well.

For the sake of simplicity, I'd suggest to use Mastodon.py (https://mastodonpy.readthedocs.io/en/stable/), as it is very simple to set up.

What needs to be done to accomplish this:

  • Include Mastodon API key as a configurable value
  • Create defMastodon module that leverages Mastodon.py to post plane information on the fediverse, similar to way it was posted on Twitter
  • Integrate the defMastodon module such that it can be used by plane-notify (I currently don't know how this is done)
  • Setup instructions
  • Add Mastodon.py to requirements (Pipfile)

Proposal -- Use MQTT protocol as the output from the scapers and NodeRED for message and destination customization

MQTT is a very lightweight protocol designed for status updates of the type that your scrapers are generating.

NodeRED is a flow-based programming language using snippets of Javascript that you can edit through the browser without upload access to the server. It is accessible and tightly coupled to the MQTT protocol.

If you separated these two jobs into individual components which communicated through MQTT the system would more adaptable and enable new ideas to be more quickly implemented and torn down. Although NodeRED looks like a toy system, and you can do everything you want at the moment with your inlined Python code, it adds real flexibility to the inputs and outputs you can draw on. It would encourage the implementation of more creative ideas than simply posting the update messages to the platform of your choice.

NodeRED has plugins for outputting to Telegram, Discord, Tw*tter, Matrix, and into time-series databases like InfluxDB that can be used to update a cumulative log and record of the flights for more sophisticated messages, eg "this is the Nth time @muskjet has landed in the Bay Area this year."

An MQTT stream of flight data would also make it easy to wire up simple IoT devices such as a WhereDial or an internet connected light projecting an image of the MuskJet above the clouds onto the wall to remind us of the great work done by our favourite billionaires. See HackADay for other ideas. The point is to be able to turn these snippets of news into physical displays that can be enjoyed by everyone, not just those who happen to be watching the right website on their phone at the right time.

No requirements.txt

There is no requirements.txt you should include that it's dumb thing to ask but it's fundamental!

Cannot Run __main__.py

When trying to run main.py, the answer is
/root/.local/share/virtualenvs/root-BuDEOXnJ/bin/python: can't open file 'main': [Errno 2] No such file or directory

Docker compose fails

running docker compose build fails with the following error message

#11 111.7 [pipenv.exceptions.InstallError]:       cairo/bufferproxy.c:32:10: fatal error: Python.h: No such file or directory
#11 111.7 [pipenv.exceptions.InstallError]:          32 | #include <Python.h>
#11 111.7 [pipenv.exceptions.InstallError]:             |          ^~~~~~~~~~
#11 111.7 [pipenv.exceptions.InstallError]:       compilation terminated.
#11 111.7 [pipenv.exceptions.InstallError]:       error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
#11 111.7 [pipenv.exceptions.InstallError]:       [end of output]
#11 111.7 [pipenv.exceptions.InstallError]:
#11 111.7 [pipenv.exceptions.InstallError]:   note: This error originates from a subprocess, and is likely not a problem with pip.
#11 111.7 [pipenv.exceptions.InstallError]: error: legacy-install-failure
#11 111.7 [pipenv.exceptions.InstallError]:
#11 111.7 [pipenv.exceptions.InstallError]: × Encountered error while trying to install package.
#11 111.7 [pipenv.exceptions.InstallError]: ╰─> pycairo
#11 111.7 [pipenv.exceptions.InstallError]:
#11 111.7 [pipenv.exceptions.InstallError]: note: This is an issue with the package mentioned above, not pip.
#11 111.7 [pipenv.exceptions.InstallError]: hint: See above for output from the failure.
#11 111.7 ERROR: Couldn't install package: pycairo
#11 111.7  Package installation failed...
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c pipenv install]: exit code: 1

Quick googling says python-dev is missing

You should create a guide/rule on how you want contributors to create branches: : Best Practices

I did not see anywhere specifically mentioned how you would like the branches a contributor needs to be created, i.e:

  • From what Branch
  • How do you want it stated, for example "Feature/short-description", "Issue/short-description"
  • What branch should the PR be merged into, the previous issue here created comes into play here by creating other branches (#14)

The naming of branches just help people understand what the PR is about more a less and with GitHub if you specify a branch with "Feature/short-description" it can create a title for you when you create a PR.

'StateVector' object has no attribute 'heading'

At me, when a plane is flying, I always get this output (3C4AD7 is flying, AE6A36 is not on the radar):
cmd_1651096890
When the plane is not on the radar, I get the normal output, as you can see.
Why is that? What can I do with it?

You should create a development branch aside for the default branch: Best Practice

I believe you should avoid releasing contributed code directly to the multi branch but instead create an additional branch called multi-development.

The Development branch would then be utilized in conjunction of best practices such as proof of concept, feature testing, vulnerability scanning, or bug fixes before release to production also known as the main (multi branch). The main purpose of this branch is to avoid any potential code conflicts which could lead to inadvertent disfigurement of the code base.

(upon approval of the contributors code tested, then merge the dev branch into production aka the main branch)

I would like to contribute to the new branch as well. Pls notify if one is created. Tks.

Feature request

Hey it be cool if you can hook it up with flightradar24 maps or api

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.