adding announcer

master
acastro 6 years ago
parent f1a456227a
commit 11f02174a7

@ -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) )

@ -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"
]
}
Loading…
Cancel
Save