Skip to content

Commit

Permalink
Dynamic audio streams (#137)
Browse files Browse the repository at this point in the history
* Supports video and audio formats for dynamic content

* Added note to documentation about dynamic audio streams
  • Loading branch information
groupmsl committed Dec 23, 2023
1 parent f4b323a commit 13a972b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@ An example::
}
]
}

By default, dynamic content is treated as video. It is possible to specify a "Type" parameter with value "audio" or "video" to explicitly set this.
12 changes: 11 additions & 1 deletion dlna/dms/cds.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type dmsDynamicStreamResource struct {
type dmsDynamicMediaItem struct {
// (optional) Title of this media item. Defaults to the filename, if omitted
Title string
// (optional) Type of media. Allowed values: "audio", "video". Defaults to video if omitted
Type string
// (optional) duration, e.g. 0:21:37.922
Duration string
// required: an array of available versions
Expand Down Expand Up @@ -96,7 +98,15 @@ func (me *contentDirectoryService) cdsObjectDynamicStreamToUpnpavObject(cdsObjec
// TODO(anacrolix): This might not be necessary due to item res image
// element.
obj.AlbumArtURI = iconURI
obj.Class = "object.item.videoItem"

switch dmsMediaItem.Type {
case "video":
obj.Class = "object.item.videoItem"
case "audio":
obj.Class = "object.item.audioItem"
default:
obj.Class = "object.item.videoItem"
}

obj.Title = dmsMediaItem.Title
if obj.Title == "" {
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ func mainErr() error {

logger.Printf("allowed ip nets are %q", config.AllowedIpNets)
logger.Printf("serving folder %q", config.Path)
if(config.AllowDynamicStreams) {
logger.Printf("Dynamic streams ARE allowed")
}

if len(*configFilePath) > 0 {
config.load(*configFilePath)
Expand Down

0 comments on commit 13a972b

Please sign in to comment.