v0.4.2 update

pull/140/head
Mason10198 2 years ago
parent 3b17599688
commit 7435d7ef09

@ -914,6 +914,7 @@ def build_tailmessage(alerts):
) )
) )
added_counties = set()
for ( for (
alert, alert,
counties, counties,
@ -965,7 +966,11 @@ def build_tailmessage(alerts):
else: else:
word_space = AudioSegment.silent(duration=400) word_space = AudioSegment.silent(duration=400)
county_code = county["county_code"] county_code = county["county_code"]
if COUNTY_WAVS and county_code in COUNTY_CODES: if (
COUNTY_WAVS
and county_code in COUNTY_CODES
and county_code not in added_counties
):
index = COUNTY_CODES.index(county_code) index = COUNTY_CODES.index(county_code)
county_name_file = COUNTY_WAVS[index] county_name_file = COUNTY_WAVS[index]
LOGGER.debug( LOGGER.debug(
@ -974,18 +979,25 @@ def build_tailmessage(alerts):
county_name_file, county_name_file,
alert, alert,
) )
try:
combined_sound += word_space + AudioSegment.from_wav( combined_sound += word_space + AudioSegment.from_wav(
os.path.join(SOUNDS_PATH, county_name_file) os.path.join(SOUNDS_PATH, county_name_file)
) )
# if this is the last county name, add 600ms of silence after the county name # if this is the last county name, add 600ms of silence after the county name
if counties.index(county) == len(counties) - 1: if counties.index(county) == len(counties) - 1:
combined_sound += AudioSegment.silent(duration=600) combined_sound += AudioSegment.silent(duration=600)
added_counties.add(county_code)
except FileNotFoundError:
LOGGER.error(
"buildTailMessage: Audio file not found: %s",
os.path.join(SOUNDS_PATH, county_name_file),
)
except ValueError: except ValueError:
LOGGER.error("Alert not found: %s", alert) LOGGER.error("Alert not found: %s", alert)
except FileNotFoundError: except FileNotFoundError:
LOGGER.error( LOGGER.error(
"Audio file not found: %s/ALERTS/SWP_%s.wav", "buildTailMessage: Audio file not found: %s/ALERTS/SWP_%s.wav",
SOUNDS_PATH, SOUNDS_PATH,
ALERT_INDEXES[index], ALERT_INDEXES[index],
) )

Loading…
Cancel
Save

Powered by TurnKey Linux.