diff --git a/read-json.py b/read-json.py index ce864d1..6054470 100755 --- a/read-json.py +++ b/read-json.py @@ -3,17 +3,20 @@ import json, random, os from pprint import pprint from time import sleep + # open json files -oracle_f = open("guru.json", "r").read() +pwd = os.path.dirname( os.path.realpath(__file__) ) + "/" +oracle_f = open(pwd + "guru.json", "r").read() oracle = json.loads(oracle_f) -rebel_f = open("rebel.json", "r").read() +rebel_f = open(pwd + "rebel.json", "r").read() rebel = json.loads(rebel_f) + # GURU PART keys = list( oracle.keys()) part = random.choice(keys) # choose: Repeat OR Ask Yourself print(part) -sound_dir = "Audio_recordings/" + oracle[part]['title'] + "/" +sound_dir = pwd + "Audio_recordings/" + oracle[part]['title'] + "/" intro = random.choice(oracle[part]['introductions']) intro_txt = intro[0] intro_sound = sound_dir + intro[1]