Skip to content

Commit

Permalink
chore: more uncensored prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxsen committed Jul 6, 2024
1 parent 4f9458a commit 3be1ed4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 11 additions & 1 deletion number/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,27 @@ var defaultUncensorPrefix = []string{
"MKBD",
"H4610",
"H0930",
"MD",
"MD-",
"SMD-",
"SSDV-",
"CCDV-",
"LLDV-",
"DRC-",
"MXX-",
"DSAM-",
}

var defaultUncensorRegexp = []*regexp.Regexp{
regexp.MustCompile(`^\d+[-|_]\d+$`),
regexp.MustCompile(`^N\d+$`),
regexp.MustCompile(`^K\d+$`),
regexp.MustCompile(`^KB\d+$`),
regexp.MustCompile(`^C\d+-KI\d+$`),
}

func IsUncensorMovie(str string) bool {
str = strings.ToUpper(str)
str = strings.ReplaceAll(str, "_", "-")
for _, prefix := range defaultUncensorPrefix {
if strings.HasPrefix(str, prefix) {
return true
Expand Down
6 changes: 6 additions & 0 deletions number/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ func TestCheck(t *testing.T) {
"010111-222",
"H4610-Ki1111",
"MKD-12345",
"fc2-ppv-12345",
"1pon-123",
"smd-1234",
"kb2134",
"c0930-ki240528",
}
falseList := []string{
"YMDS-164",
"MBRBI-002",
"LUKE-036",
"SMDY-123",
}
for _, item := range trueList {
assert.True(t, IsUncensorMovie(item))
Expand Down

0 comments on commit 3be1ed4

Please sign in to comment.