diff options
author | Chocobozzz <me@florianbigard.com> | 2023-04-21 14:55:10 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | 0c9668f77901e7540e2c7045eb0f2974a4842a69 (patch) | |
tree | 226d3dd1565b0bb56588897af3b8530e6216e96b /server/models/video/video.ts | |
parent | 6bcb854cdea8688a32240bc5719c7d139806e00b (diff) | |
download | PeerTube-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.ts | 10 |
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' | |||
29 | import { removeHLSFileObjectStorageByFilename, removeHLSObjectStorage, removeWebTorrentObjectStorage } from '@server/lib/object-storage' | 29 | import { removeHLSFileObjectStorageByFilename, removeHLSObjectStorage, removeWebTorrentObjectStorage } from '@server/lib/object-storage' |
30 | import { tracer } from '@server/lib/opentelemetry/tracing' | 30 | import { tracer } from '@server/lib/opentelemetry/tracing' |
31 | import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths' | 31 | import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths' |
32 | import { Hooks } from '@server/lib/plugins/hooks' | ||
32 | import { VideoPathManager } from '@server/lib/video-path-manager' | 33 | import { VideoPathManager } from '@server/lib/video-path-manager' |
33 | import { isVideoInPrivateDirectory } from '@server/lib/video-privacy' | 34 | import { isVideoInPrivateDirectory } from '@server/lib/video-privacy' |
34 | import { getServerActor } from '@server/models/application/application' | 35 | import { getServerActor } from '@server/models/application/application' |
35 | import { ModelCache } from '@server/models/shared/model-cache' | 36 | import { ModelCache } from '@server/models/shared/model-cache' |
36 | import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils' | 37 | import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils' |
37 | import { ffprobePromise, getAudioStream, hasAudioStream, uuidToShort } from '@shared/extra-utils' | 38 | import { uuidToShort } from '@shared/extra-utils' |
39 | import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAudioStream } from '@shared/ffmpeg' | ||
38 | import { | 40 | import { |
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' |
65 | import { getVideoStreamDimensionsInfo } from '../../helpers/ffmpeg' | ||
66 | import { logger } from '../../helpers/logger' | 67 | import { logger } from '../../helpers/logger' |
67 | import { CONFIG } from '../../initializers/config' | 68 | import { CONFIG } from '../../initializers/config' |
68 | import { ACTIVITY_PUB, API_VERSION, CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, STATIC_PATHS, WEBSERVER } from '../../initializers/constants' | 69 | import { ACTIVITY_PUB, API_VERSION, CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, STATIC_PATHS, WEBSERVER } from '../../initializers/constants' |
@@ -137,7 +138,6 @@ import { VideoShareModel } from './video-share' | |||
137 | import { VideoSourceModel } from './video-source' | 138 | import { VideoSourceModel } from './video-source' |
138 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' | 139 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' |
139 | import { VideoTagModel } from './video-tag' | 140 | import { VideoTagModel } from './video-tag' |
140 | import { Hooks } from '@server/lib/plugins/hooks' | ||
141 | 141 | ||
142 | export enum ScopeNames { | 142 | export 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 | } |