From 21814baf318be26c33da8a8ccb5d48e2f722bcff Mon Sep 17 00:00:00 2001 From: Ben Adrian Sarmiento Date: Sat, 29 Jun 2024 02:19:01 +0200 Subject: [PATCH] Fix language filters --- internal/config/v1.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/internal/config/v1.go b/internal/config/v1.go index e2c4b57..8346154 100644 --- a/internal/config/v1.go +++ b/internal/config/v1.go @@ -396,7 +396,11 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren if stream.CodecType != "audio" { 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 } } @@ -409,7 +413,11 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren if stream.CodecType != "audio" { 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 } } @@ -422,7 +430,11 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren if stream.CodecType != "subtitle" { 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 } } @@ -435,7 +447,11 @@ func (z *ZurgConfigV1) matchFilter(torrentName string, torrentSize int64, torren if stream.CodecType != "subtitle" { 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 } }