@@ -37,6 +37,7 @@ type Checkrr struct {
3737 ignorePaths []string
3838 removeVideo []string
3939 removeAudio []string
40+ removeLang []string
4041 ignoreHidden bool
4142 config * viper.Viper
4243 FullConfig * viper.Viper
@@ -76,6 +77,7 @@ func (c *Checkrr) Run() {
7677 c .ignorePaths = c .config .GetStringSlice ("ignorepaths" )
7778 c .removeVideo = c .config .GetStringSlice ("removevideo" )
7879 c .removeAudio = c .config .GetStringSlice ("removeaudio" )
80+ c .removeLang = c .config .GetStringSlice ("removelang" )
7981 c .ignoreHidden = c .config .GetBool ("ignorehidden" )
8082
8183 // I'm tired of waiting for filetype to support this. We'll force it by adding to the matchers on the fly.
@@ -284,6 +286,19 @@ func (c *Checkrr) checkFile(path string) {
284286 return
285287 }
286288 }
289+ for _ , language := range c .removeLang {
290+ streamlang , err := stream .TagList .GetString ("Language" )
291+ if err == nil {
292+ if streamlang == language {
293+ log .WithFields (log.Fields {"Format" : data .Format .FormatLongName , "Type" : detectedFileType , "FFProbe" : true , "Codec" : stream .CodecName , "Language" : streamlang }).Infof ("Detected %s. Removing." , string (streamlang ))
294+ c .deleteFile (path )
295+ return
296+ }
297+ } else {
298+ log .WithFields (log.Fields {"Format" : data .Format .FormatLongName , "Type" : detectedFileType , "FFProbe" : true , "Codec" : stream .CodecName , "Language" : "unknown" }).Warn ("Error getting audio stream language" )
299+ c .deleteFile (path )
300+ }
301+ }
287302 }
288303 } else {
289304 if data .FirstAudioStream () != nil {
@@ -413,7 +428,7 @@ type BadFile struct {
413428 FileExt string `json:"fileExt"`
414429 Reacquire bool `json:"reacquire"`
415430 Service string `json:"service"`
416- Date int64 `json:"date`
431+ Date int64 `json:"date" `
417432}
418433
419434// TODO: if h2non/filetype#120 ever gets completed, remove this logic
0 commit comments