Esempio n. 1
0
 def execute_song(self):
     """ organizes methods, and runs a song
     """
     print("entering execute_song()")
     while self._song_over is False:
         self._summarize_period()
         grip_info = gather_info(parse_csv(self._last_30_sec))
         self.user_stats.set_grips(grip_info)
         best_grip = evaluate_best_grip(grip_info)
         self._compile_result(grip_avg_summary_str(grip_info))
         self._last_worst_grip = evaluate_worst_grip(grip_info, self._last_worst_grip)
         summary = self.select_response()
         self._compile_result(summary)
         self._compile_result('system time = {}'.format(strftime("%H:%M:%S")))
         self._compile_result(' ')
         if self._song_over is True:
             # print('Number of grips this song = ', self._grip_count)
             return
         if self._feedback_plat == "RIVA":
             self._RIVA_message_num += 1
             text_to_RIVA(summary)
         else:#if self._feedback_plat == "Text":
             self._RIVA_message_num += 1
             to_no_voice_log(emo_less_feedback(self._RIVA_message_num, self._last_worst_grip, best_grip))
         ###else:
         ###    self._RIVA_message_num += 1
         ###    text_to_ispeech(ispeech_formatter(summary))
     print("leaving execute_song()")
     return
Esempio n. 2
0
 def test_for_restart(self):
     """ Tests whether the a new song has been started
     """
     #print("entering test_for_restart()")
     self._compile_result("UserName: "******"Welcome_str"
     #    self.first_song = False
     if self._feedback_plat == "RIVA":
         self._RIVA_message_num += 1
         text_to_RIVA("Welcome_str")
     else:# self._feedback_plat == "Text":
         self._RIVA_message_num += 1
         #to_no_voice_log("NewData:{};TTS:{}".format(self._RIVA_message_num, msg))
     ###else:
     ###    text_to_ispeech(ispeech_formatter(msg))
     while True:
         self._check_completion()
         if self._song_over is False:
             print("Song Started")
             if self._feedback_plat == "RIVA":
                 reset_RIVA_log()
                 self._RIVA_message_num += 1
                 #text_to_RIVA(self.response_welcome())
             elif self._feedback_plat == "Text":
                 to_no_voice_log((emo_less_feedback(0, 0, 0)))
             self.execute_song()
             print("Re-entered Test_for_restart()")
             if self._song_over is True:
                 interface_info = gather_info(
                     parse_csv(read_csv(CSV_functions.MUSICGLOVE)))
                 #print(interface_info)
                 #print("Song_over min/max = ", min_max)
                 self.user_stats.set_grips(interface_info)
                 self._compile_result(grip_avg_summary_str(interface_info))
                 evaluated_info = [evaluate_worst_grip(interface_info, self._last_worst_grip),
                                   evaluate_best_grip(interface_info)]
                 summary = summary_generator(evaluated_info[0], evaluated_info[1])
                 if self._feedback_plat == "RIVA":
                     self._RIVA_message_num += 1
                     #print("message_num={} summary={}".format(self._message_num, summary))
                     text_to_RIVA(summary)
                 else:# self._feedback_plat == "Text":
                     to_no_voice_log(emo_less_feedback(self._RIVA_message_num, evaluated_info[0], evaluated_info[1]))
                 ###else:
                 ###    text_to_ispeech(ispeech_formatter(summary))
                 self._last_30_sec = []
                 self._compile_result(summary)
                 self._csv_result.extend(read_csv(CSV_functions.MUSICGLOVE))
                 make_csv(self._csv_result, CSV_functions.M_GLOVE_SUMMARIES, what_song(self._grip_count))
                 self.__init__(self.user_name, restart=True)
                 self._RIVA_message_num = 1
         else:
             pass
     return
Esempio n. 3
0
             ['3', '3', '3'], ['3', '3', '3'], ['2', '2', '2'],
             ['2', '2', '2'], ['3', '3', '3'], ['2', '2', '2'],
             ['1', '1', '1'], ['2', '2', '-2'], ['1', '1', '1'],
             ['4', '4', '-4'], ['3', '3', '-3'], ['3', '3', '-3'],
             ['3', '3', '-3'], ['2', '2', '-2'], ['2', '2', '-2'],
             ['3', '3', '-3'], ['2', '2', '-2'], ['1', '1', '-1'],
             ['2', '2', '-2'], ['3', '3', '-3'], ['2', '2', '-2'],
             ['1', '1', '-1'], ['1', '1', '1'], ['4', '4', '4'],
             ['3', '3', '-3'], ['2', '2', '2'], ['1', '1', '-1'],
             ['1', '1', '-1'], ['4', '4', '4'], ['3', '3', '3'],
             ['3', '3', '-3'], ['3', '3', '-3'], ['2', '2', '-2'],
             ['2', '2', '-2'], ['3', '3', '-3'], ['2', '2', '-2'],
             ['1', '1', '-1'], ['2', '2', '-2'], ['1', '1', '1']]
 print(test_csv)
 print(parse_csv(test_csv))
 test_info = gather_info(parse_csv(test_csv))
 print(test_info)
 test = User_Stats()
 test.set_grips(test_info)
 print()
 print("new values: {}, {}, {}, {}, {}, {}".format(test._red_avg,test._blue_avg, test._green_avg, test._purple_avg, test._yellow_avg, test._overall_avg))
 print("_difference = ", test._difference)
 print("old values: {}, {}, {}, {}, {}, {}".format(test._old_red_avg,test._old_blue_avg, test._old_green_avg, test._old_purple_avg, test._old_yellow_avg, test._old_overall_avg))
 print("test 1 = " + test.select_feedback())
 for t in [1,2,3,4,5]:
     print("t= {}; avg= {}; old_avg= {}".format(int(t), test.get_grip_avg(t), test.get_old_grip_avg(t)))
 '''test.set_overall_avg(-1)
 print("test 2 = " + test.select_feedback())
 test.set_overall_avg(14.003)
 print("test 3 = " + test.select_feedback())
 test.set_overall_avg(1)