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