def convert(): list_voices = [] try: database_connection = DbConnection() with database_connection: query_voices = database_connection.query(Voice.UNCONVERTED_FILES) for voice in query_voices: list_voices.append(Voice(id_num=voice[0], voice_file=voice[1], email=voice[2], name=voice[3], tittle=voice[4])) if list_voices.__len__() != 0: database_connection.update(Voice.create_update_converting_sql(list_voices)) except: print('error en la base de datos') for voice in list_voices: file_mp3 = voice.voice_file[:-3] if voice.voice_file[-3:] != 'mp3': try: media_in = Settings.MEDIA_DIR + voice.voice_file path_out = 'converted/' + file_mp3 + 'mp3' media_out = Settings.MEDIA_DIR + path_out my_thread = Thread(target=ffmpeg, args=[media_in, media_out, voice.id_num, path_out, voice.email, voice.tittle, voice.name]) my_thread.start() my_thread.join(60) except OSError as e: print('error de os')
def main(): ears = Ears() voice = Voice() try: while True: text = ears.listen() print("\n" + text) voice.speak(text) except KeyboardInterrupt: print("Communication stopped.")
def process(k, v): #Person Table global insertString, voice1, voice2 if k == 'Print Number': voice1 = "" voice2 = "" insertString = "INSERT STRING START" insertString += "\nPrint Number:" + v if k == 'Composer': for c in v.split(';'): p = Person(conn, c.strip()) p.store() insertString += "\nComposer:" + c.strip() if k == 'Editor': p = Person(conn, v.strip()) p.store() insertString += "\nEditor:" + v #Score Table if k == 'Genre': insertString += "\nGenre:" + v if k == 'Key': insertString += "\nKey:" + v if k == 'Composition Year': insertString += "\nComposition Year:" + v if k == 'Incipit': insertString += "\nIncipit:" + v #push it in! Score(conn, insertString).store() if voice1 != "": Voice(conn, (insertString + voice1)).store() if voice2 != "": Voice(conn, (insertString + voice2)).store() Edition(conn, insertString).store() getAuthors(insertString) Print(conn, insertString).store() #Voice Table if k == 'Voice 1': voice1 = "\nVoice 1:" + v if k == 'Voice 2': voice2 = "\nVoice 2:" + v if k == 'Voice 3': voice2 = "\nVoice 3:" + v #Edition Table if k == 'Publication Year': insertString += "\nPublication Year:" + v if k == 'Edition': insertString += "\nEdition:" + v #Print Table if k == 'Partiture': insertString += "\nPartiture:" + v
def __loadVoiceLines(self, voicePaths): """ read the configs of voice lines :param voicePaths: :return: """ voices = [] for voicePath in voicePaths.values(): voices.append(Voice(voicePath)) self.__voices = voices
def main(): logging.getLogger().setLevel(logging.DEBUG) cf, cf_data = parse() if len(argv) == 1: pass al = Voice() al.one_thing() battery_instance = Battery() # READ BATTERY charge_info = battery_instance.get_low_battery_warning_level() # logging.debug(charge_info) if charge_info[0] == 0 and charge_info[1]: add_msg = " All cool! %s Percent remaining" % charge_info[1] elif charge_info[0] == 1: add_msg = " Low Battery! %s Percent remaining" % charge_info[1] logging.info(cf_data["MSG"]+add_msg) cf.set_pickle(cf_data) al.speak(add_msg) else: add_msg = " Battery is Charging!" setupCron()
def ffmpeg(media_in, media_out, id_num, path_out, email, tittle, name): output = subprocess.call(['ffmpeg', '-i', media_in, media_out, '-y']) if output < 0: print('error en conversion') else: try: database_connection = DbConnection() with database_connection: database_connection.update(Voice.create_update_converted_sql(id_num, path_out)) Email.send_email(email=email, tittle=tittle, name=name) except: print('Error actualizando')
def buildVoice(self, instrument, name): voiceAmt = len(self._voices) chan = voiceAmt if voiceAmt != 9 else 10 # Channel 9 (10 in MIDI docs) is strictly percussion. voiceDum = Voice( self._mf, chan, instrument, self._tempo, name, 0, # For now, start all at zero. ) self._voices.append(voiceDum) return voiceDum
def main(): logging.getLogger().setLevel(logging.DEBUG) cf, cf_data = parse() if len(argv) == 1: pass al = Voice() al.one_thing() battery_instance = Battery() # READ BATTERY charge_info = battery_instance.get_low_battery_warning_level() # logging.debug(charge_info) if charge_info[0] == 0 and charge_info[1]: add_msg = " All cool! %s Percent remaining" % charge_info[1] elif charge_info[0] == 1: add_msg = " Low Battery! %s Percent remaining" % charge_info[1] logging.info(cf_data["MSG"] + add_msg) cf.set_pickle(cf_data) al.speak(add_msg) else: add_msg = " Battery is Charging!"
def add_cogs(self): """Add the cogs to the bot client.""" self.add_cog(Voice(self))
from Voice import Voice voice = Voice() def main(): voice.activate() if __name__ == "__main__": main()