diff --git a/internal/domain/indexer_test.go b/internal/domain/indexer_test.go index 4f3e47d..76c8e62 100644 --- a/internal/domain/indexer_test.go +++ b/internal/domain/indexer_test.go @@ -341,7 +341,7 @@ func TestIRCParserOrpheus_Parse(t *testing.T) { }, }, want: want{ - title: "Busta Rhymes - BEACH BALL (feat. BIA)", + title: "BEACH BALL", release: "Busta Rhymes - BEACH BALL (feat. BIA) [2023] (WEB FLAC 24BIT Lossless)", }, }, @@ -357,7 +357,7 @@ func TestIRCParserOrpheus_Parse(t *testing.T) { }, }, want: want{ - title: "Busta Rhymes - BEACH BALL (feat. BIA)", + title: "BEACH BALL", release: "Busta Rhymes - BEACH BALL (feat. BIA) [2023] (CD FLAC Lossless)", }, }, diff --git a/internal/domain/irc.go b/internal/domain/irc.go index 0497838..d14a6f1 100644 --- a/internal/domain/irc.go +++ b/internal/domain/irc.go @@ -218,17 +218,20 @@ func (p IRCParserOrpheus) Parse(rls *Release, vars map[string]string) error { rls.Bitrate = tags.AudioBitrate rls.AudioFormat = tags.AudioFormat - // set log score + // set log score even if it's not announced today rls.HasLog = tags.HasLog rls.LogScore = tags.LogScore 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. - //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.Title = title + + // use parsed values from raw rls.Release struct + raw := rls.Raw(torrentName) + rls.Artists = raw.Artist + rls.Title = raw.Title 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, " ")) 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 } diff --git a/internal/domain/release.go b/internal/domain/release.go index f9727fe..13e270b 100644 --- a/internal/domain/release.go +++ b/internal/domain/release.go @@ -105,6 +105,10 @@ type Release struct { ActionStatus []ReleaseActionStatus `json:"action_status"` } +func (r *Release) Raw(s string) rls.Release { + return rls.ParseString(s) +} + type ReleaseActionStatus struct { ID int64 `json:"id"` Status ReleasePushStatus `json:"status"` diff --git a/internal/indexer/indexer_test.go b/internal/indexer/indexer_test.go index a94540b..eac76fc 100644 --- a/internal/indexer/indexer_test.go +++ b/internal/indexer/indexer_test.go @@ -87,6 +87,8 @@ func TestIndexersParseAndFilter(t *testing.T) { Quality: []string{"Lossless"}, Sources: []string{"CD"}, Formats: []string{"FLAC"}, + Artists: "Dirty Dike", + Albums: "Bogies & Alcohol", }, match: true, }, @@ -98,9 +100,10 @@ func TestIndexersParseAndFilter(t *testing.T) { Quality: []string{"24bit Lossless"}, Sources: []string{"CD"}, Formats: []string{"FLAC"}, + Albums: "Best album", }, 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]"}, }, }, },