refactor: simplify codebase (-209 lines)

This commit is contained in:
Mathis Maquenne
2026-03-01 21:55:42 +01:00
parent cd45c3f40a
commit 08b608ec80
31 changed files with 389 additions and 598 deletions
+7 -9
View File
@@ -40,26 +40,24 @@ type Song struct {
}
func (s *Song) GetTitle() string {
songTitle := s.Title
if s.Version != "" {
songTitle = fmt.Sprintf("%s %s", s.Title, s.Version)
return s.Title + " " + s.Version
}
return songTitle
return s.Title
}
func (s *Song) GetFileName(resourceType, mediaFormat string, song *Song) string {
func (s *Song) GetFileName(resourceType, mediaFormat string) string {
ext := "mp3"
if mediaFormat == "FLAC" {
ext = "flac"
}
trackNumber := ""
prefix := ""
if resourceType == "album" {
trackNumber = song.TrackNumber + ". "
prefix = s.TrackNumber + ". "
}
fileName := fmt.Sprintf("%s%s - %s.%s", trackNumber, s.Artist, s.GetTitle(), ext)
fileName := fmt.Sprintf("%s%s - %s.%s", prefix, s.Artist, s.GetTitle(), ext)
fileName, _ = filenamify.Filenamify(fileName, filenamify.Options{MaxLength: 255})
return fileName
}