Renaming to make the difference more obvious during refactoring

This commit is contained in:
Rob Emery 2025-04-19 11:11:32 +01:00
parent 713895696f
commit b535847ba9
2 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -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