Skip to content

Commit

Permalink
4.4.1: Added redundancy + SetupQE revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
ApatheticDELL authored Jun 23, 2024
1 parent 857e7a5 commit d3cb923
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 258 deletions.
17 changes: 10 additions & 7 deletions QuantumENDEC.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
from EASGen import EASGen
from EAS2Text import EAS2Text
from itertools import zip_longest
except Exception as e: print(f"IMPORT FAIL: {e}.\nOne or more modules has failed to inport please run QuantumENDEC setup file (SetupQE.py)"); exit()
except Exception as e: print(f"IMPORT FAIL: {e}.\nOne or more modules has failed to inport, install the requirments!"); exit()
try: os.system("ffmpeg -version")
except: print("Uh oh, FFMPEG dosen't apper to be installed on your system, you will need to install it so it can be ran on a command line. Some functions of QuantumENDEC depend on FFMPEG"); exit()
except: print("FFMPEG dosen't apper to be installed on your system, you will need to install it so it can be ran on a command line. Some functions of QuantumENDEC depend on FFMPEG"); exit()

QEversion = "4.4.0"
QEversion = "4.4.1"

def Clear(): os.system('cls' if os.name == 'nt' else 'clear')

Expand Down Expand Up @@ -48,7 +48,8 @@ def receive(self, host, port, buffer, delimiter):
data_received = ""
except socket.timeout: print(f"[Capture]: Connection timed out for {host}"); return False
except Exception as e: print(f"[Capture]: Something broke when connecting to {host}: {e}"); return False

except: print("[Capture]: General exception occured!"); time.sleep(20); return False

def start(self):
NAAD = self.receive(self.NAAD1, 8080, 1024, "</alert>")
if NAAD is False: NAAD = self.receive(self.NAAD2, 8080, 1024, "</alert>")
Expand Down Expand Up @@ -87,6 +88,7 @@ def MatchCLC(ConfigData, SAMEheader):
else:
for i in EAS2Text(SAMEheader).FIPS:
if i[:2] in ConfigData['AllowedLocations_CLC']: return True
if i[:3] in ConfigData['AllowedLocations_CLC']: return True
if i[:4] in ConfigData['AllowedLocations_CLC']: return True
if i in ConfigData['AllowedLocations_CLC']: return True
return False
Expand Down Expand Up @@ -127,9 +129,10 @@ def Heartbeat(References, QueueFolder, HistoryFolder):
except:
try: xml = urlopen(req2).read()
except: pass
f = open(Output, "wb")
f.write(xml)
f.close()
try:
with open(Output, "wb") as f: f.write(xml)
except: print("Heartbeat, download aborted: a general exception occured, it could be that the URLs are temporarily unavailable.")


def watchNotify(ListenFolder, HistoryFolder):
def GetFolderQueue(): return os.listdir(f"{ListenFolder}")
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ApatheticDELL presents...
# QuantumENDEC (v4.4.0)
# QuantumENDEC (v4.4.1)

### Credits
Developed by...
Expand All @@ -22,23 +22,18 @@ QuantumENDEC is a Canadian CAP Emergency Alerting Software. Its primary goal is
Installing the QuantumENDEC is quite easy.
You will first require the following...
- FFMPEG
- Python3 (install pip3 too)
- Python3
...to be installed on your System

Then you can run:
```python SetupQE.py```
Then select the "Install dependencies" option to install the required Python modules.

If that doesn't work, you may need to install them manually.
Required modules: EASGen, EAS2Text, discord_webhook, pyttsx3, sounddevice, numpy, scipy, requests, argparse, xmltodict, pydub, pygame.
And then, you need the following required Python modules: EASGen, EAS2Text, discord_webhook, pyttsx3, sounddevice, numpy, scipy, requests, argparse, xmltodict, pydub, pygame.

### Setup
Before doing anything, you need to have some knowledge of the Canadian public alerting system... more precisely, Pelmorex and its CAP-CP XML files.
You can read about it on this PDF from Pelmorex: https://alerts.pelmorex.com/wp-content/uploads/2021/06/NAADS-LMD-User-Guide-R10.0.pdf

You need to set a config file before doing anything.
There is a config.json file that is used to configure the software.
You can create one by running: ```python SetupQE.py``` and selecting "Do configuration setup."
You can create one by running: ```python SetupQE.py```
You'll find discord webhook settings, along with filters for alert statuses, severity, and urgency.
You will also be asked if you want to filter alerts via CAP-CP Geocodes and S.A.M.E CLC (Canada's FIPS), you can filter by provinice and/or region.

Expand Down
Loading

0 comments on commit d3cb923

Please sign in to comment.