fix(filters): OPS and RED split Artist and Album (#1398)

* fix(filters): OPS and RED parse and match Artist and Album

* fix(filters): rls raw
This commit is contained in:
ze0s 2024-02-12 14:16:16 +01:00 committed by GitHub
parent 1a23b69bcf
commit 51a7f71372
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 7 deletions

View file

@ -341,7 +341,7 @@ func TestIRCParserOrpheus_Parse(t *testing.T) {
}, },
}, },
want: want{ want: want{
title: "Busta Rhymes - BEACH BALL (feat. BIA)", title: "BEACH BALL",
release: "Busta Rhymes - BEACH BALL (feat. BIA) [2023] (WEB FLAC 24BIT Lossless)", release: "Busta Rhymes - BEACH BALL (feat. BIA) [2023] (WEB FLAC 24BIT Lossless)",
}, },
}, },
@ -357,7 +357,7 @@ func TestIRCParserOrpheus_Parse(t *testing.T) {
}, },
}, },
want: want{ want: want{
title: "Busta Rhymes - BEACH BALL (feat. BIA)", title: "BEACH BALL",
release: "Busta Rhymes - BEACH BALL (feat. BIA) [2023] (CD FLAC Lossless)", release: "Busta Rhymes - BEACH BALL (feat. BIA) [2023] (CD FLAC Lossless)",
}, },
}, },

View file

@ -218,17 +218,20 @@ func (p IRCParserOrpheus) Parse(rls *Release, vars map[string]string) error {
rls.Bitrate = tags.AudioBitrate rls.Bitrate = tags.AudioBitrate
rls.AudioFormat = tags.AudioFormat rls.AudioFormat = tags.AudioFormat
// set log score // set log score even if it's not announced today
rls.HasLog = tags.HasLog rls.HasLog = tags.HasLog
rls.LogScore = tags.LogScore rls.LogScore = tags.LogScore
rls.HasCue = tags.HasCue rls.HasCue = tags.HasCue
// Construct new release name so we have full control. We remove category such as EP/Single/Album because EP is being mis-parsed. // Construct new release name so we have full control. We remove category such as EP/Single/Album because EP is being mis-parsed.
//torrentName = fmt.Sprintf("%s [%s] (%s)", title, year, strings.Join(audio, " "))
torrentName = fmt.Sprintf("%s [%s] (%s)", title, year, strings.Join(audio, " ")) torrentName = fmt.Sprintf("%s [%s] (%s)", title, year, strings.Join(audio, " "))
rls.ParseString(torrentName) rls.ParseString(torrentName)
rls.Title = title
// use parsed values from raw rls.Release struct
raw := rls.Raw(torrentName)
rls.Artists = raw.Artist
rls.Title = raw.Title
return nil return nil
} }
@ -267,7 +270,11 @@ func (p IRCParserRedacted) Parse(rls *Release, vars map[string]string) error {
name := fmt.Sprintf("%s [%s] (%s)", title, year, strings.Join(audio, " ")) name := fmt.Sprintf("%s [%s] (%s)", title, year, strings.Join(audio, " "))
rls.ParseString(name) rls.ParseString(name)
rls.Title = title
// use parsed values from raw rls.Release struct
raw := rls.Raw(name)
rls.Artists = raw.Artist
rls.Title = raw.Title
return nil return nil
} }

View file

@ -105,6 +105,10 @@ type Release struct {
ActionStatus []ReleaseActionStatus `json:"action_status"` ActionStatus []ReleaseActionStatus `json:"action_status"`
} }
func (r *Release) Raw(s string) rls.Release {
return rls.ParseString(s)
}
type ReleaseActionStatus struct { type ReleaseActionStatus struct {
ID int64 `json:"id"` ID int64 `json:"id"`
Status ReleasePushStatus `json:"status"` Status ReleasePushStatus `json:"status"`

View file

@ -87,6 +87,8 @@ func TestIndexersParseAndFilter(t *testing.T) {
Quality: []string{"Lossless"}, Quality: []string{"Lossless"},
Sources: []string{"CD"}, Sources: []string{"CD"},
Formats: []string{"FLAC"}, Formats: []string{"FLAC"},
Artists: "Dirty Dike",
Albums: "Bogies & Alcohol",
}, },
match: true, match: true,
}, },
@ -98,9 +100,10 @@ func TestIndexersParseAndFilter(t *testing.T) {
Quality: []string{"24bit Lossless"}, Quality: []string{"24bit Lossless"},
Sources: []string{"CD"}, Sources: []string{"CD"},
Formats: []string{"FLAC"}, Formats: []string{"FLAC"},
Albums: "Best album",
}, },
match: false, match: false,
rejections: []string{"quality not matching. got: [FLAC Lossless] want: [24bit Lossless]"}, rejections: []string{"albums not matching. got: Bogies & Alcohol want: Best album", "quality not matching. got: [FLAC Lossless] want: [24bit Lossless]"},
}, },
}, },
}, },