aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-21 14:55:10 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commit0c9668f77901e7540e2c7045eb0f2974a4842a69 (patch)
tree226d3dd1565b0bb56588897af3b8530e6216e96b /server/models/video/video.ts
parent6bcb854cdea8688a32240bc5719c7d139806e00b (diff)
downloadPeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.gz
PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.zst
PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.zip
Implement remote runner jobs in server
Move ffmpeg functions to @shared
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index f817c4a33..baa8c120a 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -29,12 +29,14 @@ import { LiveManager } from '@server/lib/live/live-manager'
29import { removeHLSFileObjectStorageByFilename, removeHLSObjectStorage, removeWebTorrentObjectStorage } from '@server/lib/object-storage' 29import { removeHLSFileObjectStorageByFilename, removeHLSObjectStorage, removeWebTorrentObjectStorage } from '@server/lib/object-storage'
30import { tracer } from '@server/lib/opentelemetry/tracing' 30import { tracer } from '@server/lib/opentelemetry/tracing'
31import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths' 31import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths'
32import { Hooks } from '@server/lib/plugins/hooks'
32import { VideoPathManager } from '@server/lib/video-path-manager' 33import { VideoPathManager } from '@server/lib/video-path-manager'
33import { isVideoInPrivateDirectory } from '@server/lib/video-privacy' 34import { isVideoInPrivateDirectory } from '@server/lib/video-privacy'
34import { getServerActor } from '@server/models/application/application' 35import { getServerActor } from '@server/models/application/application'
35import { ModelCache } from '@server/models/shared/model-cache' 36import { ModelCache } from '@server/models/shared/model-cache'
36import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils' 37import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils'
37import { ffprobePromise, getAudioStream, hasAudioStream, uuidToShort } from '@shared/extra-utils' 38import { uuidToShort } from '@shared/extra-utils'
39import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAudioStream } from '@shared/ffmpeg'
38import { 40import {
39 ResultList, 41 ResultList,
40 ThumbnailType, 42 ThumbnailType,
@@ -62,7 +64,6 @@ import {
62 isVideoStateValid, 64 isVideoStateValid,
63 isVideoSupportValid 65 isVideoSupportValid
64} from '../../helpers/custom-validators/videos' 66} from '../../helpers/custom-validators/videos'
65import { getVideoStreamDimensionsInfo } from '../../helpers/ffmpeg'
66import { logger } from '../../helpers/logger' 67import { logger } from '../../helpers/logger'
67import { CONFIG } from '../../initializers/config' 68import { CONFIG } from '../../initializers/config'
68import { ACTIVITY_PUB, API_VERSION, CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, STATIC_PATHS, WEBSERVER } from '../../initializers/constants' 69import { ACTIVITY_PUB, API_VERSION, CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, STATIC_PATHS, WEBSERVER } from '../../initializers/constants'
@@ -137,7 +138,6 @@ import { VideoShareModel } from './video-share'
137import { VideoSourceModel } from './video-source' 138import { VideoSourceModel } from './video-source'
138import { VideoStreamingPlaylistModel } from './video-streaming-playlist' 139import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
139import { VideoTagModel } from './video-tag' 140import { VideoTagModel } from './video-tag'
140import { Hooks } from '@server/lib/plugins/hooks'
141 141
142export enum ScopeNames { 142export enum ScopeNames {
143 FOR_API = 'FOR_API', 143 FOR_API = 'FOR_API',
@@ -798,7 +798,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
798 798
799 logger.info('Stopping live of video %s after video deletion.', instance.uuid) 799 logger.info('Stopping live of video %s after video deletion.', instance.uuid)
800 800
801 LiveManager.Instance.stopSessionOf(instance.id, null) 801 LiveManager.Instance.stopSessionOf(instance.uuid, null)
802 } 802 }
803 803
804 @BeforeDestroy 804 @BeforeDestroy
@@ -1763,10 +1763,12 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1763 1763
1764 const { audioStream } = await getAudioStream(originalFilePath, probe) 1764 const { audioStream } = await getAudioStream(originalFilePath, probe)
1765 const hasAudio = await hasAudioStream(originalFilePath, probe) 1765 const hasAudio = await hasAudioStream(originalFilePath, probe)
1766 const fps = await getVideoStreamFPS(originalFilePath, probe)
1766 1767
1767 return { 1768 return {
1768 audioStream, 1769 audioStream,
1769 hasAudio, 1770 hasAudio,
1771 fps,
1770 1772
1771 ...await getVideoStreamDimensionsInfo(originalFilePath, probe) 1773 ...await getVideoStreamDimensionsInfo(originalFilePath, probe)
1772 } 1774 }