Skip to content

Commit

Permalink
Closes #108. Patches potential ni pointer ref and missed bad audio fi…
Browse files Browse the repository at this point in the history
…le detection point.
  • Loading branch information
aetaric committed Oct 8, 2024
1 parent d5532b1 commit 1d130af
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions check/checkrr.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,30 +271,36 @@ func (c *Checkrr) checkFile(path string) {
log.Debug(stream.CodecName)
for _, codec := range c.removeVideo {
if stream.CodecName == codec {
log.WithFields(log.Fields{"Format": data.Format.FormatLongName, "Type": detectedFileType, "FFProbe": true}).Infof("Detected %s. Removing.", string(data.FirstVideoStream().CodecName))
log.WithFields(log.Fields{"Format": data.Format.FormatLongName, "Type": detectedFileType, "FFProbe": true, "Codec": stream.CodecName}).Infof("Detected %s. Removing.", string(data.FirstVideoStream().CodecName))
c.deleteFile(path)
return
}
}
for _, codec := range c.removeAudio {
if stream.CodecName == codec {
log.WithFields(log.Fields{"Format": data.Format.FormatLongName, "Type": detectedFileType, "FFProbe": true}).Infof("Detected %s. Removing.", string(data.FirstVideoStream().CodecName))
log.WithFields(log.Fields{"Format": data.Format.FormatLongName, "Type": detectedFileType, "FFProbe": true, "Codec": stream.CodecName}).Infof("Detected %s. Removing.", string(data.FirstVideoStream().CodecName))
c.deleteFile(path)
return
}
}
}
} else {
log.Debug(data.FirstAudioStream().CodecName)
for _, stream := range data.Streams {
log.Debug(stream.CodecName)
for _, codec := range c.removeAudio {
if stream.CodecName == codec {
log.WithFields(log.Fields{"Format": data.Format.FormatLongName, "Type": detectedFileType, "FFProbe": true}).Infof("Detected %s. Removing.", string(data.FirstVideoStream().CodecName))
c.deleteFile(path)
return
if data.FirstAudioStream() != nil {
log.Debug(data.FirstAudioStream().CodecName)
for _, stream := range data.Streams {
log.Debug(stream.CodecName)
for _, codec := range c.removeAudio {
if stream.CodecName == codec {
log.WithFields(log.Fields{"Format": data.Format.FormatLongName, "Type": detectedFileType, "FFProbe": true, "Codec": stream.CodecName}).Infof("Detected %s. Removing.", string(data.FirstVideoStream().CodecName))
c.deleteFile(path)
return
}
}
}
} else {
log.WithFields(log.Fields{"Format": data.Format.FormatLongName, "Type": detectedFileType, "FFProbe": true, "Codec": "unknown"}).Infof("No Audio Stream detected for audio file: %s. Removing.", string(path))
c.deleteFile(path)
return
}
}

Expand Down

0 comments on commit 1d130af

Please sign in to comment.