Documentation
¶
Index ¶
- Constants
- Variables
- func FileServerURLSpec(id filesystem.ID) *adi_http.URLSpec
- type AddInfoKey
- type Cache
- type ContentDirectory
- type DirectoryHandler
- type FileServer
- type FilesystemContentDirectory
- type Object
- type ObjectHandler
- type ObjectHandlerFunc
- type ProcessingDirectory
- func (pl *ProcessingDirectory) AddProcessor(priority int, p Processor)
- func (d *ProcessingDirectory) Get(id filesystem.ID, ctx context.Context) (obj *Object, err error)
- func (d *ProcessingDirectory) GetChildren(id filesystem.ID, ctx context.Context) ([]*Object, error)
- func (pl ProcessingDirectory) Len() int
- func (pl ProcessingDirectory) Less(i, j int) bool
- func (pl ProcessingDirectory) Swap(i, j int)
- type Processor
- type ProtocolInfo
- type Resource
- type Service
- func (s *Service) Browse(q browseQuery, req *http.Request) (r browseReply, err error)
- func (s *Service) GetSearchCapabilities(q empty, _ *http.Request) (getSearchCapabilitiesResponse, error)
- func (s *Service) GetSortCapabilities(q empty, _ *http.Request) (getSortCapabilitiesResponse, error)
- func (s *Service) GetSystemUpdateID(q empty, _ *http.Request) (systemUpdateIDResponse, error)
Constants ¶
View Source
const ( FileServerRoute = "fileserver" RouteObjectIDParameter = "objectID" RouteObjectIDTemplate = "{objectID:/.*}" )
View Source
const ( NoSuchObjectErrorCode = 701 // Service identifier URN ServiceID = "urn:upnp-org:serviceId:ContentDirectory" // Service type URN ServiceType = "urn:schemas-upnp-org:service:ContentDirectory:1" )
View Source
const LoaderTimeout = 5 * time.Second
View Source
const RootID = filesystem.RootID
RootID is the identifier of the root of any ContentDirectory
Variables ¶
View Source
var FolderType = types.NewMIME("application/vnd.container")
Functions ¶
func FileServerURLSpec ¶
func FileServerURLSpec(id filesystem.ID) *adi_http.URLSpec
Types ¶
type AddInfoKey ¶
type Cache ¶
type Cache struct {
ContentDirectory
// contains filtered or unexported fields
}
func (*Cache) GetChildren ¶
type ContentDirectory ¶
type ContentDirectory interface {
Get(filesystem.ID, context.Context) (*Object, error)
GetChildren(filesystem.ID, context.Context) ([]*Object, error)
LastModTime() time.Time
}
ContentDirectory is the generic ContentDirectory interface (no s**t, sherlock !).
type DirectoryHandler ¶
type DirectoryHandler struct {
Directory ContentDirectory
Handler ObjectHandler
}
DirectoryHandler
func (*DirectoryHandler) ServeHTTP ¶
func (h *DirectoryHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP parses and resolves the object ID and passes the object to the
type FileServer ¶
type FileServer struct {
DirectoryHandler
}
func NewFileServer ¶
func NewFileServer(d ContentDirectory) *FileServer
func (*FileServer) ServeObject ¶
func (s *FileServer) ServeObject(w http.ResponseWriter, r *http.Request, obj *Object)
func (FileServer) String ¶
func (FileServer) String() string
type FilesystemContentDirectory ¶
type FilesystemContentDirectory struct {
FS *filesystem.Filesystem
}
FilesystemContentDirectory is a filesystem-based ContentDirectory with processors
func (*FilesystemContentDirectory) Get ¶
func (d *FilesystemContentDirectory) Get(id filesystem.ID, ctx context.Context) (obj *Object, err error)
func (*FilesystemContentDirectory) GetChildren ¶
func (d *FilesystemContentDirectory) GetChildren(id filesystem.ID, ctx context.Context) ([]*Object, error)
func (*FilesystemContentDirectory) LastModTime ¶
func (d *FilesystemContentDirectory) LastModTime() time.Time
type Object ¶
type Object struct {
filesystem.Object
Title string
Album string
AlbumArtURI *http.URLSpec
Artist string
Date time.Time
Genre string
Icon *http.URLSpec
Resources []Resource
MimeType types.MIME
}
func (*Object) AddResource ¶
func (*Object) IsContainer ¶
func (*Object) MarshalDIDLLite ¶
type ObjectHandler ¶
type ObjectHandler interface {
ServeObject(http.ResponseWriter, *http.Request, *Object)
}
ObjectHandler
type ObjectHandlerFunc ¶
type ObjectHandlerFunc func(http.ResponseWriter, *http.Request, *Object)
ObjectHandlerFunc
func (ObjectHandlerFunc) ServeObject ¶
func (f ObjectHandlerFunc) ServeObject(w http.ResponseWriter, r *http.Request, o *Object)
type ProcessingDirectory ¶
type ProcessingDirectory struct {
ContentDirectory
logging.Logger
// contains filtered or unexported fields
}
ProcessingDirectory uses processors to enrich the objects
func (*ProcessingDirectory) AddProcessor ¶
func (*ProcessingDirectory) Get ¶
func (d *ProcessingDirectory) Get(id filesystem.ID, ctx context.Context) (obj *Object, err error)
Get fetchs the Object from the underlying Directory and applies the processors to it
func (*ProcessingDirectory) GetChildren ¶
func (d *ProcessingDirectory) GetChildren(id filesystem.ID, ctx context.Context) ([]*Object, error)
Get fetchs the Object from the underlying Directory and applies the processors to it
type ProtocolInfo ¶
type ProtocolInfo struct {
MimeType types.MIME
AdditionalInfo map[AddInfoKey]string
}
func (ProtocolInfo) String ¶
func (p ProtocolInfo) String() string
type Resource ¶
type Resource struct {
URL *http.URLSpec
Size uint64
ProtocolInfo
Duration time.Duration
Bitrate uint32
SampleFrequency uint32
BitsPerSample uint8
NrAudioChannels uint8
Resolution didl_lite.Resolution
ColorDepth uint8
FilePath string
// contains filtered or unexported fields
}
func (*Resource) MarshalDIDLLite ¶
type Service ¶
type Service struct {
ContentDirectory
*upnp.Service
}
Service implements the Content Directory Service
func NewService ¶
func NewService(directory ContentDirectory) *Service
New initializes a content-directory service
func (*Service) GetSearchCapabilities ¶
func (*Service) GetSortCapabilities ¶
Click to show internal directories.
Click to hide internal directories.