Index prior audio inputs for reuse
This commit is contained in:
@@ -433,15 +433,20 @@ func materializeS3AudioInputs(ctx context.Context, env *Env, m *manifest.Manifes
|
||||
return s3AudioMaterializationStats{}, fmt.Errorf("create work audio directory %q: %w", workAudioDir, err)
|
||||
}
|
||||
stats := s3AudioMaterializationStats{}
|
||||
priorByPath := make(map[string]*manifest.InputRecord)
|
||||
for i := range m.Inputs {
|
||||
record := &m.Inputs[i]
|
||||
if record.Kind != "audio" {
|
||||
continue
|
||||
}
|
||||
key := filepath.Clean(record.Path)
|
||||
if _, exists := priorByPath[key]; !exists {
|
||||
priorByPath[key] = record
|
||||
}
|
||||
}
|
||||
for _, obj := range audioObjects {
|
||||
workPath := filepath.Join(workAudioDir, path.Base(obj.Key))
|
||||
var prior *manifest.InputRecord
|
||||
for i := range m.Inputs {
|
||||
if m.Inputs[i].Kind == "audio" && filepath.Clean(m.Inputs[i].Path) == filepath.Clean(workPath) {
|
||||
prior = &m.Inputs[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
prior := priorByPath[filepath.Clean(workPath)]
|
||||
result, err := audio.MaterializeS3Audio(ctx, audio.S3MaterializeRequest{
|
||||
Reporter: env.Reporter, Store: env.ObjectStore, Object: obj,
|
||||
Bucket: strings.TrimSpace(env.Config.Pipeline.Storage.S3.Bucket), DestPath: workPath, Prior: prior,
|
||||
|
||||
Reference in New Issue
Block a user