fix: naming suggestion

This commit is contained in:
Simon Ding
2024-08-09 20:40:38 +08:00
parent 66ab418054
commit 829043bf28

View File

@@ -79,7 +79,7 @@ func (s *Server) SuggestedSeriesFolderName(c *gin.Context) (interface{}, error)
//remove extra characters
re := regexp.MustCompile(`[^\p{L}\w\s]`)
name = re.ReplaceAllString(strings.ToLower(name), " ")
name = strings.Join(strings.Fields(name), " ")
year := strings.Split(d.FirstAirDate, "-")[0]
if year != "" {
name = fmt.Sprintf("%s (%s)", name, year)
@@ -112,7 +112,7 @@ func (s *Server) SuggestedMovieFolderName(c *gin.Context) (interface{}, error) {
//remove extra characters
re := regexp.MustCompile(`[^\p{L}\w\s]`)
name = re.ReplaceAllString(strings.ToLower(name), " ")
name = strings.Join(strings.Fields(name), " ")
year := strings.Split(d1.ReleaseDate, "-")[0]
if year != "" {
name = fmt.Sprintf("%s (%s)", name, year)