hdhr

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UPnPDescriptionPath is the primary device XML location advertised in SSDP LOCATION.
	UPnPDescriptionPath = "/upnp/device.xml"
	// UPnPDescriptionAliasPath is a compatibility alias used by some controllers.
	UPnPDescriptionAliasPath = "/device.xml"

	// SSDP/UPnP search targets supported by the compatibility profile.
	UPnPSearchTargetRootDevice = "upnp:rootdevice"
	UPnPDeviceTypeMediaServer  = "urn:schemas-upnp-org:device:MediaServer:1"
	UPnPDeviceTypeBasic        = "urn:schemas-upnp-org:device:Basic:1"
	// UPnPDeviceTypeATSCPrimary is an HDHomeRun-oriented compatibility target used by some control points.
	UPnPDeviceTypeATSCPrimary = "urn:schemas-atsc.org:device:primaryDevice:1.0"
	UPnPServiceTypeConnection = "urn:schemas-upnp-org:service:ConnectionManager:1"
	UPnPServiceTypeContentDir = "urn:schemas-upnp-org:service:ContentDirectory:1"

	UPnPConnectionSCPDPath          = "/upnp/scpd/connection-manager.xml"
	UPnPContentDirectorySCPDPath    = "/upnp/scpd/content-directory.xml"
	UPnPConnectionControlPath       = "/upnp/control/connection-manager"
	UPnPContentDirectoryControlPath = "/upnp/control/content-directory"
	UPnPConnectionEventPath         = "/upnp/event/connection-manager"
	UPnPContentDirectoryEventPath   = "/upnp/event/content-directory"
)

Variables

This section is empty.

Functions

func BaseURL

func BaseURL(r *http.Request) string

func DeviceUDN

func DeviceUDN(deviceID string) string

DeviceUDN derives a deterministic UPnP uuid:... identifier from DeviceID.

Types

type ChannelsProvider

type ChannelsProvider interface {
	ListEnabled(ctx context.Context) ([]channels.Channel, error)
}

ChannelsProvider provides enabled published channels for lineup responses.

type Config

type Config struct {
	FriendlyName string
	DeviceID     string
	DeviceAuth   string
	TunerCount   int
	// ContentDirectoryUpdateIDCacheTTL controls how long GetSystemUpdateID values are cached.
	ContentDirectoryUpdateIDCacheTTL time.Duration
}

Config carries static values used by HDHomeRun emulation handlers.

type DiscoverResponse

type DiscoverResponse struct {
	FriendlyName    string `json:"FriendlyName"`
	DeviceID        string `json:"DeviceID"`
	DeviceAuth      string `json:"DeviceAuth"`
	BaseURL         string `json:"BaseURL"`
	LineupURL       string `json:"LineupURL"`
	ModelNumber     string `json:"ModelNumber"`
	FirmwareName    string `json:"FirmwareName"`
	FirmwareVersion string `json:"FirmwareVersion"`
	TunerCount      int    `json:"TunerCount"`
}

DiscoverResponse describes emulator metadata exposed at /discover.json.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves HDHomeRun-compatible HTTP endpoints.

func NewHandler

func NewHandler(cfg Config, channelsProvider ChannelsProvider) *Handler

func (*Handler) ConnectionManagerControl

func (h *Handler) ConnectionManagerControl(w http.ResponseWriter, r *http.Request)

func (*Handler) ConnectionManagerSCPDXML

func (h *Handler) ConnectionManagerSCPDXML(w http.ResponseWriter, _ *http.Request)

func (*Handler) ContentDirectoryControl

func (h *Handler) ContentDirectoryControl(w http.ResponseWriter, r *http.Request)

func (*Handler) ContentDirectorySCPDXML

func (h *Handler) ContentDirectorySCPDXML(w http.ResponseWriter, _ *http.Request)

func (*Handler) DeviceDescriptionXML

func (h *Handler) DeviceDescriptionXML(w http.ResponseWriter, r *http.Request)

func (*Handler) DiscoverJSON

func (h *Handler) DiscoverJSON(w http.ResponseWriter, r *http.Request)

func (*Handler) LineupHTML

func (h *Handler) LineupHTML(w http.ResponseWriter, r *http.Request)

func (*Handler) LineupJSON

func (h *Handler) LineupJSON(w http.ResponseWriter, r *http.Request)

func (*Handler) LineupM3U

func (h *Handler) LineupM3U(w http.ResponseWriter, r *http.Request)

func (*Handler) LineupStatusJSON

func (h *Handler) LineupStatusJSON(w http.ResponseWriter, _ *http.Request)

func (*Handler) LineupXML

func (h *Handler) LineupXML(w http.ResponseWriter, r *http.Request)

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(mux *http.ServeMux)

type LineupEntry

type LineupEntry struct {
	GuideNumber string `json:"GuideNumber" xml:"GuideNumber"`
	GuideName   string `json:"GuideName" xml:"GuideName"`
	URL         string `json:"URL" xml:"URL"`
	Favorite    int    `json:"Favorite,omitempty" xml:"Favorite,omitempty"`
	Subscribed  int    `json:"Subscribed,omitempty" xml:"Subscribed,omitempty"`
	VideoCodec  string `json:"VideoCodec,omitempty" xml:"VideoCodec,omitempty"`
	AudioCodec  string `json:"AudioCodec,omitempty" xml:"AudioCodec,omitempty"`
	HD          int    `json:"HD" xml:"HD"`
	DRM         int    `json:"DRM" xml:"DRM"`
}

LineupEntry is a channel record in lineup responses.

type LineupStatusResponse

type LineupStatusResponse struct {
	ScanInProgress int      `json:"ScanInProgress"`
	ScanPossible   int      `json:"ScanPossible"`
	Source         string   `json:"Source"`
	SourceList     []string `json:"SourceList"`
}

LineupStatusResponse is a compatibility stub for scan status polling.

type LineupXMLResponse

type LineupXMLResponse struct {
	XMLName xml.Name      `xml:"Lineup"`
	Items   []LineupEntry `xml:"Program"`
}

LineupXMLResponse is the /lineup.xml payload.

type UPnPDeviceDescription

type UPnPDeviceDescription struct {
	DeviceType      string                   `xml:"deviceType"`
	FriendlyName    string                   `xml:"friendlyName"`
	Manufacturer    string                   `xml:"manufacturer"`
	ModelName       string                   `xml:"modelName"`
	ModelNumber     string                   `xml:"modelNumber"`
	SerialNumber    string                   `xml:"serialNumber,omitempty"`
	UDN             string                   `xml:"UDN"`
	PresentationURL string                   `xml:"presentationURL,omitempty"`
	ServiceList     []UPnPServiceDescription `xml:"serviceList>service,omitempty"`
}

type UPnPRootDescription

type UPnPRootDescription struct {
	XMLName xml.Name              `xml:"root"`
	XMLNS   string                `xml:"xmlns,attr"`
	Spec    UPnPSpecVersion       `xml:"specVersion"`
	URLBase string                `xml:"URLBase,omitempty"`
	Device  UPnPDeviceDescription `xml:"device"`
}

type UPnPServiceDescription

type UPnPServiceDescription struct {
	ServiceType string `xml:"serviceType"`
	ServiceID   string `xml:"serviceId"`
	SCPDURL     string `xml:"SCPDURL"`
	ControlURL  string `xml:"controlURL"`
	EventSubURL string `xml:"eventSubURL"`
}

type UPnPSpecVersion

type UPnPSpecVersion struct {
	Major int `xml:"major"`
	Minor int `xml:"minor"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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