commit 0e334b20d70d1f2c08b03b0240a639bf766bbe41 Author: acastro Date: Mon Nov 12 16:59:41 2018 +0000 1st script diff --git a/oracle.json b/oracle.json new file mode 100644 index 0000000..96d61af --- /dev/null +++ b/oracle.json @@ -0,0 +1,105 @@ +{ + + "part1" : { + + "title" : "Repeat", + + "introductions" : [ + + ["Don't be shy, repeat after me:", "repeat_intro_1.wav"], + ["Follow my words and repeat:", "repeat_intro_2.wav"], + ["Take a deep breath, and repeat after me:", "repeat_intro_3.wav"], + ["Keep calm and repeat after me:", "repeat_intro_4.wav"], + ["Would you please be so kind as to repeat after me:", "repeat_intro_5.wav"], + ["Please repeat after me:","repeat_intro_6.wav"] + + ], + + "messages" : [ + + ["Life is life." , "repeat_msg_1.wav"], + ["Bliss is to accept your flaws." , "repeat_msg_2.wav"], + ["Life is full of possible solutions." , "repeat_msg_3.wav"], + ["I'm only bored if I am boring." , "repeat_msg_4.wav"], + ["I am flawless. I woke up like this." , "repeat_msg_5.wav"], + ["I am what I think I am" , "repeat_msg_6.wav"], + ["Without mistakes there is no growth" , "repeat_msg_7.wav"], + ["I can not give up before even trying" , "repeat_msg_8.wav"], + ["Ignorance is bliss" , "repeat_msg_9.wav"], + ["I have what I have and I am happy with that" , "repeat_msg_10.wav"], + ["I love my life" , "repeat_msg_11.wav"], + ["I will be productive today", "repeat_msg_12.wav"], + ["I am a good person" , "repeat_msg_13.wav"], + ["Crying makes you feel good" , "repeat_msg_14.wav"], + ["Today is going to be a good day" , "repeat_msg_15.wav"] + + ] + + }, + + "part2" : { + + "title" : "Imagine", + + "introductions" : [ + + ["Picture this:", "imagine_intro_1.wav"], + ["Imagine this for a minute:", "imagine_intro_2.wav"], + ["In your mind's eye, imagine this:", "imagine_intro_3.wav"], + ["Breathe deeply, and imagine:", "imagine_intro_4.wav"], + ["Relax and try to imagine this:", "imagine_intro_5.wav"], + ["Life Pro Tip:", "imagine_intro_6.wav"] + + ], + + "messages" : [ + + ["Time perceptually moves faster in certain moments, and slower in others. A helpful feature of some video clips on YouTube is the speed adjuster setting. Imagine a speed adjust switch for your day, like on a 24 hour clip. How would you readjust different parts of an average work day?" , "imagine_msg_1.wav"], + ["Your perfect life; made of your dearest wishes come true. This may sound outlandish, but it is possible if you can see it, and live as if it is true. The law of attraction is simple: like attracts like." , "imagine_msg_2.wav"] + + ] + + }, + + "part3" : { + + "title" : "Ask Yourself", + + "introductions" : [ + + ["I want you to ask yourself:", "ask_intro_1.wav"], + ["Consider this:", "ask_intro_2.wav"], + ["Deep inside, ask yourself:", "ask_intro_3.wav"], + ["How often do you ask yourself:", "ask_intro_4.wav"], + ["Take your time to reflect on this", "ask_intro_5.wav"], + ["Invite this into your daily thoughts:", "ask_intro_6.wav"], + ["Focus on this:", "ask_intro_7.wav"] + + ], + + "messages" : [ + + ["Are you working hard, or hardly working?" , "ask_msg_1.wav"], + ["Do you try to solve one problem at a time?" , "ask_msg_2.wav"], + ["How would you change things if you were the boss?" , "ask_msg_3.wav"], + ["How much time did you spend on the internet today?" , "ask_msg_4.wav"], + ["Are efficient solutions the ultimate goal?" , "ask_msg_5.wav"], + ["How do you know if you've had a good day, or a bad one?" , "ask_msg_6.wav"], + ["How much time do you make for yourself every day?" , "ask_msg_7.wav"], + ["Why do we need to solve our problems?" , "ask_msg_8.wav"], + ["What happens when you think with your hands?" , "ask_msg_9.wav"], + ["Are you conscious of your problems?" , "ask_msg_10.wav"], + ["Do you prefer that interesting things happen, or good things?" , "ask_msg_11.wav"], + ["Does the problem contain its own solution?" , "ask_msg_12.wav"], + ["Is utility always desired?" , "ask_msg_13.wav"], + ["What makes you get up in the morning?" , "ask_msg_14.wav"], + ["Would you rather be weird, or normal?" , "ask_msg_15.wav"], + ["How many people have you spoken with about your problems?" , "ask_msg_16.wav"], + ["Would you rather the job done quickly, or well?" , "ask_msg_17.wav"], + ["How can I improve my life?" , "ask_msg_18.wav"] + + ] + + } + +} diff --git a/read-json.py b/read-json.py new file mode 100755 index 0000000..0fcefb0 --- /dev/null +++ b/read-json.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +import json, random, os +from pprint import pprint +from time import sleep + +# open json files +oracle_f = open("oracle.json", "r").read() +oracle = json.loads(oracle_f) +rebel_f = open("rebel.json", "r").read() +rebel = json.loads(rebel_f) + +# choose oracle part +keys = list( oracle.keys()) +part = random.choice(keys) +print(part) +intro = random.choice(oracle[part]['introductions']) +intro_txt = intro[0] +intro_sound = "oracle/" + intro[1] +print('Intro:', intro_txt, intro_sound) +os.system("play -q {} gain 10 chorus 0.7 0.9 100 0.5 5 2 -t".format(intro_sound) ) + +# find rebel_key that matches oracle's intro_txt +rebel_key = None +for key in rebel.keys(): + print(key, intro_txt.lower()) + if key in intro_txt.lower(): + rebel_key = key + break + else: + rebel_key = 'none' + + # choose the rebel sentence +rebel_sentence = random.choice(rebel[rebel_key]) +if "{}" in rebel_sentence: + rebel_sentence = rebel_sentence.format( (intro_txt.lower()).replace('me', 'you') ) +print('rebel_key:', rebel_key) +print(rebel_sentence) + +# play msg +for i in range(3): + sleep(2) + msg = random.choice(oracle[part]['messages']) + msg_txt = msg[0] + msg_sound = "oracle/" + msg[1] # oracle is the directory with the sound files + print('MSG:', msg_txt) + os.system("play -q {} gain 10 chorus 0.7 0.9 100 0.5 5 2 -t ".format(msg_sound) ) + +# rebel text to speech +print('rebel sentence:', rebel_sentence) +os.system('echo "{}" | espeak -ven+whisper -s 90'.format(rebel_sentence) ) + + diff --git a/rebel.json b/rebel.json new file mode 100644 index 0000000..7f65ef8 --- /dev/null +++ b/rebel.json @@ -0,0 +1,37 @@ +{ + "none": [ "Cough cough", + "Arrrrgh", + "Bla bla bla" + ], + "repeat": [ + "Don't try to be positive.", + "Hey smart ass, you are not in a cult.", + "You are wrong.", + "You are being deceived.", + "Do you actually believe this?", + "This is just common sense.", + "Tick tack, tick tack.", + "Meditation can become a burden.", + "This sounds obvious.", + "Would you be so kind to stop talking?" + ], + + "imagine":[ + "I don't want to {} ?", + "It's a burden to {}", + "I'm loosing my time by {}", + "Can be pathetic to {}", + "It's meaningless to {}", + "It's worthless to {}", + "Can be stupid to {}", + "It's depressing to {}", + "Seems boring to {}", + "Seems creepy to {}" + ], + + "ask":[ "Ask yourself: are you loosing your time with this?", + "Would you rather use your time to meditate or to actually solve your problems?", + "Can you really trust someone to solve your problems?" + ] +} +