mirror of
https://github.com/navidrome/navidrome.git
synced 2025-05-07 13:51:10 +03:00
Track numbers populated correctly
This commit is contained in:
parent
537f4a1490
commit
19bd6aefa2
@ -11,6 +11,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -256,10 +257,10 @@ func (cds *contentDirectoryService) doMediaFiles(tracks model.MediaFiles, basePa
|
|||||||
}
|
}
|
||||||
title := track.Title
|
title := track.Title
|
||||||
artist := track.Artist
|
artist := track.Artist
|
||||||
//date := track.Date //TODO
|
|
||||||
album := track.Album
|
album := track.Album
|
||||||
genre := track.Genre
|
genre := track.Genre
|
||||||
trackNo := track.TrackNumber
|
trackNo := track.TrackNumber
|
||||||
|
trackDuration := strconv.FormatFloat(float64(track.Duration), 'f', -1, 64)
|
||||||
|
|
||||||
obj := upnpav.Object{
|
obj := upnpav.Object{
|
||||||
ID: child.Id,
|
ID: child.Id,
|
||||||
@ -271,7 +272,7 @@ func (cds *contentDirectoryService) doMediaFiles(tracks model.MediaFiles, basePa
|
|||||||
var mimeType = "audio/mp3" //TODO
|
var mimeType = "audio/mp3" //TODO
|
||||||
|
|
||||||
obj.Class = "object.item.audioItem.musicTrack"
|
obj.Class = "object.item.audioItem.musicTrack"
|
||||||
obj.Date = upnpav.Timestamp{Time: time.Now()}
|
obj.Date = upnpav.Timestamp{Time:time.Now()} //TODO
|
||||||
obj.Artist = artist
|
obj.Artist = artist
|
||||||
obj.Album = album
|
obj.Album = album
|
||||||
obj.Genre = genre
|
obj.Genre = genre
|
||||||
@ -291,7 +292,8 @@ func (cds *contentDirectoryService) doMediaFiles(tracks model.MediaFiles, basePa
|
|||||||
ProtocolInfo: fmt.Sprintf("http-get:*:%s:%s", mimeType, dlna.ContentFeatures{
|
ProtocolInfo: fmt.Sprintf("http-get:*:%s:%s", mimeType, dlna.ContentFeatures{
|
||||||
SupportRange: false,
|
SupportRange: false,
|
||||||
}.String()),
|
}.String()),
|
||||||
Size: uint64(1048576), //TODO TRACKSIZE
|
Size: uint64(track.Size),
|
||||||
|
Duration: trackDuration,
|
||||||
})
|
})
|
||||||
ret = append(ret, item)
|
ret = append(ret, item)
|
||||||
}
|
}
|
||||||
@ -403,6 +405,7 @@ func (cds *contentDirectoryService) Handle(action string, argsXML []byte, r *htt
|
|||||||
objs = objs[:browse.RequestedCount]
|
objs = objs[:browse.RequestedCount]
|
||||||
}
|
}
|
||||||
result, err := xml.Marshal(objs)
|
result, err := xml.Marshal(objs)
|
||||||
|
log.Debug(fmt.Sprintf("XMLResponse: '%s'", result))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -50,8 +50,8 @@ type Object struct {
|
|||||||
Album string `xml:"upnp:album,omitempty"`
|
Album string `xml:"upnp:album,omitempty"`
|
||||||
Genre string `xml:"upnp:genre,omitempty"`
|
Genre string `xml:"upnp:genre,omitempty"`
|
||||||
AlbumArtURI string `xml:"upnp:albumArtURI,omitempty"`
|
AlbumArtURI string `xml:"upnp:albumArtURI,omitempty"`
|
||||||
Searchable int `xml:"searchable,attr"` //
|
OriginalTrackNumber int `xml:"upnp:originalTrackNumber,omitempty"`
|
||||||
OriginalTrackNumber int `xml:"originalTrackNumber,omitempty"`
|
Searchable int `xml:"searchable,attr"`
|
||||||
}
|
}
|
||||||
// Timestamp wraps time.Time for formatting purposes
|
// Timestamp wraps time.Time for formatting purposes
|
||||||
type Timestamp struct {
|
type Timestamp struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user