From 2f3d62751a50f53b5c6662b7c03af89acf2e5305 Mon Sep 17 00:00:00 2001 From: acastro Date: Mon, 19 Nov 2018 14:37:50 +0000 Subject: [PATCH] simplifying rebel - with 3rd item of guru line --- guru.json | 30 ++++++++++++------------- read-json.py | 50 ++++++++++++++++++----------------------- rebel.json | 63 ++++++++++++++++++++++++++++++++++++---------------- 3 files changed, 81 insertions(+), 62 deletions(-) mode change 100644 => 100755 guru.json diff --git a/guru.json b/guru.json old mode 100644 new mode 100755 index cabd5ae..813833e --- a/guru.json +++ b/guru.json @@ -1,17 +1,17 @@ { - "part1" : { + "part1" : { "title" : "Repeat", "introductions" : [ - ["Don't be shy, repeat after me:", "repeat_intro_01.wav"], - ["Follow my words and repeat:", "repeat_intro_02.wav"], - ["Take a deep breath, and repeat after me:", "repeat_intro_03.wav"], - ["Keep calm and repeat after me:", "repeat_intro_04.wav"], - ["Would you please be so kind as to repeat after me:", "repeat_intro_05.wav"], - ["Please repeat after me:" , "repeat_intro_06.wav"] + ["Don't be shy, repeat after me:", "repeat_intro_01.wav", "be shy and repeat after you."], + ["Follow my words and repeat:", "repeat_intro_02.wav", "follow your words and repeat."], + ["Take a deep breath, and repeat after me:", "repeat_intro_03.wav", "Take a deep breath, and repeat after you."], + ["Keep calm and repeat after me:", "repeat_intro_04.wav", "keep calm and repeat after you."], + ["Would you please be so kind as to repeat after me:", "repeat_intro_05.wav", "be kind and repeat after you"], + ["Please repeat after me:", "repeat_intro_06.wav", "repeat after you."] ], @@ -42,13 +42,13 @@ "introductions" : [ - ["I want you to ask yourself:", "ask_intro_01.wav"], - ["Consider this:", "ask_intro_02.wav"], - ["Deep inside, ask yourself:", "ask_intro_03.wav"], - ["How often do you ask yourself:", "ask_intro_04.wav"], - ["Take your time to reflect on this:", "ask_intro_05.wav"], - ["Invite this into your daily thoughts:", "ask_intro_06.wav"], - ["Focus on this:", "ask_intro_07.wav"] + ["I want you to ask yourself:", "ask_intro_01.wav", "Asking myself"], + ["Consider this:", "ask_intro_02.wav", "Considering that"], + ["Deep inside, ask yourself:", "ask_intro_03.wav", "Asking myself"], + ["How often do you ask yourself:", "ask_intro_04.wav", "Oftenly asking myself"], + ["Take your time to reflect on this:", "ask_intro_05.wav", "Reflecting on that"], + ["Invite this into your daily thoughts:", "ask_intro_06.wav", "Controlling my daily thoughts"], + ["Focus on this:", "ask_intro_07.wav", "Focusing on that"] ], @@ -77,4 +77,4 @@ } -} \ No newline at end of file +} diff --git a/read-json.py b/read-json.py index 0fcefb0..ce864d1 100755 --- a/read-json.py +++ b/read-json.py @@ -4,49 +4,43 @@ from pprint import pprint from time import sleep # open json files -oracle_f = open("oracle.json", "r").read() +oracle_f = open("guru.json", "r").read() oracle = json.loads(oracle_f) rebel_f = open("rebel.json", "r").read() rebel = json.loads(rebel_f) -# choose oracle part +# GURU PART keys = list( oracle.keys()) -part = random.choice(keys) +part = random.choice(keys) # choose: Repeat OR Ask Yourself print(part) +sound_dir = "Audio_recordings/" + oracle[part]['title'] + "/" intro = random.choice(oracle[part]['introductions']) intro_txt = intro[0] -intro_sound = "oracle/" + intro[1] +intro_sound = sound_dir + 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) ) +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) +# REBEL reply +rebel_run = random.choice([True, False]) # shall the rebel enter?? +if rebel_run is True: + rebel_reply_snippet = intro[2] # comes from guru/oracle dictionary + rebel_reply = random.choice( rebel[part] ) + rebel_sentence = rebel_reply.format(rebel_reply_snippet) + # play msg -for i in range(3): - sleep(2) +for i in range( random.randint(1,4) ): + sleep( random.randint(2,5) ) 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) ) + msg_sound = sound_dir + msg[1] + print('MSG:', msg_txt, msg_sound) + 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) ) +if rebel_run is True: + print('rebel sentence:', rebel_sentence) + os.system('echo "{}" | espeak -ven+whisper -s 110'.format(rebel_sentence) ) diff --git a/rebel.json b/rebel.json index 7f65ef8..7629ca7 100644 --- a/rebel.json +++ b/rebel.json @@ -1,37 +1,62 @@ { - "none": [ "Cough cough", - "Arrrrgh", - "Bla bla bla" - ], - "repeat": [ +"part1": [ "Don't try to be positive.", "Hey smart ass, you are not in a cult.", "You are wrong.", + "Just have fun!", + "Arrrrgh", "You are being deceived.", "Do you actually believe this?", "This is just common sense.", - "Tick tack, tick tack.", + "Tick tock, tick tock.", + "Cough cough", "Meditation can become a burden.", "This sounds obvious.", - "Would you be so kind to stop talking?" - ], - - "imagine":[ + "Would you be so kind as to stop talking?", "I don't want to {} ?", "It's a burden to {}", - "I'm loosing my time by {}", - "Can be pathetic to {}", + "It is a waste of time to {}", + "It can be pathetic to {}", "It's meaningless to {}", "It's worthless to {}", - "Can be stupid to {}", + "It can be stupid to {}", "It's depressing to {}", + "I am here because I enjoy looking at these fools.", + "Your colleague is stealing your credit!", "Seems boring to {}", - "Seems creepy to {}" + "Seems creepy to {}", + "A committee is twelve men doing the work of one.", + "How much vacation time do you get?" ], - - "ask":[ "Ask yourself: are you loosing your time with this?", + + "part2":[ + "Ask yourself: are you wasting 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?" - ] + "Can you really trust someone to solve your problems?", + "Instead of that, ask for a raise!", + "Leave before it's overtime!", + "Don't stay late today.", + "Why aren't you leaving?", + "Grab a coffee with a friend", + "Can I leave early today?", + "Come on...", + "Cough cough cough cough", + "Bla bla bla", + "What brought you here?", + "Oh come on, another one?", + "Ahem", + "I have to leave early on Fridays.", + "My résumé is fake.", + "I don’t have a solution, but I do admire the problem.", + "Focus on this: are you being paid enough?", + "Another meeting that could have been an email.", + "Ask your boss, how much do they get paid?", + "Can I ask you to cover for me while I am in Bora Bora?", + "Ask for employee discounts, you are not getting any.", + "{} seems too self-absorbed", + "{} can look egocentric.", + "{} is narcissistic", + "Buuurp", + "Use your common sense." + ] } -