dlna

package
v0.123.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package dlna is a minimal DLNA / UPnP ContentDirectory browse client. It talks to a MediaServer's ContentDirectory:1 service via SOAP Browse actions, and parses the DIDL-Lite responses into structured Go types.

Device discovery lives in pkg/discovery; this package is only the browse half.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MimeFromProtocolInfo

func MimeFromProtocolInfo(pi string) string

MimeFromProtocolInfo extracts the MIME type from a DLNA protocolInfo string. Format is "protocol:network:contentType:additionalInfo", e.g. "http-get:*:audio/mpeg:*". Returns the third colon-separated field.

func ParseHMS

func ParseHMS(d string) int

ParseHMS converts a DIDL-Lite duration string in "H:MM:SS[.mmm]" format to a total number of seconds.

Types

type BrowseResult

type BrowseResult struct {
	Containers   []Container
	Items        []Item
	TotalMatches int
	Returned     int
}

BrowseResult holds one page of a ContentDirectory Browse response.

func Browse

func Browse(ctx context.Context, srv discovery.MediaServer, objectID string, start, count int) (BrowseResult, error)

Browse calls ContentDirectory:Browse on srv and returns one page of results. objectID "0" is the server root. start is the page offset, count the page size (0 defaults to 50 on the caller side so the request is always bounded).

type Container

type Container struct {
	ID         string
	ParentID   string
	Title      string
	ChildCount int
}

Container is a folder / album / playlist node in the DLNA content tree.

type Item

type Item struct {
	ID          string
	ParentID    string
	Title       string
	Artist      string
	Album       string
	Class       string
	MimeType    string
	StreamURL   string
	AlbumArtURL string
	DurationSec int
}

Item is a single playable object (track, photo, video). Use IsAudioItem to check whether a SoundTouch renderer can play it.

func (Item) IsAudioItem

func (it Item) IsAudioItem() bool

IsAudioItem reports whether the item is an audio track. Photos, videos, and unrecognised items return false.

Directories

Path Synopsis
Package dlnatest provides an in-process DLNA / UPnP MediaServer for use in unit tests (via httptest.Server) and as a real LAN-visible server.
Package dlnatest provides an in-process DLNA / UPnP MediaServer for use in unit tests (via httptest.Server) and as a real LAN-visible server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL