Fix language filters

This commit is contained in:
Ben Adrian Sarmiento
2024-06-29 02:19:01 +02:00
parent a9778bb1f3
commit 21814baf31

View File

@@ -396,7 +396,11 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren
if stream.CodecType != "audio" { if stream.CodecType != "audio" {
continue continue
} }
if strings.EqualFold(stream.Tags.Language, filter.MediaInfoWithAudioLanguage) { language, err := stream.TagList.GetString("language")
if err != nil {
continue
}
if strings.EqualFold(language, filter.MediaInfoWithAudioLanguage) {
return true return true
} }
} }
@@ -409,7 +413,11 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren
if stream.CodecType != "audio" { if stream.CodecType != "audio" {
continue continue
} }
if strings.EqualFold(stream.Tags.Language, filter.MediaInfoWithoutAudioLanguage) { language, err := stream.TagList.GetString("language")
if err != nil {
continue
}
if strings.EqualFold(language, filter.MediaInfoWithoutAudioLanguage) {
return false return false
} }
} }
@@ -422,7 +430,11 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren
if stream.CodecType != "subtitle" { if stream.CodecType != "subtitle" {
continue continue
} }
if strings.EqualFold(stream.Tags.Language, filter.MediaInfoWithSubtitleLanguage) { language, err := stream.TagList.GetString("language")
if err != nil {
continue
}
if strings.EqualFold(language, filter.MediaInfoWithSubtitleLanguage) {
return true return true
} }
} }
@@ -435,7 +447,11 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren
if stream.CodecType != "subtitle" { if stream.CodecType != "subtitle" {
continue continue
} }
if strings.EqualFold(stream.Tags.Language, filter.MediaInfoWithoutSubtitleLanguage) { language, err := stream.TagList.GetString("language")
if err != nil {
continue
}
if strings.EqualFold(language, filter.MediaInfoWithoutSubtitleLanguage) {
return false return false
} }
} }