refactor: moved magic strings to consts

This commit is contained in:
Deluan
2020-03-22 21:38:59 -04:00
parent 5ef80d2490
commit b4c7cac964
5 changed files with 18 additions and 7 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ import (
. "github.com/Masterminds/squirrel"
"github.com/astaxie/beego/orm"
"github.com/deluan/navidrome/consts"
"github.com/deluan/navidrome/log"
"github.com/deluan/navidrome/model"
"github.com/deluan/rest"
@@ -108,7 +109,7 @@ func (r *albumRepository) Refresh(ids ...string) error {
al.CoverArtId = ""
}
if al.Compilation {
al.AlbumArtist = "Various Artists"
al.AlbumArtist = consts.VariousArtists
}
if al.AlbumArtist == "" {
al.AlbumArtist = al.Artist
+2 -1
View File
@@ -8,6 +8,7 @@ import (
. "github.com/Masterminds/squirrel"
"github.com/astaxie/beego/orm"
"github.com/deluan/navidrome/conf"
"github.com/deluan/navidrome/consts"
"github.com/deluan/navidrome/log"
"github.com/deluan/navidrome/model"
"github.com/deluan/navidrome/utils"
@@ -128,7 +129,7 @@ func (r *artistRepository) Refresh(ids ...string) error {
toUpdate := 0
for _, ar := range artists {
if ar.Compilation {
ar.AlbumArtist = "Various Artists"
ar.AlbumArtist = consts.VariousArtists
}
if ar.AlbumArtist != "" {
ar.Name = ar.AlbumArtist