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
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