parent
be33a0a063
commit
47387ce05c
@ -1,11 +1,65 @@
|
|||||||
admin@node92394:~/asl3_wx_announce $ sudo python3 -m asl3_wx_announce.main --report
|
admin@node92394:/opt/asl3_wx_announce $ sudo python3 -m asl3_wx_announce.main --report
|
||||||
|
Loading formatted geocoded file...
|
||||||
|
INFO:asl3_wx_announce.provider.ec:DEBUG: ec.metadata type: <class 'env_canada.ec_weather.MetaData'>
|
||||||
|
INFO:asl3_wx_announce.provider.ec:DEBUG: ec.metadata content: MetaData(attribution='Data provided by Environment Canada', timestamp=datetime.datetime(2026, 1, 29, 17, 5, 6, tzinfo=tzutc()), station="Quebec Lesage Int'l Airport", location='Québec', cache_returned_on_update=0, last_update_error='')
|
||||||
|
INFO:asl3_wx:Using Config Timezone: America/Toronto
|
||||||
|
INFO:asl3_wx:Resolved Location: Quebec, Quebec (CA)
|
||||||
|
INFO:asl3_wx:Report Text: CQ CQ CQ. This is N7XOB Portable V E 2 with the updated weather report. The time is 12 05 PM. This is the automated weather report for Quebec, Quebec. Break. [PAUSE] Current conditions for Quebec, Quebec. The temperature is -15 degrees celsius. Conditions are Partly Cloudy, with winds at 22 kilometers per hour. Break. [PAUSE] Here is the forecast. Thursday: Increasing cloudiness this afternoon. Wind southwest 20 km/h. High minus 13. Wind chill minus 24 this afternoon. UV index 1 or low.. High -13. Break. [PAUSE] Thursday night: Periods of light snow. Wind west 20 km/h gusting to 40. Low minus 17. Wind chill near minus 27.. High -17. Break. [PAUSE] Friday: Periods of light snow ending in the morning then mainly cloudy with 30 percent chance of flurries. Wind west 20 km/h gusting to 40. High minus 13. Wind chill minus 27 in the morning and minus 19 in the afternoon. UV index 1 or low.. High -13. Break. [PAUSE] Friday night: Clear. Low minus 19.. High -19. Break. [PAUSE] This concludes the weather report for Quebec. N7XOB Portable V E 2 Clear.
|
||||||
|
INFO:asl3_wx_announce.audio:Generating segment 0: pico2wave -w /tmp/asl3_wx/raw_report_0.wav "CQ CQ CQ. This is N7XOB Portable V E 2 with the updated weather report. The time is 12 05 PM. This is the automated weather report for Quebec, Quebec. Break."
|
||||||
|
INFO:asl3_wx_announce.audio:Converting audio: sox /tmp/asl3_wx/raw_report_0.wav -r 8000 -c 1 -t gsm /tmp/asl3_wx/asl3_wx_report_0.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Moving to sounds dir: sudo mv /tmp/asl3_wx/asl3_wx_report_0.gsm /usr/share/asterisk/sounds/en/asl3_wx_report_0.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Generating segment 1: pico2wave -w /tmp/asl3_wx/raw_report_1.wav "Current conditions for Quebec, Quebec. The temperature is -15 degrees celsius. Conditions are Partly Cloudy, with winds at 22 kilometers per hour. Break."
|
||||||
|
INFO:asl3_wx_announce.audio:Converting audio: sox /tmp/asl3_wx/raw_report_1.wav -r 8000 -c 1 -t gsm /tmp/asl3_wx/asl3_wx_report_1.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Moving to sounds dir: sudo mv /tmp/asl3_wx/asl3_wx_report_1.gsm /usr/share/asterisk/sounds/en/asl3_wx_report_1.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Generating segment 2: pico2wave -w /tmp/asl3_wx/raw_report_2.wav "Here is the forecast. Thursday: Increasing cloudiness this afternoon. Wind southwest 20 km/h. High minus 13. Wind chill minus 24 this afternoon. UV index 1 or low.. High -13. Break."
|
||||||
|
INFO:asl3_wx_announce.audio:Converting audio: sox /tmp/asl3_wx/raw_report_2.wav -r 8000 -c 1 -t gsm /tmp/asl3_wx/asl3_wx_report_2.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Moving to sounds dir: sudo mv /tmp/asl3_wx/asl3_wx_report_2.gsm /usr/share/asterisk/sounds/en/asl3_wx_report_2.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Generating segment 3: pico2wave -w /tmp/asl3_wx/raw_report_3.wav "Thursday night: Periods of light snow. Wind west 20 km/h gusting to 40. Low minus 17. Wind chill near minus 27.. High -17. Break."
|
||||||
|
INFO:asl3_wx_announce.audio:Converting audio: sox /tmp/asl3_wx/raw_report_3.wav -r 8000 -c 1 -t gsm /tmp/asl3_wx/asl3_wx_report_3.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Moving to sounds dir: sudo mv /tmp/asl3_wx/asl3_wx_report_3.gsm /usr/share/asterisk/sounds/en/asl3_wx_report_3.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Generating segment 4: pico2wave -w /tmp/asl3_wx/raw_report_4.wav "Friday: Periods of light snow ending in the morning then mainly cloudy with 30 percent chance of flurries. Wind west 20 km/h gusting to 40. High minus 13. Wind chill minus 27 in the morning and minus 19 in the afternoon. UV index 1 or low.. High -13. Break."
|
||||||
|
INFO:asl3_wx_announce.audio:Converting audio: sox /tmp/asl3_wx/raw_report_4.wav -r 8000 -c 1 -t gsm /tmp/asl3_wx/asl3_wx_report_4.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Moving to sounds dir: sudo mv /tmp/asl3_wx/asl3_wx_report_4.gsm /usr/share/asterisk/sounds/en/asl3_wx_report_4.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Generating segment 5: pico2wave -w /tmp/asl3_wx/raw_report_5.wav "Friday night: Clear. Low minus 19.. High -19. Break."
|
||||||
|
INFO:asl3_wx_announce.audio:Converting audio: sox /tmp/asl3_wx/raw_report_5.wav -r 8000 -c 1 -t gsm /tmp/asl3_wx/asl3_wx_report_5.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Moving to sounds dir: sudo mv /tmp/asl3_wx/asl3_wx_report_5.gsm /usr/share/asterisk/sounds/en/asl3_wx_report_5.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Generating segment 6: pico2wave -w /tmp/asl3_wx/raw_report_6.wav "This concludes the weather report for Quebec. N7XOB Portable V E 2 Clear."
|
||||||
|
INFO:asl3_wx_announce.audio:Converting audio: sox /tmp/asl3_wx/raw_report_6.wav -r 8000 -c 1 -t gsm /tmp/asl3_wx/asl3_wx_report_6.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Moving to sounds dir: sudo mv /tmp/asl3_wx/asl3_wx_report_6.gsm /usr/share/asterisk/sounds/en/asl3_wx_report_6.gsm
|
||||||
|
INFO:asl3_wx_announce.audio:Segment 0 duration: 14.84s
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 0 on 1966: sudo /usr/sbin/asterisk -rx "rpt playback 1966 asl3_wx_report_0"
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 0 on 62394: sudo /usr/sbin/asterisk -rx "rpt playback 62394 asl3_wx_report_0"
|
||||||
|
INFO:asl3_wx_announce.audio:Pausing 5s for unkey...
|
||||||
|
INFO:asl3_wx_announce.audio:Segment 1 duration: 12.992s
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 1 on 1966: sudo /usr/sbin/asterisk -rx "rpt playback 1966 asl3_wx_report_1"
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 1 on 62394: sudo /usr/sbin/asterisk -rx "rpt playback 62394 asl3_wx_report_1"
|
||||||
|
INFO:asl3_wx_announce.audio:Pausing 5s for unkey...
|
||||||
|
INFO:asl3_wx_announce.audio:Segment 2 duration: 19.196s
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 2 on 1966: sudo /usr/sbin/asterisk -rx "rpt playback 1966 asl3_wx_report_2"
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 2 on 62394: sudo /usr/sbin/asterisk -rx "rpt playback 62394 asl3_wx_report_2"
|
||||||
|
INFO:asl3_wx_announce.audio:Pausing 5s for unkey...
|
||||||
|
INFO:asl3_wx_announce.audio:Segment 3 duration: 14.732s
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 3 on 1966: sudo /usr/sbin/asterisk -rx "rpt playback 1966 asl3_wx_report_3"
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 3 on 62394: sudo /usr/sbin/asterisk -rx "rpt playback 62394 asl3_wx_report_3"
|
||||||
|
INFO:asl3_wx_announce.audio:Pausing 5s for unkey...
|
||||||
|
INFO:asl3_wx_announce.audio:Segment 4 duration: 22.54s
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 4 on 1966: sudo /usr/sbin/asterisk -rx "rpt playback 1966 asl3_wx_report_4"
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 4 on 62394: sudo /usr/sbin/asterisk -rx "rpt playback 62394 asl3_wx_report_4"
|
||||||
|
INFO:asl3_wx_announce.audio:Pausing 5s for unkey...
|
||||||
|
INFO:asl3_wx_announce.audio:Segment 5 duration: 7.26s
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 5 on 1966: sudo /usr/sbin/asterisk -rx "rpt playback 1966 asl3_wx_report_5"
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 5 on 62394: sudo /usr/sbin/asterisk -rx "rpt playback 62394 asl3_wx_report_5"
|
||||||
|
INFO:asl3_wx_announce.audio:Pausing 5s for unkey...
|
||||||
|
INFO:asl3_wx_announce.audio:Segment 6 duration: 6.16s
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 6 on 1966: sudo /usr/sbin/asterisk -rx "rpt playback 1966 asl3_wx_report_6"
|
||||||
|
INFO:asl3_wx_announce.audio:Playing segment 6 on 62394: sudo /usr/sbin/asterisk -rx "rpt playback 62394 asl3_wx_report_6"
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "<frozen runpy>", line 198, in _run_module_as_main
|
File "<frozen runpy>", line 198, in _run_module_as_main
|
||||||
File "<frozen runpy>", line 88, in _run_code
|
File "<frozen runpy>", line 88, in _run_code
|
||||||
File "/home/admin/asl3_wx_announce/asl3_wx_announce/main.py", line 260, in <module>
|
File "/opt/asl3_wx_announce/asl3_wx_announce/main.py", line 376, in <module>
|
||||||
main()
|
main()
|
||||||
File "/home/admin/asl3_wx_announce/asl3_wx_announce/main.py", line 246, in main
|
File "/opt/asl3_wx_announce/asl3_wx_announce/main.py", line 369, in main
|
||||||
setup_logging(config) # Call the placeholder setup_logging
|
sys.exit(0)
|
||||||
^^^^^^^^^^^^^
|
^^^
|
||||||
NameError: name 'setup_logging' is not defined
|
NameError: name 'sys' is not defined
|
||||||
admin@node92394:~/asl3_wx_announce $
|
admin@node92394:/opt/asl3_wx_announce $
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
from asl3_wx_announce.narrator import Narrator
|
||||||
|
|
||||||
|
def test_startup():
|
||||||
|
config = {'station': {'callsign': 'TEST', 'report_style': 'quick'}}
|
||||||
|
narrator = Narrator(config)
|
||||||
|
|
||||||
|
# Test case: node 1966
|
||||||
|
city = "TestCity"
|
||||||
|
interval = 10
|
||||||
|
nodes = ["1966", "2020"]
|
||||||
|
source = "Test Source"
|
||||||
|
|
||||||
|
msg = narrator.get_startup_message(city, interval, nodes, source)
|
||||||
|
print("Startup Message:")
|
||||||
|
print(msg)
|
||||||
|
|
||||||
|
expected_snippet_1 = "1 9 6 6"
|
||||||
|
expected_snippet_2 = "2 0 2 0"
|
||||||
|
|
||||||
|
if expected_snippet_1 in msg and expected_snippet_2 in msg:
|
||||||
|
print("\nSUCCESS: Nodes are formatted as digits.")
|
||||||
|
else:
|
||||||
|
print("\nFAILURE: Nodes are NOT formatted correctly.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
test_startup()
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
from asl3_wx_announce.narrator import Narrator
|
||||||
|
from asl3_wx_announce.models import LocationInfo, CurrentConditions, WeatherForecast, AlertSeverity
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
def test_report():
|
||||||
|
config = {
|
||||||
|
'station': {'callsign': 'VE2TEST', 'report_style': 'quick'},
|
||||||
|
'alerts': {'min_severity': 'Watch', 'check_interval_minutes': 15}
|
||||||
|
}
|
||||||
|
narrator = Narrator(config)
|
||||||
|
|
||||||
|
loc = LocationInfo(latitude=45.0, longitude=-73.0, city="Test City", region="Quebec", country_code="CA", timezone="America/Toronto")
|
||||||
|
curr = CurrentConditions(temperature=20, humidity=50, wind_speed=10, wind_direction="N", description="Sunny")
|
||||||
|
fc = [WeatherForecast(period_name="Today", high_temp=25, summary="Sunny all day", short_summary="Sunny")]
|
||||||
|
|
||||||
|
# Test 1: Full Report with SFI and Status
|
||||||
|
report_cfg = {
|
||||||
|
'conditions': True,
|
||||||
|
'forecast': True,
|
||||||
|
'forecast_verbose': False,
|
||||||
|
'astro': True,
|
||||||
|
'solar_flux': True, # Should fail gracefully or print nothing if no network
|
||||||
|
'status': True
|
||||||
|
}
|
||||||
|
|
||||||
|
print("\n--- Test Report (All Enabled) ---")
|
||||||
|
msg = narrator.build_full_report(loc, curr, fc, [], sun_info="Sunrise at 6am", report_config=report_cfg)
|
||||||
|
print(msg)
|
||||||
|
|
||||||
|
# Test 2: Minimal
|
||||||
|
report_cfg_min = {
|
||||||
|
'conditions': True,
|
||||||
|
'forecast': False,
|
||||||
|
'astro': False,
|
||||||
|
'solar_flux': False,
|
||||||
|
'status': False
|
||||||
|
}
|
||||||
|
print("\n--- Test Report (Minimal) ---")
|
||||||
|
msg2 = narrator.build_full_report(loc, curr, fc, [], sun_info="Sunrise at 6am", report_config=report_cfg_min)
|
||||||
|
print(msg2)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
test_report()
|
||||||
Loading…
Reference in new issue