From b535847ba9360b3ccb99408097ba092f597635a1 Mon Sep 17 00:00:00 2001 From: Rob Emery Date: Sat, 19 Apr 2025 11:11:32 +0100 Subject: [PATCH] Renaming to make the difference more obvious during refactoring --- dlna/contenddirectoryservice.go | 16 ++++++++-------- dlna/upnpav/upnpav.go | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dlna/contenddirectoryservice.go b/dlna/contenddirectoryservice.go index 14476b7fd..a62c8ec5f 100644 --- a/dlna/contenddirectoryservice.go +++ b/dlna/contenddirectoryservice.go @@ -53,7 +53,7 @@ func (cds *contentDirectoryService) updateIDString() string { // Turns the given entry and DMS host into a UPnP object. A nil object is // returned if the entry is not of interest. func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject contentDirectoryObject, isContainer bool, host string, filesize int64) (ret interface{}) { - obj := upnpav.Object{ + obj := upnpav.UpnpObject{ ID: cdsObject.ID(), Restricted: 1, ParentID: cdsObject.ParentID(), @@ -64,7 +64,7 @@ func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject contentDir defaultChildCount := 1 obj.Class = "object.container.storageFolder" return upnpav.Container{ - Object: obj, + UpnpObject: obj, ChildCount: &defaultChildCount, } } @@ -75,8 +75,8 @@ func (cds *contentDirectoryService) cdsObjectToUpnpavObject(cdsObject contentDir obj.Date = upnpav.Timestamp{Time: time.Now()} item := upnpav.Item{ - Object: obj, - Res: make([]upnpav.Resource, 0, 1), + UpnpObject: obj, + Res: make([]upnpav.Resource, 0, 1), } item.Res = append(item.Res, upnpav.Resource{ @@ -271,7 +271,7 @@ func (cds *contentDirectoryService) doMediaFiles(tracks model.MediaFiles, basePa for _, track := range tracks { trackDateAsTimeObject, _ := time.Parse(time.DateOnly, track.Date) - obj := upnpav.Object{ + obj := upnpav.UpnpObject{ ID: path.Join(basePath, track.ID), Restricted: 1, ParentID: basePath, @@ -296,8 +296,8 @@ func (cds *contentDirectoryService) doMediaFiles(tracks model.MediaFiles, basePa var mimeType = "audio/mp3" item := upnpav.Item{ - Object: obj, - Res: make([]upnpav.Resource, 0, 1), + UpnpObject: obj, + Res: make([]upnpav.Resource, 0, 1), } 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 { Path string // The cleaned, absolute path for the object relative to the server. Id string diff --git a/dlna/upnpav/upnpav.go b/dlna/upnpav/upnpav.go index 3a9616fad..3a23c3ce5 100644 --- a/dlna/upnpav/upnpav.go +++ b/dlna/upnpav/upnpav.go @@ -24,21 +24,21 @@ type Resource struct { // Container description type Container struct { - Object + UpnpObject XMLName xml.Name `xml:"container"` ChildCount *int `xml:"childCount,attr"` } // Item description type Item struct { - Object + UpnpObject XMLName xml.Name `xml:"item"` Res []Resource InnerXML string `xml:",innerxml"` } -// Object description -type Object struct { +// UpnpObject description +type UpnpObject struct { ID string `xml:"id,attr"` ParentID string `xml:"parentID,attr"` Restricted int `xml:"restricted,attr"` // indicates whether the object is modifiable