Add option for player to report real paths in Subsonic API. Closes #625

This commit is contained in:
Deluan
2020-11-28 10:24:55 -05:00
parent 7becc18da9
commit 975579ab26
6 changed files with 46 additions and 13 deletions
+6 -1
View File
@@ -147,7 +147,12 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child
child.CoverArt = "al-" + mf.AlbumID
}
child.ContentType = mf.ContentType()
child.Path = fmt.Sprintf("%s/%s/%s.%s", realArtistName(mf), mf.Album, mf.Title, mf.Suffix)
player, ok := request.PlayerFrom(ctx)
if ok && player.ReportRealPath {
child.Path = mf.Path
} else {
child.Path = fmt.Sprintf("%s/%s/%s.%s", realArtistName(mf), mf.Album, mf.Title, mf.Suffix)
}
child.DiscNumber = mf.DiscNumber
child.Created = &mf.CreatedAt
child.AlbumId = mf.AlbumID