mirror of
https://github.com/navidrome/navidrome.git
synced 2025-05-07 22:01:08 +03:00
Renaming to make the difference more obvious during refactoring
This commit is contained in:
parent
713895696f
commit
b535847ba9
@ -53,7 +53,7 @@ func (cds *contentDirectoryService) updateIDString() string {
|
|||||||
// Turns the given entry and DMS host into a UPnP object. A nil object is
|
// Turns the given entry and DMS host into a UPnP object. A nil object is
|
||||||
// returned if the entry is not of interest.
|
// returned if the entry is not of interest.
|
||||||
func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject contentDirectoryObject, isContainer bool, host string, filesize int64) (ret interface{}) {
|
func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject contentDirectoryObject, isContainer bool, host string, filesize int64) (ret interface{}) {
|
||||||
obj := upnpav.Object{
|
obj := upnpav.UpnpObject{
|
||||||
ID: cdsObject.ID(),
|
ID: cdsObject.ID(),
|
||||||
Restricted: 1,
|
Restricted: 1,
|
||||||
ParentID: cdsObject.ParentID(),
|
ParentID: cdsObject.ParentID(),
|
||||||
@ -64,7 +64,7 @@ func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject contentDir
|
|||||||
defaultChildCount := 1
|
defaultChildCount := 1
|
||||||
obj.Class = "object.container.storageFolder"
|
obj.Class = "object.container.storageFolder"
|
||||||
return upnpav.Container{
|
return upnpav.Container{
|
||||||
Object: obj,
|
UpnpObject: obj,
|
||||||
ChildCount: &defaultChildCount,
|
ChildCount: &defaultChildCount,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,8 +75,8 @@ func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject contentDir
|
|||||||
obj.Date = upnpav.Timestamp{Time: time.Now()}
|
obj.Date = upnpav.Timestamp{Time: time.Now()}
|
||||||
|
|
||||||
item := upnpav.Item{
|
item := upnpav.Item{
|
||||||
Object: obj,
|
UpnpObject: obj,
|
||||||
Res: make([]upnpav.Resource, 0, 1),
|
Res: make([]upnpav.Resource, 0, 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
item.Res = append(item.Res, upnpav.Resource{
|
item.Res = append(item.Res, upnpav.Resource{
|
||||||
@ -271,7 +271,7 @@ func (cds *contentDirectoryService) doMediaFiles(tracks model.MediaFiles, basePa
|
|||||||
for _, track := range tracks {
|
for _, track := range tracks {
|
||||||
trackDateAsTimeObject, _ := time.Parse(time.DateOnly, track.Date)
|
trackDateAsTimeObject, _ := time.Parse(time.DateOnly, track.Date)
|
||||||
|
|
||||||
obj := upnpav.Object{
|
obj := upnpav.UpnpObject{
|
||||||
ID: path.Join(basePath, track.ID),
|
ID: path.Join(basePath, track.ID),
|
||||||
Restricted: 1,
|
Restricted: 1,
|
||||||
ParentID: basePath,
|
ParentID: basePath,
|
||||||
@ -296,8 +296,8 @@ func (cds *contentDirectoryService) doMediaFiles(tracks model.MediaFiles, basePa
|
|||||||
var mimeType = "audio/mp3"
|
var mimeType = "audio/mp3"
|
||||||
|
|
||||||
item := upnpav.Item{
|
item := upnpav.Item{
|
||||||
Object: obj,
|
UpnpObject: obj,
|
||||||
Res: make([]upnpav.Resource, 0, 1),
|
Res: make([]upnpav.Resource, 0, 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
streamAccessPath := path.Join(resourcePath, resourceStreamPath, track.ID)
|
streamAccessPath := path.Join(resourcePath, resourceStreamPath, track.ID)
|
||||||
@ -470,7 +470,7 @@ func (cds *contentDirectoryService) Handle(action string, argsXML []byte, r *htt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents a ContentDirectory contentDirectoryObject.
|
// Represents a contentDirectoryObject.
|
||||||
type contentDirectoryObject struct {
|
type contentDirectoryObject struct {
|
||||||
Path string // The cleaned, absolute path for the object relative to the server.
|
Path string // The cleaned, absolute path for the object relative to the server.
|
||||||
Id string
|
Id string
|
||||||
|
@ -24,21 +24,21 @@ type Resource struct {
|
|||||||
|
|
||||||
// Container description
|
// Container description
|
||||||
type Container struct {
|
type Container struct {
|
||||||
Object
|
UpnpObject
|
||||||
XMLName xml.Name `xml:"container"`
|
XMLName xml.Name `xml:"container"`
|
||||||
ChildCount *int `xml:"childCount,attr"`
|
ChildCount *int `xml:"childCount,attr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item description
|
// Item description
|
||||||
type Item struct {
|
type Item struct {
|
||||||
Object
|
UpnpObject
|
||||||
XMLName xml.Name `xml:"item"`
|
XMLName xml.Name `xml:"item"`
|
||||||
Res []Resource
|
Res []Resource
|
||||||
InnerXML string `xml:",innerxml"`
|
InnerXML string `xml:",innerxml"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Object description
|
// UpnpObject description
|
||||||
type Object struct {
|
type UpnpObject struct {
|
||||||
ID string `xml:"id,attr"`
|
ID string `xml:"id,attr"`
|
||||||
ParentID string `xml:"parentID,attr"`
|
ParentID string `xml:"parentID,attr"`
|
||||||
Restricted int `xml:"restricted,attr"` // indicates whether the object is modifiable
|
Restricted int `xml:"restricted,attr"` // indicates whether the object is modifiable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user