Logging to file / about dialog, youtube transcripts are downloaded on the right folder, fixed Ollama not running sometimes

This commit is contained in:
jeffser
2024-07-29 01:35:07 -06:00
parent 7c26956cd4
commit c0f8825f83
4 changed files with 17 additions and 6 deletions

View File

@@ -285,9 +285,9 @@ def youtube_caption_response(self, dialog, task, video_url, caption_drop_down):
selected_caption = caption_drop_down.get_selected_item().get_string()
for event in yt.captions[selected_caption.split(' | ')[1]].json_captions['events']:
text += "{}\n".format(event['segs'][0]['utf8'].replace('\n', '\\n'))
if not os.path.exists('/tmp/alpaca/youtube'):
os.makedirs('/tmp/alpaca/youtube')
file_path = os.path.join('/tmp/alpaca/youtube', f'{yt.title} ({selected_caption.split(" | ")[0]})')
if not os.path.exists(os.path.join(self.cache_dir, 'tmp/youtube')):
os.makedirs(os.path.join(self.cache_dir, 'tmp/youtube'))
file_path = os.path.join(os.path.join(self.cache_dir, 'tmp/youtube'), f'{yt.title} ({selected_caption.split(" | ")[0]})')
with open(file_path, 'w+') as f:
f.write(text)
self.attach_file(file_path, 'youtube')