File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -101,14 +101,30 @@ func (t Metadata) TagBuildSeasonEpisode() string {
101101 return resp
102102}
103103
104+ func filterAlphanumeric (s string ) string {
105+ var result strings.Builder
106+ result .Grow (len (s ))
107+ for i := 0 ; i < len (s ); i ++ {
108+ b := s [i ]
109+ if ('a' <= b && b <= 'z' ) || ('A' <= b && b <= 'Z' ) || ('0' <= b && b <= '9' ) || b == ' ' {
110+ result .WriteByte (b )
111+ }
112+ }
113+ return result .String ()
114+ }
115+
116+ func (t Metadata ) buildTitle () string {
117+ return strings .ToLower (filterAlphanumeric (t .Title ))
118+ }
119+
104120// TagBuildBatch is used for when you download a torrent with multiple episodes.
105121func (t Metadata ) TagBuildBatch () string {
106- return fmt .Sprintf ("%s S%s batch" , strings . ToLower ( t . Title ), t .Season )
122+ return fmt .Sprintf ("%s S%s batch" , t . buildTitle ( ), t .Season )
107123}
108124
109125// TagBuildSeries builds a !Serie Name tag for you to be able to search all it's episodes with a tag.
110126func (t Metadata ) TagBuildSeries () string {
111- return "!" + strings . ToLower ( t . Title )
127+ return "!" + t . buildTitle ( )
112128}
113129
114130// TagsBuildTorrent builds all tags Animeman needs from your torrent client.
You can’t perform that action at this time.
0 commit comments