@@ -34,6 +34,8 @@ type Checkrr struct {
34
34
lidarr []connections.Lidarr
35
35
ignoreExts []string
36
36
ignorePaths []string
37
+ removeVideo []string
38
+ removeAudio []string
37
39
ignoreHidden bool
38
40
config * viper.Viper
39
41
FullConfig * viper.Viper
@@ -71,6 +73,8 @@ func (c *Checkrr) Run() {
71
73
72
74
c .ignoreExts = c .config .GetStringSlice ("ignoreexts" )
73
75
c .ignorePaths = c .config .GetStringSlice ("ignorepaths" )
76
+ c .removeVideo = c .config .GetStringSlice ("removevideo" )
77
+ c .removeAudio = c .config .GetStringSlice ("removeaudio" )
74
78
c .ignoreHidden = c .config .GetBool ("ignorehidden" )
75
79
76
80
// I'm tired of waiting for filetype to support this. We'll force it by adding to the matchers on the fly.
@@ -260,6 +264,40 @@ func (c *Checkrr) checkFile(path string) {
260
264
} else {
261
265
log .WithFields (log.Fields {"Format" : data .Format .FormatLongName , "Type" : detectedFileType , "FFProbe" : true }).Infof (string (data .Format .Filename ))
262
266
267
+ log .Info (data .Format .FormatName )
268
+
269
+ if detectedFileType == "Video" {
270
+ for _ , stream := range data .Streams {
271
+ log .Info (stream .CodecName )
272
+ for _ , codec := range c .removeVideo {
273
+ if stream .CodecName == codec {
274
+ log .WithFields (log.Fields {"Format" : data .Format .FormatLongName , "Type" : detectedFileType , "FFProbe" : true }).Infof ("Detected %s. Removing." , string (data .FirstVideoStream ().CodecName ))
275
+ c .deleteFile (path )
276
+ return
277
+ }
278
+ }
279
+ for _ , codec := range c .removeAudio {
280
+ if stream .CodecName == codec {
281
+ log .WithFields (log.Fields {"Format" : data .Format .FormatLongName , "Type" : detectedFileType , "FFProbe" : true }).Infof ("Detected %s. Removing." , string (data .FirstVideoStream ().CodecName ))
282
+ c .deleteFile (path )
283
+ return
284
+ }
285
+ }
286
+ }
287
+ } else {
288
+ log .Debug (data .FirstAudioStream ().CodecName )
289
+ for _ , stream := range data .Streams {
290
+ log .Info (stream .CodecName )
291
+ for _ , codec := range c .removeAudio {
292
+ if stream .CodecName == codec {
293
+ log .WithFields (log.Fields {"Format" : data .Format .FormatLongName , "Type" : detectedFileType , "FFProbe" : true }).Infof ("Detected %s. Removing." , string (data .FirstVideoStream ().CodecName ))
294
+ c .deleteFile (path )
295
+ return
296
+ }
297
+ }
298
+ }
299
+ }
300
+
263
301
filehash := imohash .New ()
264
302
sum , _ := filehash .SumFile (path )
265
303
0 commit comments