using abs paths

master
acastro 6 years ago
parent 2f3d62751a
commit f1a456227a

@ -3,17 +3,20 @@ import json, random, os
from pprint import pprint from pprint import pprint
from time import sleep from time import sleep
# open json files # 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) 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) rebel = json.loads(rebel_f)
# GURU PART # GURU PART
keys = list( oracle.keys()) keys = list( oracle.keys())
part = random.choice(keys) # choose: Repeat OR Ask Yourself part = random.choice(keys) # choose: Repeat OR Ask Yourself
print(part) print(part)
sound_dir = "Audio_recordings/" + oracle[part]['title'] + "/" sound_dir = pwd + "Audio_recordings/" + oracle[part]['title'] + "/"
intro = random.choice(oracle[part]['introductions']) intro = random.choice(oracle[part]['introductions'])
intro_txt = intro[0] intro_txt = intro[0]
intro_sound = sound_dir + intro[1] intro_sound = sound_dir + intro[1]

Loading…
Cancel
Save