forked from XPUB/si_7-IRIS
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
743 B
Python
28 lines
743 B
Python
6 years ago
|
#!/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) )
|