def run(line): mixer.init(channels=1, frequency=12100) line = line.rstrip(string.punctuation).strip().lower() if TOGGLE_SCRAPE and client is not None: dir_str = make_url_str(line) dir_name = "../images/" + dir_str if os.path.exists(dir_name): time.sleep(7) client.send_message("/swap", line + ":" + dir_str) else: scrape_line(line, dir_name) if client: client.send_message("/swap", line + ":" + dir_str) TextToSpeech(mixer, save=TOGGLE_SAVE).run_(line) else: TextToSpeech(mixer, save=TOGGLE_SAVE).run_(line) if TOGGLE_NLP: time.sleep(ROBOT_SPEECH_ECHO_DELAY) speech_echoes_arr = spacy_nlp.sentencewalk(line, *nlp_args, N_ECHO_WALKS) BaseThread(target=robot_speech_echoes, args=[speech_echoes_arr]).start()
def __init__(self, mixer, sleep=False, max_client=None, save=False): Parent.__init__(self) self.mixer = mixer self.save_file = save self.max_client = max_client self.sleep = sleep self.file_index = 0 self._voice_ids = [ 'Geraint', 'Gwyneth', 'Mads', 'Naja', 'Hans', 'Marlene', 'Nicole', 'Russell', 'Amy', 'Brian', 'Emma', 'Raveena', 'Ivy', 'Joanna', 'Joey', 'Justin', 'Kendra', 'Kimberly', 'Salli', 'Conchita', 'Enrique', 'Miguel', 'Penelope', 'Chantal', 'Celine', 'Mathieu', 'Dora', 'Karl', 'Carla', 'Giorgio', 'Mizuki', 'Liv', 'Lotte', 'Ruben', 'Ewa', 'Jacek', 'Jan', 'Maja', 'Ricardo', 'Vitoria', 'Cristiano', 'Ines', 'Carmen', 'Maxim', 'Tatyana', 'Astrid', 'Filiz', 'Vicki' ]
def __init__(self, max_images): Parent.__init__(self) self.max_images = max_images self.pool = ThreadPool(10)