@@ -19,18 +19,42 @@ func TitleStripSubtitle(title string) string {
1919 return title
2020}
2121
22+ type titleCleanOptions struct {
23+ removeDots bool
24+ }
25+
26+ type TitleStripOptions interface {
27+ applyTitleStripOptions (* titleCleanOptions )
28+ }
29+
30+ type optRemoveDots struct {}
31+
32+ func (o optRemoveDots ) applyTitleStripOptions (opts * titleCleanOptions ) {
33+ opts .removeDots = true
34+ }
35+
36+ func RemoveDots () TitleStripOptions {
37+ return optRemoveDots {}
38+ }
39+
2240// TitleStrip cleans title from sub-titles, tags and season / episode information.
2341// Example: [Source] Show: another story - S03E02 [1080p].mkv -> Show.
24- func TitleStrip (title string , cleanSubtitle bool ) string {
42+ func TitleStrip (title string , opts ... TitleStripOptions ) string {
43+ options := titleCleanOptions {}
44+ for _ , opt := range opts {
45+ opt .applyTitleStripOptions (& options )
46+ }
47+
2548 if index := seasonIndexMatch (title ); index != - 1 {
2649 title = title [:index ]
2750 }
2851 if index := episodeIndexMatch (title ); index != - 1 {
2952 title = title [:index ]
3053 }
3154 title = regexp .MustCompile (`\s{2,}` ).ReplaceAllString (title , " " )
32- if cleanSubtitle {
33- title = TitleStripSubtitle (title )
55+ title = TitleStripSubtitle (title )
56+ if options .removeDots {
57+ title = strings .ReplaceAll (title , "." , " " )
3458 }
3559 title = strings .ReplaceAll (title , "\" " , "" )
3660 title = removeTags (title )
@@ -45,9 +69,9 @@ func removeTags(title string) string {
4569}
4670
4771// Parse will parse a title into a Metadata, extracting stripped title, tags, season and episode information.
48- func Parse (title string ) Metadata {
72+ func Parse (title string , opts ... TitleStripOptions ) Metadata {
4973 resp := Metadata {
50- Title : TitleStrip (title , false ),
74+ Title : TitleStrip (title , opts ... ),
5175 VerticalResolution : qualityMatch (title ),
5276 }
5377 if tags := tagsExpr .FindAllStringSubmatch (title , - 1 ); len (tags ) > 0 {
0 commit comments