Skip to content
This repository was archived by the owner on Dec 26, 2024. It is now read-only.

Commit 7807fb2

Browse files
authored
fix: handle parenthesized year (#58)
1 parent 0c85bc7 commit 7807fb2

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

internal/processor/title.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ func processTitle(title string, matchRelease bool) []string {
1313
}
1414

1515
// cleans year like (2020) from arr title
16-
var re = regexp.MustCompile(`(?m)\s(\(\d+\))`)
17-
title = re.ReplaceAllString(title, "")
16+
//var re = regexp.MustCompile(`(?m)\s(\(\d+\))`)
17+
//title = re.ReplaceAllString(title, "")
1818

1919
t := NewTitleSlice()
2020

internal/processor/title_test.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ func Test_processTitle(t *testing.T) {
2222
title: "The Quick Brown Fox (2022)",
2323
matchRelease: false,
2424
},
25-
want: []string{"The?Quick?Brown?Fox"},
25+
want: []string{"The?Quick?Brown?Fox", "The?Quick?Brown?Fox*2022", "The?Quick?Brown?Fox*2022?"},
2626
},
2727
{
2828
name: "test_02",
2929
args: args{
3030
title: "The Matrix - Reloaded (2929)",
3131
matchRelease: false,
3232
},
33-
want: []string{"The?Matrix*Reloaded"},
33+
want: []string{"The?Matrix*Reloaded", "The?Matrix*Reloaded*2929", "The?Matrix*Reloaded*2929?"},
3434
},
3535
{
3636
name: "test_03",
3737
args: args{
3838
title: "The Matrix -(Test)- Reloaded (2929)",
3939
matchRelease: false,
4040
},
41-
want: []string{"The?Matrix*Test*Reloaded"},
41+
want: []string{"The?Matrix*", "The?Matrix", "The?Matrix*Test*Reloaded*2929?", "The?Matrix*Test*Reloaded*2929"},
4242
},
4343
{
4444
name: "test_04",
@@ -54,7 +54,7 @@ func Test_processTitle(t *testing.T) {
5454
title: "Arrr!! The Title (2020)",
5555
matchRelease: false,
5656
},
57-
want: []string{"Arrr*The?Title"},
57+
want: []string{"Arrr*The?Title", "Arrr*The?Title*2020", "Arrr*The?Title*2020?"},
5858
},
5959
{
6060
name: "test_06",
@@ -192,6 +192,14 @@ func Test_processTitle(t *testing.T) {
192192
},
193193
want: []string{"A?Quiet?Place*Day?One"},
194194
},
195+
{
196+
name: "test_23",
197+
args: args{
198+
title: "Whose Line Is It Anyway? (US) (1932)",
199+
matchRelease: false,
200+
},
201+
want: []string{"Whose?Line?Is?It?Anyway", "Whose?Line?Is?It?Anyway?", "Whose?Line?Is?It?Anyway*US*1932", "Whose?Line?Is?It?Anyway*US*1932?"},
202+
},
195203
}
196204
for _, tt := range tests {
197205
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)