mirror of
https://github.com/thebaer/cdr.git
synced 2024-11-15 01:31:01 +00:00
Remove more characters from names
This commit is contained in:
parent
b7e276966b
commit
d3782204fe
@ -55,8 +55,9 @@ func RenameTrack(file string) string {
|
|||||||
|
|
||||||
// Sanitize takes a string and removes problematic characters from it.
|
// Sanitize takes a string and removes problematic characters from it.
|
||||||
func Sanitize(s string) string {
|
func Sanitize(s string) string {
|
||||||
|
s = unidecode.Unidecode(s)
|
||||||
s = strings.Map(func(r rune) rune {
|
s = strings.Map(func(r rune) rune {
|
||||||
if r == '(' || r == ')' || r == '[' || r == ']' || r == '.' {
|
if r == '(' || r == ')' || r == '[' || r == ']' || r == '.' || r == ',' || r == '\'' || r == '"' || r == ';' {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
if unicode.IsSpace(r) {
|
if unicode.IsSpace(r) {
|
||||||
@ -64,6 +65,5 @@ func Sanitize(s string) string {
|
|||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}, s)
|
}, s)
|
||||||
s = unidecode.Unidecode(s)
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user