import { VideoPathManager } from '@server/lib/video-path-manager'
import { isVideoInPrivateDirectory } from '@server/lib/video-privacy'
import { getServerActor } from '@server/models/application/application'
-import { ModelCache } from '@server/models/model-cache'
+import { ModelCache } from '@server/models/shared/model-cache'
import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils'
-import { ffprobePromise, getAudioStream, uuidToShort } from '@shared/extra-utils'
+import { ffprobePromise, getAudioStream, hasAudioStream, uuidToShort } from '@shared/extra-utils'
import {
ResultList,
ThumbnailType,
import { ServerModel } from '../server/server'
import { TrackerModel } from '../server/tracker'
import { VideoTrackerModel } from '../server/video-tracker'
-import { setAsUpdated } from '../shared'
+import { buildTrigramSearchIndex, buildWhereIdOrUUID, getVideoSort, isOutdated, setAsUpdated, throwIfNotValid } from '../shared'
import { UserModel } from '../user/user'
import { UserVideoHistoryModel } from '../user/user-video-history'
-import { buildTrigramSearchIndex, buildWhereIdOrUUID, getVideoSort, isOutdated, throwIfNotValid } from '../utils'
import { VideoViewModel } from '../view/video-view'
import {
videoFilesModelToFormattedJSON,
import { VideoSourceModel } from './video-source'
import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
import { VideoTagModel } from './video-tag'
+import { Hooks } from '@server/lib/plugins/hooks'
export enum ScopeNames {
FOR_API = 'FOR_API',
name: 'videoId',
allowNull: false
},
+ hooks: true,
onDelete: 'cascade'
})
VideoLive: VideoLiveModel
return files
}
- toActivityPubObject (this: MVideoAP): VideoObject {
- return videoModelToActivityPubObject(this)
+ toActivityPubObject (this: MVideoAP): Promise<VideoObject> {
+ return Hooks.wrapObject(
+ videoModelToActivityPubObject(this),
+ 'filter:activity-pub.video.json-ld.build.result',
+ { video: this }
+ )
}
getTruncatedDescription () {
const probe = await ffprobePromise(originalFilePath)
const { audioStream } = await getAudioStream(originalFilePath, probe)
+ const hasAudio = await hasAudioStream(originalFilePath, probe)
return {
audioStream,
+ hasAudio,
...await getVideoStreamDimensionsInfo(originalFilePath, probe)
}
}
setAsRefreshed (transaction?: Transaction) {
- return setAsUpdated('video', this.id, transaction)
+ return setAsUpdated({ sequelize: this.sequelize, table: 'video', id: this.id, transaction })
}
// ---------------------------------------------------------------------------