@@ -161,35 +161,6 @@ def get_color_code_for_ass(color_name: str) -> str:
161161 return color_map .get (color_name , "FFFFFF" ) # Default to white if color not found
162162
163163
164- async def request_transcript (transcript_url : HttpUrl ) -> Transcript :
165- async with aiohttp .ClientSession () as session :
166- async with session .get (transcript_url ) as response :
167- transcript_data = await response .json ()
168- return Transcript .model_validate (transcript_data )
169-
170-
171- async def load_transcript (
172- transcript_data : Union [Dict [str , Any ], str , Path ],
173- ) -> Transcript :
174- """
175- Load a transcript file or dictionary and return a validated Transcript model.
176-
177- Args:
178- transcript_data: Either a transcript data dictionary or path to JSON file
179-
180- Returns:
181- Transcript object
182- """
183- # Load transcript if a path was provided
184- if isinstance (transcript_data , (str , Path )):
185- with open (transcript_data , "r" , encoding = "utf-8" ) as f :
186- data = json .load (f )
187- else :
188- data = transcript_data
189-
190- return Transcript .model_validate (data )
191-
192-
193164def chunk_transcript (
194165 transcript : Transcript ,
195166 max_duration : float = 5.0 ,
@@ -448,8 +419,8 @@ def add_speaker_prefixes(
448419 return chunks
449420
450421
451- def create_track (
452- transcript_data : Union [ Dict [ str , Any ], str , Path ] ,
422+ def create_subtitles (
423+ transcript : Transcript ,
453424 format : str = "srt" ,
454425 max_duration : float = 5.0 ,
455426 max_length : int = 80 ,
@@ -485,14 +456,6 @@ def create_track(
485456 # Normalize track format to TrackFormat enum internally
486457 track_format = TrackFormat (format .lower ())
487458
488- # Load and validate transcript
489- transcript = load_transcript (transcript_data )
490-
491- # Generate source file information if transcript_data is a path
492- source_file = None
493- if isinstance (transcript_data , (str , Path )):
494- source_file = str (transcript_data )
495-
496459 # Chunk the transcript
497460 chunks = chunk_transcript (
498461 transcript ,
@@ -545,7 +508,6 @@ def create_track(
545508 speakers = speakers ,
546509 word_count = word_count ,
547510 duration = track_duration ,
548- source_file = source_file ,
549511 style = AssStyle (
550512 font_name = font_name ,
551513 font_size = font_size ,
0 commit comments