Skip to content

Commit

Permalink
fix(fc2): delete intermediates only on remux
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkness4 committed Jan 14, 2024
1 parent 72e825b commit fbc6a41
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions fc2/fc2.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,8 @@ func (f *FC2) Watch(ctx context.Context) (*GetMetaData, error) {
f.log.Error().Err(extractAudioErr).Msg("ffmpeg audio extract finished with error")
}
}
if !f.params.KeepIntermediates && (f.params.Remux || f.params.ExtractAudio) &&
probeErr == nil &&
remuxErr == nil &&
extractAudioErr == nil {
f.log.Info().Str("file", fnameStream).Msg("delete intermediate files")
if err := os.Remove(fnameStream); err != nil {
f.log.Error().Err(err).Msg("couldn't delete intermediate file")
}
}

// Concat
if f.params.Concat {
f.log.Info().Str("output", nameConcatenated).Str("prefix", nameConcatenatedPrefix).Msg(
"concatenating stream...",
Expand Down Expand Up @@ -293,6 +286,17 @@ func (f *FC2) Watch(ctx context.Context) (*GetMetaData, error) {
}
}

// Delete intermediates
if !f.params.KeepIntermediates && f.params.Remux &&
probeErr == nil &&
remuxErr == nil &&
extractAudioErr == nil {
f.log.Info().Str("file", fnameStream).Msg("delete intermediate files")
if err := os.Remove(fnameStream); err != nil {
f.log.Error().Err(err).Msg("couldn't delete intermediate file")
}
}

f.log.Info().Msg("done")

return meta, errWs
Expand Down

0 comments on commit fbc6a41

Please sign in to comment.