media

package
v0.0.0-...-36085eb Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionableInfo

type ActionableInfo interface {
	BasicInfo
	ProduceMediaQueueEntry(requestedBy auth.User, requestCost payment.Amount, unskippable bool, concealed bool, queueID string) QueueEntry
	FillAPITicketMediaInfo(ticket *proto.EnqueueMediaTicket)
	SerializeForAPIQueue(ctx context.Context) proto.IsQueueEntry_MediaInfo
}

ActionableInfo provides information about a media and is able to turn it into a QueueEntry, when given extra information

type BasicInfo

type BasicInfo interface {
	Title() string
	MediaID() (types.MediaType, string)
	Offset() time.Duration
	Length() time.Duration
}

BasicInfo provides information about a media

type CollectionKey

type CollectionKey struct {
	Type  types.MediaCollectionType
	ID    string
	Title string
}

type CommonInfo

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

CommonInfo contains the common implementation of some Info functionality

func CommonMediaInfoFromPlayedMedia

func CommonMediaInfoFromPlayedMedia(playedMedia *types.PlayedMedia, title string) CommonInfo

CommonMediaInfoFromPlayedMedia returns a CommonInfo from a played media and the specified title

func (*CommonInfo) Length

func (e *CommonInfo) Length() time.Duration

Length implements the Info interface

func (*CommonInfo) Offset

func (e *CommonInfo) Offset() time.Duration

Offset implements the Info interface

func (*CommonInfo) SetLength

func (e *CommonInfo) SetLength(length time.Duration)

func (*CommonInfo) SetOffset

func (e *CommonInfo) SetOffset(offset time.Duration)

func (*CommonInfo) SetTitle

func (e *CommonInfo) SetTitle(title string)

func (*CommonInfo) Title

func (e *CommonInfo) Title() string

Title implements the Info interface

type CommonQueueEntry

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

CommonQueueEntry contains the common implementation of some QueueEntry functionality

func (*CommonQueueEntry) ActionableMediaInfo

func (e *CommonQueueEntry) ActionableMediaInfo() ActionableInfo

func (*CommonQueueEntry) BaseProducePlayedMedia

func (e *CommonQueueEntry) BaseProducePlayedMedia(mediaType types.MediaType, mediaID string, mediaInfo interface{}) (*types.PlayedMedia, error)

func (*CommonQueueEntry) Concealed

func (e *CommonQueueEntry) Concealed() bool

Concealed implements the QueueEntry interface

func (*CommonQueueEntry) DonePlaying

func (e *CommonQueueEntry) DonePlaying() event.NoArgEvent

DonePlaying implements the QueueEntry interface

func (*CommonQueueEntry) FillMediaQueueEntryFields

func (e *CommonQueueEntry) FillMediaQueueEntryFields(requestedBy auth.User, requestCost payment.Amount, unskippable, concealed bool, queueID string)

func (*CommonQueueEntry) InitializeBase

func (e *CommonQueueEntry) InitializeBase(mediaInfo ActionableInfo, overrider QueueEntry)

func (*CommonQueueEntry) MediaInfo

func (e *CommonQueueEntry) MediaInfo() BasicInfo

func (*CommonQueueEntry) MovedBy

func (e *CommonQueueEntry) MovedBy() []string

MovedBy implements the QueueEntry interface

func (*CommonQueueEntry) PerformanceID

func (e *CommonQueueEntry) PerformanceID() string

PerformanceID implements the Performance interface

func (*CommonQueueEntry) Play

func (e *CommonQueueEntry) Play()

Play implements the QueueEntry interface

func (*CommonQueueEntry) Played

func (e *CommonQueueEntry) Played() bool

Played implements the QueueEntry interface

func (*CommonQueueEntry) PlayedFor

func (e *CommonQueueEntry) PlayedFor() time.Duration

PlayedFor implements the QueueEntry interface

func (*CommonQueueEntry) Playing

func (e *CommonQueueEntry) Playing() bool

Playing implements the QueueEntry interface

func (*CommonQueueEntry) RequestCost

func (e *CommonQueueEntry) RequestCost() payment.Amount

RequestCost implements the Performance interface

func (*CommonQueueEntry) RequestedAt

func (e *CommonQueueEntry) RequestedAt() time.Time

RequestedAt implements the Performance interface

func (*CommonQueueEntry) RequestedBy

func (e *CommonQueueEntry) RequestedBy() auth.User

RequestedBy implements the Performance interface

func (*CommonQueueEntry) SetAsMovedBy

func (e *CommonQueueEntry) SetAsMovedBy(user auth.User)

SetAsMovedBy implements the QueueEntry interface

func (*CommonQueueEntry) SetConcealed

func (e *CommonQueueEntry) SetConcealed(concealed bool)

func (*CommonQueueEntry) SetQueueID

func (e *CommonQueueEntry) SetQueueID(queueID string)

func (*CommonQueueEntry) SetRequestCost

func (e *CommonQueueEntry) SetRequestCost(amount payment.Amount)

func (*CommonQueueEntry) SetRequestedAt

func (e *CommonQueueEntry) SetRequestedAt(requestedAt time.Time)

func (*CommonQueueEntry) SetRequestedBy

func (e *CommonQueueEntry) SetRequestedBy(user auth.User)

func (*CommonQueueEntry) SetUnskippable

func (e *CommonQueueEntry) SetUnskippable(unskippable bool)

func (*CommonQueueEntry) StartedAt

func (e *CommonQueueEntry) StartedAt() time.Time

StartedAt implements the Performance interface

func (*CommonQueueEntry) Stop

func (e *CommonQueueEntry) Stop()

Stop implements the QueueEntry interface

func (*CommonQueueEntry) Unskippable

func (e *CommonQueueEntry) Unskippable() bool

Unskippable implements the Performance interface

func (*CommonQueueEntry) WasMovedBy

func (e *CommonQueueEntry) WasMovedBy(user auth.User) bool

WasMovedBy implements the QueueEntry interface

type EnqueueRequest

type EnqueueRequest interface {
	RequestedBy() auth.User
	Unskippable() bool
	Concealed() bool
	ActionableMediaInfo() ActionableInfo
}

EnqueueRequest is a request to create an EnqueueTicket

type EnqueueRequestCreationResult

type EnqueueRequestCreationResult int

EnqueueRequestCreationResult contains the result of creating a media enqueue request

const (
	EnqueueRequestCreationSucceeded EnqueueRequestCreationResult = iota
	EnqueueRequestCreationFailed
	EnqueueRequestCreationFailedMediumNotFound
	EnqueueRequestCreationFailedMediumAgeRestricted
	EnqueueRequestCreationFailedMediumIsUpcomingLiveBroadcast
	EnqueueRequestCreationFailedMediumIsUnpopularLiveBroadcast
	EnqueueRequestCreationFailedMediumIsNotEmbeddable
	EnqueueRequestCreationFailedMediumIsTooLong
	EnqueueRequestCreationFailedMediumIsAlreadyInQueue
	EnqueueRequestCreationFailedMediumPlayedTooRecently
	EnqueueRequestCreationFailedMediumIsDisallowed
	EnqueueRequestCreationFailedMediumIsNotATrack
)

type InitialInfo

type InitialInfo interface {
	MediaID() (types.MediaType, string)
	Title() string
	Collections() []CollectionKey
}

InitialInfo provides the initial information for blocklist checking during the enqueuing process

type MediaQueueStub

type MediaQueueStub interface {
	Entries() []QueueEntry
}

MediaQueueStub contains a subset of the methods implemented by the media queue which are useful to media providers

type Performance

type Performance interface {
	RequestedBy() auth.User
	RequestCost() payment.Amount
	RequestedAt() time.Time
	Unskippable() bool

	Played() bool
	Playing() bool
	StartedAt() time.Time
	PlayedFor() time.Duration

	MediaInfo() BasicInfo
	PerformanceID() string
}

Performance represents one performance of a media

type Provider

type Provider interface {
	SetMediaQueue(mediaQueue MediaQueueStub)
	CanHandleRequestType(mediaParameters proto.IsEnqueueMediaRequest_MediaInfo) bool
	BeginEnqueueRequest(ctx *transaction.WrappingContext, mediaParameters proto.IsEnqueueMediaRequest_MediaInfo) (InitialInfo, EnqueueRequestCreationResult, error)
	ContinueEnqueueRequest(ctx *transaction.WrappingContext, info InitialInfo, unskippable, concealed, anonymous,
		allowUnpopular, skipLengthChecks, skipDuplicationChecks bool) (EnqueueRequest, EnqueueRequestCreationResult, error)

	UnmarshalQueueEntryJSON(ctx context.Context, b []byte) (QueueEntry, bool, error)

	BasicMediaInfoFromPlayedMedia(playedMedia *types.PlayedMedia) (BasicInfo, error)
	SerializePlayedMediaMediaInfo(playedMedia *types.PlayedMedia) (proto.IsPlayedMedia_MediaInfo, error)
	SerializeUserProfileResponseFeaturedMedia(playedMedia *types.PlayedMedia) (proto.IsUserProfileResponse_FeaturedMedia, error)
}

Provider provides media enqueuing and serialization facilities

type QueueEntry

type QueueEntry interface {
	json.Marshaler
	Performance

	ActionableMediaInfo() ActionableInfo
	Concealed() bool
	ProduceCheckpointForAPI(ctx context.Context) *proto.MediaConsumptionCheckpoint
	ProducePlayedMedia() (*types.PlayedMedia, error)
	Play()
	Stop()
	DonePlaying() event.NoArgEvent

	WasMovedBy(user auth.User) bool
	SetAsMovedBy(user auth.User)
	MovedBy() []string
}

QueueEntry represents one entry in the media queue

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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