OpenVeo Publish server

API Docs for: 8.0.0
Show:

VideoProvider

Extends EntityProvider
Module: providers

Summary

Defines a VideoProvider to get and save videos.

Constructor

VideoProvider

Syntax

VideoProvider

(
  • database
)

Summary

Parameters:

  • database Database

    The database to interact with

Methods

add

Syntax

add

(
  • medias
  • [callback]
)
async

Summary

Adds medias.

Parameters:

  • medias Array

    The list of medias to store with for each media:

    • String id The media id
    • Boolean [available] true if the media is available, false otherwise
    • String [title] The media title
    • String [leadParagraph] The media lead paragraph
    • String [description] The media description
    • Number [state] The media state (see STATES class from module packages)
    • Date [date] The media date
    • String [type] The id of the associated media platform
    • Object [metadata] Information about the media as a content
    • String [metadata.user] The id of the user the media belongs to
    • Array [metadata.groups] The list of groups the media belongs to
    • Number [errorCode] The media error code (see ERRORS class from module packages)
    • String [category] The id of the category the media belongs to
    • Array [properties] The list of properties values for this media
    • String [packageType] The type of package
    • String [lastState] The last media state in publication process
    • String [lastTransition] The last media transition in publication process
    • String [originalPackagePath] Absolute path of the original package
    • String [originalFileName] Original package name without the extension
    • Array [mediaId] The list of medias in the media platform. Could have several media ids if media has multiple sources
    • Array [timecodes] The list of media timecodes
    • Array [chapters] The list of media chapters
    • Array [tags] The list of media tags
    • Array [cut] Media begin and end cuts
    • Array [sources] The list of media sources
    • Number [views=0] The statistic number of views
    • String [thumbnail] The media thumbnail URI
    • String [link] The media link in OpenVeo
  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The total amount of medias inserted
    • Array The list of added medias

createIndexes

Syntax

createIndexes

(
  • callback
)
async

Summary

Creates videos indexes.

Parameters:

  • callback Function

    Function to call when it's done with :

    • Error An error if something went wrong, null otherwise

getOne

Syntax

getOne

(
  • [filter]
  • [fields]
  • callback
)
async

Summary

Fetches a media.

If filter corresponds to more than one media, the first found media will be the returned one. If the media point of interests are in percents, needPointsOfInterestUnitConversion property will be added to the media.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter medias

  • [fields] Object optional

    Fields to be included or excluded from the response, by default all fields are returned. Only "exclude" or "include" can be specified, not both

    • [include] Array optional

      The list of fields to include in the response, all other fields are excluded

    • [exclude] Array optional

      The list of fields to exclude from response, all other fields are included. Ignored if include is also specified.

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Object The media

getTagFilePath

Syntax

getTagFilePath

(
  • mediaId
  • file
)
String private

Summary

Resolves media tag file path.

Parameters:

  • mediaId String

    The media id

  • file Object

    The file information

    • mimetype String

      The file MIME type

    • filename String

      The file name to resolve

Returns:

String:

The resolved file path

remove

Syntax

remove

(
  • [filter]
  • [callback]
)
async

Summary

Removes medias.

All datas associated to the deleted medias will also be deleted.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter medias to remove

  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of removed medias

removeAllDataRelatedToVideo

Syntax

removeAllDataRelatedToVideo

(
  • videosToRemove
  • callback
)
private async

Summary

Removes all data related to a list of videos.

Parameters:

  • videosToRemove Array

    The list of videos to remove

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise

removeChapters

Syntax

removeChapters

(
  • [filter]
  • chaptersIds
  • [callback]
)
async

Summary

Removes chapters associated to a media.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter the media to update

  • chaptersIds Array

    The list of chapters ids

  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number 1 if everything went fine

removeDirectories

Syntax

removeDirectories

(
  • directories
  • callback
)
private async

Summary

Removes a list of directories.

Parameters:

  • directories Array

    The list of directory paths

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise

removeTags

Syntax

removeTags

(
  • [filter]
  • tagsIds
  • [callback]
)
async

Summary

Removes tags associated to a media.

Files associated to deleted tags are also removed.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter the media to update

  • tagsIds Array

    The list of tags ids

  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number 1 if everything went fine

updateCategory

Syntax

updateCategory

(
  • id
  • category
  • callback
)
async

Summary

Updates video category for video platform.

Parameters:

  • id Number

    The id of the video to update

  • category String

    The category id of the video in the video platform

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateDate

Syntax

updateDate

(
  • id
  • date
  • callback
)
async

Summary

Updates video date timestamp.

Parameters:

  • id Number

    The id of the video to update

  • date Number

    The date of the video

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateErrorCode

Syntax

updateErrorCode

(
  • id
  • errorCode
  • callback
)
async

Summary

Updates video error code.

Parameters:

  • id Number

    The id of the video to update

  • errorCode Number

    The error code of the video

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateLastState

Syntax

updateLastState

(
  • id
  • state
  • callback
)
async

Summary

Updates last video state.

Parameters:

  • id Number

    The id of the video to update

  • state String

    The last state of the video

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateLastTransition

Syntax

updateLastTransition

(
  • id
  • state
  • callback
)
async

Summary

Updates last video transition.

Parameters:

  • id Number

    The id of the video to update

  • state String

    The last transition of the video

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateMedia

Syntax

updateMedia

(
  • id
  • modifier
  • [callback]
)
private

Summary

Executes an update operation on the given media.

Only one update operation can be performed at a time. Pending operations are added to the queue and executed sequentially.

Parameters:

  • id String

    The media id

  • modifier Object

    Database modifier

  • [callback] Function optional

    Function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateMediaId

Syntax

updateMediaId

(
  • id
  • idMediaPlatform
  • callback
)
async

Summary

Updates media id for media platform.

Parameters:

  • id String

    The id of the media to update

  • idMediaPlatform String

    The id of the media in the video platform

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateMetadata

Syntax

updateMetadata

(
  • id
  • metadata
  • callback
)
async

Summary

Updates video metadata for video platform.

Parameters:

  • id Number

    The id of the video to update

  • metadata Object

    The metadata of the video in the video platform

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateOne

Syntax

updateOne

(
  • [filter]
  • data
  • [callback]
)
async

Summary

Updates a media.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter the media to update

  • data Object

    The modifications to perform

    • String [data.title] The media title
    • Date [data.date] The media date
    • String [data.leadParagraph] The media lead paragraph
    • String [data.description] The media description
    • Array [data.properties] The list of properties values for this media
    • String [data.category] The id of the category the media belongs to
    • Array [data.cut] Media begin and end cuts
    • Array [data.timecodes] The list of media timecodes
    • Array [data.chapters] The list of media chapters
    • Array [data.tags] The list of media tags
    • Number [data.views=0] The statistic number of views
    • String [data.thumbnail] The media thumbnail URI
    • Array [data.sources] The list of media sources
    • Array [data.groups] The list of groups ids the media belongs to
    • String [data.user] The user id the media belongs to
    • Boolean [available] true if the media is available, false otherwise
    • Number [state] The media state (see STATES class from module packages)
    • Date [date] The media date
    • String [type] The id of the associated media platform
    • Object [metadata] Information about the media as a content
    • Number [errorCode] The media error code (see ERRORS class from module packages)
    • String [packageType] The type of package
    • String [lastState] The last media state in publication process
    • String [lastTransition] The last media transition in publication process
    • Array [mediaId] The list of medias in the media platform. Could have several media ids if media has multiple sources
    • String [link] The media link in OpenVeo
  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number 1 if everything went fine

updateOneChapter

Syntax

updateOneChapter

(
  • [filter]
  • chapter
  • String
  • [callback]
)
async

Summary

Updates a chapter associated to a media.

If chapter does not exist for the media it is created.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter the media to update

  • chapter Object

    The chapter description object

    • [value] Number optional

      The chapter time in milliseconds

    • [name] String optional

      The chapter name

    • [description] String optional

      The chapter description

  • String Object

    [chapter.id] The chapter id

  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number 1 if everything went fine
    • Object The chapter

updateOneTag

Syntax

updateOneTag

(
  • [filter]
  • tag
  • String
  • [file]
  • [callback]
)
async

Summary

Updates a tag associated to a media.

If tag does not exist for the media it is created. The associated file replaces the old file.

Parameters:

  • [filter] ResourceFilter optional

    Rules to filter the media to update

  • tag Object

    The tag description object

    • [value] Number optional

      The tag time in milliseconds

    • [name] String optional

      The tag name

    • [description] String optional

      The tag description

    • [file] String optional

      The tag file description object

      • originalname String
        The tag file original name
      • mimetype String
        The tag file MIME type
      • filename String
        The tag file name
      • size Number
        The tag file size
      • basePath String
        The tag file URI
  • String Object

    [tag.id] The tag id

  • [file] Object optional

    The new file to associate to the tag

    • originalname String

      The tag file original name

    • mimetype String

      The tag file MIME type

    • filename String

      The tag file name

    • size Number

      The tag file size

  • [callback] Function optional

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number 1 if everything went fine
    • Object The tag

updateState

Syntax

updateState

(
  • id
  • state
  • callback
)
async

Summary

Updates video state.

Parameters:

  • id Number

    The id of the video to update

  • state String

    The state of the video

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateThumbnail

Syntax

updateThumbnail

(
  • id
  • path
  • callback
)
async

Summary

Updates video thumbnail.

Parameters:

  • id Number

    The id of the video to update

  • path String

    The path of the thumbnail file

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateTitle

Syntax

updateTitle

(
  • id
  • title
  • callback
)
async

Summary

Updates video title.

Parameters:

  • id Number

    The id of the video to update

  • title String

    The video title

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

updateType

Syntax

updateType

(
  • id
  • type
  • callback
)
async

Summary

Updates video platform type.

Parameters:

  • id Number

    The id of the video to update

  • type String

    The type of the video platform

  • callback Function

    The function to call when it's done

    • Error The error if an error occurred, null otherwise
    • Number The number of updated items

Properties

pendingUpdate

Syntax

pendingUpdate

Boolean final

Summary

Indicates if an update is actually running.

updateQueue

Syntax

updateQueue

Array final

Summary

List of pending updates.