@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/navidrome/navidrome/consts"
|
"github.com/navidrome/navidrome/consts"
|
||||||
"github.com/navidrome/navidrome/model"
|
"github.com/navidrome/navidrome/model"
|
||||||
@@ -151,7 +152,7 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child
|
|||||||
if ok && player.ReportRealPath {
|
if ok && player.ReportRealPath {
|
||||||
child.Path = mf.Path
|
child.Path = mf.Path
|
||||||
} else {
|
} else {
|
||||||
child.Path = fmt.Sprintf("%s/%s/%s.%s", realArtistName(mf), mf.Album, mf.Title, mf.Suffix)
|
child.Path = fmt.Sprintf("%s/%s/%s.%s", mapSlashToDash(realArtistName(mf)), mapSlashToDash(mf.Album), mapSlashToDash(mf.Title), mf.Suffix)
|
||||||
}
|
}
|
||||||
child.DiscNumber = mf.DiscNumber
|
child.DiscNumber = mf.DiscNumber
|
||||||
child.Created = &mf.CreatedAt
|
child.Created = &mf.CreatedAt
|
||||||
@@ -184,6 +185,10 @@ func realArtistName(mf model.MediaFile) string {
|
|||||||
return mf.Artist
|
return mf.Artist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mapSlashToDash(target string) string {
|
||||||
|
return strings.ReplaceAll(target, "/", "_")
|
||||||
|
}
|
||||||
|
|
||||||
func childrenFromMediaFiles(ctx context.Context, mfs model.MediaFiles) []responses.Child {
|
func childrenFromMediaFiles(ctx context.Context, mfs model.MediaFiles) []responses.Child {
|
||||||
children := make([]responses.Child, len(mfs))
|
children := make([]responses.Child, len(mfs))
|
||||||
for i, mf := range mfs {
|
for i, mf := range mfs {
|
||||||
|
|||||||
Reference in New Issue
Block a user