1+ import asyncio
12from prefect import flow
23from dyntastic import A
34from pydantic import HttpUrl
1112
1213
1314@flow (log_prints = True )
14- async def add_subtitles ():
15+ def add_subtitles ():
16+ print ("Getting meetings" )
1517 meetings = get_meetings (days = 90 )
1618 meetings_with_transcripts = [
1719 meeting
1820 for meeting in meetings
1921 if hasattr (meeting , "transcripts" ) and meeting .transcripts is not None or []
2022 ]
23+ print (f"Found { len (meetings_with_transcripts )} meetings with transcripts" )
2124 for meeting in meetings_with_transcripts :
2225 for transcript_url in meeting .transcripts :
23- transcript_data = await async_get_json (transcript_url .encoded_string ())
26+ print (f"Processing { transcript_url } " )
27+ transcript_data = asyncio .run (
28+ async_get_json (transcript_url .encoded_string ())
29+ )
30+ print (f"Transcript data: { transcript_data } " )
2431 transcript = Transcript .model_validate (transcript_data )
2532 language = transcript .language
2633 if f"{ language } .vtt" in meeting .subtitles :
2734 continue
28- track_content = await create_vtt_track (
29- transcript ,
30- include_speaker_prefix = False ,
35+ print (f"Creating VTT track for { language } " )
36+ track_content = asyncio .run (
37+ create_vtt_track (
38+ transcript ,
39+ include_speaker_prefix = False ,
40+ )
3141 )
42+ print (f"Saving VTT track to S3" )
3243 result : HttpUrl = save_content_to_s3 (
3344 track_content ,
3445 "tgov-assets" ,
3546 f"{ meeting .filename ()} /subtitles/{ language } .vtt" ,
3647 "text/vtt" ,
3748 )
49+ print (f"VTT track saved to S3" )
3850 if not meeting .subtitles :
3951 meeting .subtitles = [result ]
4052 else :
@@ -43,10 +55,11 @@ async def add_subtitles():
4355 if result not in meeting .subtitles
4456 else None
4557 )
58+ print (f"Saving meeting to DynamoDB" )
4659 meeting .save ()
60+ print (f"Meeting saved to DynamoDB" )
4761
4862
4963if __name__ == "__main__" :
50- import asyncio
51-
52- asyncio .run (add_subtitles ())
64+ print ("Starting add_subtitles" )
65+ add_subtitles ()
0 commit comments