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,7 +434,6 @@ async def process_paddings(input: PipelineInput, ctx: Context) -> ProcessPadding
|
|||||||
for result in results:
|
for result in results:
|
||||||
pad_result = PadTrackResult(**result[TaskName.PAD_TRACK])
|
pad_result = PadTrackResult(**result[TaskName.PAD_TRACK])
|
||||||
|
|
||||||
if pad_result.padded_key:
|
|
||||||
padded_tracks.append(
|
padded_tracks.append(
|
||||||
PaddedTrackInfo(
|
PaddedTrackInfo(
|
||||||
key=pad_result.padded_key,
|
key=pad_result.padded_key,
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ async def pad_track(input: PaddingInput, ctx: Context) -> PadTrackResult:
|
|||||||
track_index=input.track_index,
|
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:
|
with tempfile.NamedTemporaryFile(suffix=".webm", delete=False) as temp_file:
|
||||||
temp_path = temp_file.name
|
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
|
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:
|
with open(temp_path, "rb") as padded_file:
|
||||||
await storage.put_file(storage_path, padded_file)
|
await storage.put_file(storage_path, padded_file)
|
||||||
|
|||||||
Reference in New Issue
Block a user