diff --git a/announcements.py b/announcements.py new file mode 100755 index 0000000..1757768 --- /dev/null +++ b/announcements.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +import json, random, os +from pprint import pprint +from time import sleep + +# open announcer.json files +pwd = os.path.dirname( os.path.realpath(__file__) ) + "/" +announcer_f = open(pwd + "announcer.json", "r").read() +announcer = json.loads(announcer_f) + +# print(announcer) + +# ANNOUNCER PART +# msg = random.choice( announcer['messages'] ) #chooing a random annoncement. + + +sound_dir = pwd + "Audio_recordings/Announcements/" +intro_sf = sound_dir + random.choice( announcer['introductions'] ) +msg_sf = sound_dir + random.choice( announcer['messages'] ) + +print(intro_sf, msg_sf) + + +#play audio +os.system('play -q "{}" gain 10 '.format(intro_sf) ) +sleep(random.randint(1,3)) +os.system('play -q "{}" gain 10 '.format(msg_sf) ) diff --git a/announcer.json b/announcer.json new file mode 100644 index 0000000..81e17c8 --- /dev/null +++ b/announcer.json @@ -0,0 +1,11 @@ +{ + + "introductions" : ["jingle_01.wav", "jingle_02.wav", "jingle_03.wav", "jingle_04.wav", "jingle_05.wav", "jingle_06.wav"], + + "messages" : [ + "announcement_msg_01.wav", + "announcement_msg_02.wav" + ] + + +} \ No newline at end of file