mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-02-04 09:56:47 +00:00
Fix: Remove redundant checks and clarify variable scope
- Remove redundant padded_key None check (NonEmptyString cannot be None) - Move storage_path definition before try block for clarity - All padded tracks added to list (original or new)
This commit is contained in:
@@ -434,14 +434,13 @@ async def process_paddings(input: PipelineInput, ctx: Context) -> ProcessPadding
|
||||
for result in results:
|
||||
pad_result = PadTrackResult(**result[TaskName.PAD_TRACK])
|
||||
|
||||
if pad_result.padded_key:
|
||||
padded_tracks.append(
|
||||
PaddedTrackInfo(
|
||||
key=pad_result.padded_key,
|
||||
bucket_name=pad_result.bucket_name,
|
||||
track_index=pad_result.track_index,
|
||||
)
|
||||
padded_tracks.append(
|
||||
PaddedTrackInfo(
|
||||
key=pad_result.padded_key,
|
||||
bucket_name=pad_result.bucket_name,
|
||||
track_index=pad_result.track_index,
|
||||
)
|
||||
)
|
||||
|
||||
if pad_result.size > 0:
|
||||
storage_path = f"file_pipeline_hatchet/{input.transcript_id}/tracks/padded_{pad_result.track_index}.webm"
|
||||
|
||||
@@ -94,6 +94,8 @@ async def pad_track(input: PaddingInput, ctx: Context) -> PadTrackResult:
|
||||
track_index=input.track_index,
|
||||
)
|
||||
|
||||
storage_path = f"file_pipeline_hatchet/{input.transcript_id}/tracks/padded_{input.track_index}.webm"
|
||||
|
||||
with tempfile.NamedTemporaryFile(suffix=".webm", delete=False) as temp_file:
|
||||
temp_path = temp_file.name
|
||||
|
||||
@@ -107,7 +109,6 @@ async def pad_track(input: PaddingInput, ctx: Context) -> PadTrackResult:
|
||||
)
|
||||
|
||||
file_size = Path(temp_path).stat().st_size
|
||||
storage_path = f"file_pipeline_hatchet/{input.transcript_id}/tracks/padded_{input.track_index}.webm"
|
||||
|
||||
with open(temp_path, "rb") as padded_file:
|
||||
await storage.put_file(storage_path, padded_file)
|
||||
|
||||
Reference in New Issue
Block a user