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.

27 lines
713 B
Python

#!/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 5'.format(intro_sf) )
os.system('play -q "{}" gain 10'.format(msg_sf) )