Documentation
¶
Overview ¶
Package dlna provides the DLNA functionality for the application. Much of this code is adapted from https://github.com/anacrolix/dms
Index ¶
- Constants
- type ActivityConfig
- type ActivityTracker
- type Cache
- type Config
- type Dlnaip
- type GroupFinder
- type Icon
- type PerformerFinder
- type Repository
- type SceneActivityWriter
- type SceneFinder
- type Server
- type Service
- func (s *Service) AddTempDLNAIP(pattern string, duration *time.Duration)
- func (s *Service) IsRunning() bool
- func (s *Service) RemoveTempDLNAIP(pattern string) bool
- func (s *Service) Start(duration *time.Duration) error
- func (s *Service) Status() *Status
- func (s *Service) Stop(duration *time.Duration)
- type Status
- type StudioFinder
- type TagFinder
- type UPnPService
Constants ¶
const ( // DefaultSessionTimeout is the time after which a session is considered complete // if no new requests are received. // This is set high (5 minutes) because DLNA clients buffer aggressively and may not // send any HTTP requests for extended periods while the user is still watching. DefaultSessionTimeout = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityConfig ¶ added in v0.31.0
type ActivityConfig interface {
// GetDLNAActivityTrackingEnabled returns true if activity tracking should be enabled.
// If not implemented, defaults to true.
GetDLNAActivityTrackingEnabled() bool
// GetMinimumPlayPercent returns the minimum percentage of a video that must be
// watched before incrementing the play count. Uses UI setting if available.
GetMinimumPlayPercent() int
}
ActivityConfig provides configuration options for DLNA activity tracking.
type ActivityTracker ¶ added in v0.31.0
type ActivityTracker struct {
// contains filtered or unexported fields
}
ActivityTracker tracks DLNA streaming activity and saves it to the database.
func NewActivityTracker ¶ added in v0.31.0
func NewActivityTracker( txnManager txn.Manager, sceneWriter SceneActivityWriter, config ActivityConfig, ) *ActivityTracker
NewActivityTracker creates a new ActivityTracker.
func (*ActivityTracker) RecordRequest ¶ added in v0.31.0
func (t *ActivityTracker) RecordRequest(sceneID int, clientIP string, videoDuration float64)
RecordRequest records a streaming request for activity tracking. Each request updates the session's LastActivity time, which is used for time-based tracking of watch progress.
func (*ActivityTracker) Stop ¶ added in v0.31.0
func (t *ActivityTracker) Stop()
Stop stops the activity tracker and processes any remaining sessions.
type Cache ¶
type Cache interface {
Set(key interface{}, value interface{})
Get(key interface{}) (value interface{}, ok bool)
}
type GroupFinder ¶ added in v0.27.0
type PerformerFinder ¶ added in v0.17.0
type Repository ¶ added in v0.17.0
type Repository struct {
TxnManager models.TxnManager
SceneFinder SceneFinder
FileGetter models.FileGetter
StudioFinder StudioFinder
TagFinder TagFinder
PerformerFinder PerformerFinder
GroupFinder GroupFinder
}
func NewRepository ¶ added in v0.24.0
func NewRepository(repo models.Repository) Repository
func (*Repository) WithReadTxn ¶ added in v0.24.0
type SceneActivityWriter ¶ added in v0.31.0
type SceneActivityWriter interface {
SaveActivity(ctx context.Context, sceneID int, resumeTime *float64, playDuration *float64) (bool, error)
AddViews(ctx context.Context, sceneID int, dates []time.Time) ([]time.Time, error)
}
SceneActivityWriter provides methods for saving scene activity.
type SceneFinder ¶ added in v0.17.0
type SceneFinder interface {
models.SceneGetter
models.SceneQueryer
}
type Server ¶
type Server struct {
HTTPConn net.Listener
FriendlyName string
Interfaces []net.Interface
RootObjectPath string
LogHeaders bool
Icons []Icon
// Stall event subscription requests until they drop. A workaround for
// some bad clients.
StallEventSubscribe bool
// Time interval between SSPD announces
NotifyInterval time.Duration
VideoSortOrder string
// contains filtered or unexported fields
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo Repository, cfg Config, sceneServer sceneServer, sceneWriter SceneActivityWriter, minPlayPercent int) *Service
NewService initialises and returns a new DLNA service. The sceneWriter parameter should implement SceneActivityWriter (typically models.SceneReaderWriter). The minPlayPercent parameter is the minimum percentage of video that must be played to increment play count.