AbstractPvrService

AbstractPvrService ⇐ Abstract

Kind: global abstract class
Extends: Abstract
Mixes: MServiceCache
Service:
Properties

NameTypeDescription
nbPvrTunerAvailableNumber

Number of tuner available (default -1 no limitation)

isCustomMarginAvailableBoolean

Enable or disable custom margin from user

isEnabledBoolean

Flag to tell if pvr is enabled

AbstractPvrService()

This abstract class represents the interface of the personal video recorder services. You must inherits your vendors implementations from this class.

init() ⇒ Promise

Init must be called asap as most of PVR API is synchronous for performance needs

Kind: instance method of AbstractPvrService

getTotalSpace(options) ⇒ Number

Retrieves total space for recording

Kind: instance method of AbstractPvrService
Returns: Number - Total space in minutes

ParamTypeDefaultDescription
optionsObject

Additional options

[options.force]Booleanfalse

If true, renew the cache

[options.duration]Number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

getRemainingSpace(options) ⇒ Number

Retrieves remaining space for recording

Kind: instance method of AbstractPvrService
Returns: Number - Remaining space in minutes

ParamTypeDefaultDescription
optionsObject

Additional options

[options.force]Booleanfalse

If true, renew the cache

[options.duration]number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

add(recording, options) ⇒ Promise.<Recording, Error>

Add a new recording to the recording list and start it if it can be started. If the recording is null or it’s id is not null or it’s program is null or it’s state is not RecordingState.CREATED return a rejected promise (an error).

Kind: instance method of AbstractPvrService
Returns: Promise.<Recording, Error> - A promise (recording, error)

ParamTypeDefaultDescription
recordingRecording

The recording to add

optionsObject

additional options

[options.addToFront]Boolean

Add record to the front

[options.duration]number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

delete(recording, options) ⇒ Promise.<Recording, Error>

Delete a recording from the recording list (and from the resource where it is stored) If the recording is null or the recording id is null, return a rejected promise (an error).

Kind: instance method of AbstractPvrService
Returns: Promise.<Recording, Error> - A promise (recording, error)

ParamTypeDescription
recordingRecording

The recording to delete

optionsObject

additional options

update(recording) ⇒ Promise.<Recording, Error>

Update a recording and start it if it can be started If the recording is null, return a rejected promise (an error).

Kind: instance method of AbstractPvrService
Returns: Promise.<Recording, Error> - A promise (recording, error)

ParamTypeDescription
recordingRecording

The recording to update

stop(recording, options) ⇒ Promise.<Recording, Error>

Stop manually a recording, ie stop recording the current channel’s program. It is an error to stop a recording that is not started

Kind: instance method of AbstractPvrService
Returns: Promise.<Recording, Error> - A promise (recording, error)

ParamTypeDescription
recordingRecording

The recording to delete

optionsObject

additional options

getRecordingMedia(recording) ⇒ Promise.<Media, Error>

Retrieve media to play for a recording

Kind: instance method of AbstractPvrService
Returns: Promise.<Media, Error> - A promise (media, error)

ParamTypeDescription
recordingRecording

The recording to delete

getNbRecordings() ⇒ Promise.<Number>

Return number of recordings

Kind: instance method of AbstractPvrService

checkConflict(recording, options) ⇒ Promise.<Recording, Error>

Check if there is some conflicts with recordings

Kind: instance method of AbstractPvrService
Returns: Promise.<Recording, Error> - A promise (recording, error)

ParamTypeDefaultDescription
recordingRecording
optionsObject

Additional options

[options.paddingStart]number0
[options.paddingEnd]number0
[options.nbTunersAvailable]number1
[options.paddingStart]number0
[options.autoResolvePaddingConflicts]Booleantrue

getRecordingById(recordingId) ⇒ Recording

Return the recording referenced by it’s id

Kind: instance method of AbstractPvrService
Returns: Recording - The recording

ParamTypeDescription
recordingIdString

the id of the recording to get

getRecordings(options) ⇒ Promise.<Array.<Recording>, Error>

Get all recordings.

Kind: instance method of AbstractPvrService
Returns: Promise.<Array.<Recording>, Error> - A promise (recordings<Array>, error)

ParamTypeDefaultDescription
optionsObject

Additional options

[options.force]Booleanfalse

If true, renew the cache

[options.duration]number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

getProgramAssociateRecording(programId) ⇒ AbstractRecording | null

Find recording for a program id.

Warning return null if the service has not been initialized

Kind: instance method of AbstractPvrService
Returns: AbstractRecording | null - The recording of the program

ParamTypeDescription
programIdString

Id of the program

isBeingRecorded([channelOrProgramOrNull]) ⇒ Promise.<boolean, Error>

Return true if the media (a channel or a program) is currently being recorded. When called with no arguments, indicates that some medias are currently being recorded or not.

The abstract service offers a default implementation that may be overridden by the vendor for performance reason.

Kind: instance method of AbstractPvrService
Returns: Promise.<boolean, Error> - A promise resolve with true if the specified channel or program is being recorded, or if some recordings are started if no channel /program was specified

ParamTypeDescription
[channelOrProgramOrNull]AbstractChannel | AbstractGridProgram | null

The channel or the program to check; null for any channel/program

_getTotalSpace() ⇒ Number

Retrieves total space for recording

Kind: instance method of AbstractPvrService
Returns: Number - Total space in minutes

_getRemainingSpace() ⇒ Number

Retrieves remaining space for recording

Kind: instance method of AbstractPvrService
Returns: Number - Remaining space in minutes

_updateStartedRecording(recording, state)

Update the map containing started records

Kind: instance method of AbstractPvrService
Access: protected

ParamType
recordingRecording
statenumber

“recordingStateChanged” (recording, newState, oldState)

Fired when the state of a recording changed.

Kind: event emitted by AbstractPvrService

ParamTypeDescription
recordingRecording

Recording which state changed

newStateRecordingState

New state of recording

oldStateRecordingState

Old state of recording

“recordingChanged” (recording)

Fired when a recording changed.

Kind: event emitted by AbstractPvrService

ParamTypeDescription
recordingRecording

Recording which changed

“recordingError” (recording, errorId, error)

Fired when a recording is in error.

Kind: event emitted by AbstractPvrService

ParamTypeDescription
recordingRecording

Recording which is in error

errorIdString

Error id

errorError

Error

_PROGRAM_ASSOCIATE_RECODINGS

Kind: static property of AbstractPvrService
Access: protected

_RECORDINGS

Kind: static property of AbstractPvrService
Access: protected

_TOTAL_SPACE

Kind: static property of AbstractPvrService
Access: protected

_REMAINING_SPACE

Kind: static property of AbstractPvrService
Access: protected

ERROR_INSUFFICIENT_STORAGE : number

Kind: static constant of AbstractPvrService

ERROR_RESOURCE_LIMITATION : number

Kind: static constant of AbstractPvrService

ERROR_ADD_RECORDING : number

Kind: static constant of AbstractPvrService

ERROR_UPDATE_RECORDING : number

Kind: static constant of AbstractPvrService

ERROR_DELETE_RECORDING : number

Kind: static constant of AbstractPvrService

ERROR_START_RECORDING : number

Kind: static constant of AbstractPvrService

ERROR_STOP_RECORDING : number

Kind: static constant of AbstractPvrService

ERROR_GET_RECORDING : number

Kind: static constant of AbstractPvrService

ERROR_FIND_RECORDINGS : number

Kind: static constant of AbstractPvrService

ERROR_NOT_IMPLEMENTED : number

Kind: static constant of AbstractPvrService