aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-22 16:58:49 +0100
committerChocobozzz <me@florianbigard.com>2022-03-22 17:24:32 +0100
commit92e66e04f7f51d37b465cff442ce47f6d6d7cadd (patch)
tree4475c5c601c0f6673ca56afba5b7f70a4fae4ec3 /server/lib
parent1808a1f8e4b7b102823492a2007a46929aebf189 (diff)
downloadPeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.gz
PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.zst
PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.zip
Rename studio to editor
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/job-queue/handlers/video-studio-edition.ts (renamed from server/lib/job-queue/handlers/video-edition.ts)38
-rw-r--r--server/lib/job-queue/job-queue.ts10
-rw-r--r--server/lib/notifier/notifier.ts10
-rw-r--r--server/lib/notifier/shared/video-publication/index.ts2
-rw-r--r--server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts (renamed from server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts)8
-rw-r--r--server/lib/server-config-manager.ts4
-rw-r--r--server/lib/user.ts2
-rw-r--r--server/lib/video-state.ts2
-rw-r--r--server/lib/video-studio.ts (renamed from server/lib/video-editor.ts)8
9 files changed, 42 insertions, 42 deletions
diff --git a/server/lib/job-queue/handlers/video-edition.ts b/server/lib/job-queue/handlers/video-studio-edition.ts
index d2d2a4f65..cf3064a7a 100644
--- a/server/lib/job-queue/handlers/video-edition.ts
+++ b/server/lib/job-queue/handlers/video-studio-edition.ts
@@ -9,8 +9,8 @@ import { generateWebTorrentVideoFilename } from '@server/lib/paths'
9import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles' 9import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles'
10import { isAbleToUploadVideo } from '@server/lib/user' 10import { isAbleToUploadVideo } from '@server/lib/user'
11import { addOptimizeOrMergeAudioJob } from '@server/lib/video' 11import { addOptimizeOrMergeAudioJob } from '@server/lib/video'
12import { approximateIntroOutroAdditionalSize } from '@server/lib/video-editor'
13import { VideoPathManager } from '@server/lib/video-path-manager' 12import { VideoPathManager } from '@server/lib/video-path-manager'
13import { approximateIntroOutroAdditionalSize } from '@server/lib/video-studio'
14import { UserModel } from '@server/models/user/user' 14import { UserModel } from '@server/models/user/user'
15import { VideoModel } from '@server/models/video/video' 15import { VideoModel } from '@server/models/video/video'
16import { VideoFileModel } from '@server/models/video/video-file' 16import { VideoFileModel } from '@server/models/video/video-file'
@@ -26,23 +26,23 @@ import {
26 getVideoStreamFPS 26 getVideoStreamFPS
27} from '@shared/extra-utils' 27} from '@shared/extra-utils'
28import { 28import {
29 VideoEditionPayload, 29 VideoStudioEditionPayload,
30 VideoEditionTaskPayload, 30 VideoStudioTaskPayload,
31 VideoEditorTask, 31 VideoStudioTaskCutPayload,
32 VideoEditorTaskCutPayload, 32 VideoStudioTaskIntroPayload,
33 VideoEditorTaskIntroPayload, 33 VideoStudioTaskOutroPayload,
34 VideoEditorTaskOutroPayload, 34 VideoStudioTaskWatermarkPayload,
35 VideoEditorTaskWatermarkPayload 35 VideoStudioTask
36} from '@shared/models' 36} from '@shared/models'
37import { logger, loggerTagsFactory } from '../../../helpers/logger' 37import { logger, loggerTagsFactory } from '../../../helpers/logger'
38 38
39const lTagsBase = loggerTagsFactory('video-edition') 39const lTagsBase = loggerTagsFactory('video-edition')
40 40
41async function processVideoEdition (job: Job) { 41async function processVideoStudioEdition (job: Job) {
42 const payload = job.data as VideoEditionPayload 42 const payload = job.data as VideoStudioEditionPayload
43 const lTags = lTagsBase(payload.videoUUID) 43 const lTags = lTagsBase(payload.videoUUID)
44 44
45 logger.info('Process video edition of %s in job %d.', payload.videoUUID, job.id, lTags) 45 logger.info('Process video studio edition of %s in job %d.', payload.videoUUID, job.id, lTags)
46 46
47 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoUUID) 47 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoUUID)
48 48
@@ -106,12 +106,12 @@ async function processVideoEdition (job: Job) {
106// --------------------------------------------------------------------------- 106// ---------------------------------------------------------------------------
107 107
108export { 108export {
109 processVideoEdition 109 processVideoStudioEdition
110} 110}
111 111
112// --------------------------------------------------------------------------- 112// ---------------------------------------------------------------------------
113 113
114type TaskProcessorOptions <T extends VideoEditionTaskPayload = VideoEditionTaskPayload> = { 114type TaskProcessorOptions <T extends VideoStudioTaskPayload = VideoStudioTaskPayload> = {
115 inputPath: string 115 inputPath: string
116 outputPath: string 116 outputPath: string
117 video: MVideo 117 video: MVideo
@@ -119,7 +119,7 @@ type TaskProcessorOptions <T extends VideoEditionTaskPayload = VideoEditionTaskP
119 lTags: { tags: string[] } 119 lTags: { tags: string[] }
120} 120}
121 121
122const taskProcessors: { [id in VideoEditorTask['name']]: (options: TaskProcessorOptions) => Promise<any> } = { 122const taskProcessors: { [id in VideoStudioTask['name']]: (options: TaskProcessorOptions) => Promise<any> } = {
123 'add-intro': processAddIntroOutro, 123 'add-intro': processAddIntroOutro,
124 'add-outro': processAddIntroOutro, 124 'add-outro': processAddIntroOutro,
125 'cut': processCut, 125 'cut': processCut,
@@ -137,7 +137,7 @@ async function processTask (options: TaskProcessorOptions) {
137 return processor(options) 137 return processor(options)
138} 138}
139 139
140function processAddIntroOutro (options: TaskProcessorOptions<VideoEditorTaskIntroPayload | VideoEditorTaskOutroPayload>) { 140function processAddIntroOutro (options: TaskProcessorOptions<VideoStudioTaskIntroPayload | VideoStudioTaskOutroPayload>) {
141 const { task } = options 141 const { task } = options
142 142
143 return addIntroOutro({ 143 return addIntroOutro({
@@ -153,7 +153,7 @@ function processAddIntroOutro (options: TaskProcessorOptions<VideoEditorTaskIntr
153 }) 153 })
154} 154}
155 155
156function processCut (options: TaskProcessorOptions<VideoEditorTaskCutPayload>) { 156function processCut (options: TaskProcessorOptions<VideoStudioTaskCutPayload>) {
157 const { task } = options 157 const { task } = options
158 158
159 return cutVideo({ 159 return cutVideo({
@@ -164,7 +164,7 @@ function processCut (options: TaskProcessorOptions<VideoEditorTaskCutPayload>) {
164 }) 164 })
165} 165}
166 166
167function processAddWatermark (options: TaskProcessorOptions<VideoEditorTaskWatermarkPayload>) { 167function processAddWatermark (options: TaskProcessorOptions<VideoStudioTaskWatermarkPayload>) {
168 const { task } = options 168 const { task } = options
169 169
170 return addWatermark({ 170 return addWatermark({
@@ -212,10 +212,10 @@ async function removeAllFiles (video: MVideoWithAllFiles, webTorrentFileExceptio
212 } 212 }
213} 213}
214 214
215async function checkUserQuotaOrThrow (video: MVideoFullLight, payload: VideoEditionPayload) { 215async function checkUserQuotaOrThrow (video: MVideoFullLight, payload: VideoStudioEditionPayload) {
216 const user = await UserModel.loadByVideoId(video.id) 216 const user = await UserModel.loadByVideoId(video.id)
217 217
218 const filePathFinder = (i: number) => (payload.tasks[i] as VideoEditorTaskIntroPayload | VideoEditorTaskOutroPayload).options.file 218 const filePathFinder = (i: number) => (payload.tasks[i] as VideoStudioTaskIntroPayload | VideoStudioTaskOutroPayload).options.file
219 219
220 const additionalBytes = await approximateIntroOutroAdditionalSize(video, payload.tasks, filePathFinder) 220 const additionalBytes = await approximateIntroOutroAdditionalSize(video, payload.tasks, filePathFinder)
221 if (await isAbleToUploadVideo(user.id, additionalBytes) === false) { 221 if (await isAbleToUploadVideo(user.id, additionalBytes) === false) {
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts
index 3224abcc3..167b7b168 100644
--- a/server/lib/job-queue/job-queue.ts
+++ b/server/lib/job-queue/job-queue.ts
@@ -15,11 +15,11 @@ import {
15 ManageVideoTorrentPayload, 15 ManageVideoTorrentPayload,
16 MoveObjectStoragePayload, 16 MoveObjectStoragePayload,
17 RefreshPayload, 17 RefreshPayload,
18 VideoEditionPayload,
19 VideoFileImportPayload, 18 VideoFileImportPayload,
20 VideoImportPayload, 19 VideoImportPayload,
21 VideoLiveEndingPayload, 20 VideoLiveEndingPayload,
22 VideoRedundancyPayload, 21 VideoRedundancyPayload,
22 VideoStudioEditionPayload,
23 VideoTranscodingPayload 23 VideoTranscodingPayload
24} from '../../../shared/models' 24} from '../../../shared/models'
25import { logger } from '../../helpers/logger' 25import { logger } from '../../helpers/logger'
@@ -34,10 +34,10 @@ import { processActorKeys } from './handlers/actor-keys'
34import { processEmail } from './handlers/email' 34import { processEmail } from './handlers/email'
35import { processManageVideoTorrent } from './handlers/manage-video-torrent' 35import { processManageVideoTorrent } from './handlers/manage-video-torrent'
36import { processMoveToObjectStorage } from './handlers/move-to-object-storage' 36import { processMoveToObjectStorage } from './handlers/move-to-object-storage'
37import { processVideoEdition } from './handlers/video-edition'
38import { processVideoFileImport } from './handlers/video-file-import' 37import { processVideoFileImport } from './handlers/video-file-import'
39import { processVideoImport } from './handlers/video-import' 38import { processVideoImport } from './handlers/video-import'
40import { processVideoLiveEnding } from './handlers/video-live-ending' 39import { processVideoLiveEnding } from './handlers/video-live-ending'
40import { processVideoStudioEdition } from './handlers/video-studio-edition'
41import { processVideoTranscoding } from './handlers/video-transcoding' 41import { processVideoTranscoding } from './handlers/video-transcoding'
42import { processVideosViewsStats } from './handlers/video-views-stats' 42import { processVideosViewsStats } from './handlers/video-views-stats'
43 43
@@ -57,7 +57,7 @@ type CreateJobArgument =
57 { type: 'actor-keys', payload: ActorKeysPayload } | 57 { type: 'actor-keys', payload: ActorKeysPayload } |
58 { type: 'video-redundancy', payload: VideoRedundancyPayload } | 58 { type: 'video-redundancy', payload: VideoRedundancyPayload } |
59 { type: 'delete-resumable-upload-meta-file', payload: DeleteResumableUploadMetaFilePayload } | 59 { type: 'delete-resumable-upload-meta-file', payload: DeleteResumableUploadMetaFilePayload } |
60 { type: 'video-edition', payload: VideoEditionPayload } | 60 { type: 'video-studio-edition', payload: VideoStudioEditionPayload } |
61 { type: 'manage-video-torrent', payload: ManageVideoTorrentPayload } | 61 { type: 'manage-video-torrent', payload: ManageVideoTorrentPayload } |
62 { type: 'move-to-object-storage', payload: MoveObjectStoragePayload } 62 { type: 'move-to-object-storage', payload: MoveObjectStoragePayload }
63 63
@@ -83,7 +83,7 @@ const handlers: { [id in JobType]: (job: Job) => Promise<any> } = {
83 'video-redundancy': processVideoRedundancy, 83 'video-redundancy': processVideoRedundancy,
84 'move-to-object-storage': processMoveToObjectStorage, 84 'move-to-object-storage': processMoveToObjectStorage,
85 'manage-video-torrent': processManageVideoTorrent, 85 'manage-video-torrent': processManageVideoTorrent,
86 'video-edition': processVideoEdition 86 'video-studio-edition': processVideoStudioEdition
87} 87}
88 88
89const jobTypes: JobType[] = [ 89const jobTypes: JobType[] = [
@@ -103,7 +103,7 @@ const jobTypes: JobType[] = [
103 'video-live-ending', 103 'video-live-ending',
104 'move-to-object-storage', 104 'move-to-object-storage',
105 'manage-video-torrent', 105 'manage-video-torrent',
106 'video-edition' 106 'video-studio-edition'
107] 107]
108 108
109class JobQueue { 109class JobQueue {
diff --git a/server/lib/notifier/notifier.ts b/server/lib/notifier/notifier.ts
index e34a82603..a6f13780b 100644
--- a/server/lib/notifier/notifier.ts
+++ b/server/lib/notifier/notifier.ts
@@ -12,7 +12,7 @@ import {
12 AbuseStateChangeForReporter, 12 AbuseStateChangeForReporter,
13 AutoFollowForInstance, 13 AutoFollowForInstance,
14 CommentMention, 14 CommentMention,
15 EditionFinishedForOwner, 15 StudioEditionFinishedForOwner,
16 FollowForInstance, 16 FollowForInstance,
17 FollowForUser, 17 FollowForUser,
18 ImportFinishedForOwner, 18 ImportFinishedForOwner,
@@ -55,7 +55,7 @@ class Notifier {
55 newAbuseMessage: [ NewAbuseMessageForReporter, NewAbuseMessageForModerators ], 55 newAbuseMessage: [ NewAbuseMessageForReporter, NewAbuseMessageForModerators ],
56 newPeertubeVersion: [ NewPeerTubeVersionForAdmins ], 56 newPeertubeVersion: [ NewPeerTubeVersionForAdmins ],
57 newPluginVersion: [ NewPluginVersionForAdmins ], 57 newPluginVersion: [ NewPluginVersionForAdmins ],
58 videoEditionFinished: [ EditionFinishedForOwner ] 58 videoStudioEditionFinished: [ StudioEditionFinishedForOwner ]
59 } 59 }
60 60
61 private static instance: Notifier 61 private static instance: Notifier
@@ -200,11 +200,11 @@ class Notifier {
200 .catch(err => logger.error('Cannot notify on new plugin version %s.', plugin.name, { err })) 200 .catch(err => logger.error('Cannot notify on new plugin version %s.', plugin.name, { err }))
201 } 201 }
202 202
203 notifyOfFinishedVideoEdition (video: MVideoFullLight) { 203 notifyOfFinishedVideoStudioEdition (video: MVideoFullLight) {
204 const models = this.notificationModels.videoEditionFinished 204 const models = this.notificationModels.videoStudioEditionFinished
205 205
206 this.sendNotifications(models, video) 206 this.sendNotifications(models, video)
207 .catch(err => logger.error('Cannot notify on finished edition %s.', video.url, { err })) 207 .catch(err => logger.error('Cannot notify on finished studio edition %s.', video.url, { err }))
208 } 208 }
209 209
210 private async notify <T> (object: AbstractNotification<T>) { 210 private async notify <T> (object: AbstractNotification<T>) {
diff --git a/server/lib/notifier/shared/video-publication/index.ts b/server/lib/notifier/shared/video-publication/index.ts
index 57f3443b9..5e92cb011 100644
--- a/server/lib/notifier/shared/video-publication/index.ts
+++ b/server/lib/notifier/shared/video-publication/index.ts
@@ -1,6 +1,6 @@
1export * from './new-video-for-subscribers' 1export * from './new-video-for-subscribers'
2export * from './edition-finished-for-owner'
3export * from './import-finished-for-owner' 2export * from './import-finished-for-owner'
4export * from './owned-publication-after-auto-unblacklist' 3export * from './owned-publication-after-auto-unblacklist'
5export * from './owned-publication-after-schedule-update' 4export * from './owned-publication-after-schedule-update'
6export * from './owned-publication-after-transcoding' 5export * from './owned-publication-after-transcoding'
6export * from './studio-edition-finished-for-owner'
diff --git a/server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts b/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts
index dec91f574..ee3027245 100644
--- a/server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts
+++ b/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts
@@ -6,7 +6,7 @@ import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotifi
6import { UserNotificationType } from '@shared/models' 6import { UserNotificationType } from '@shared/models'
7import { AbstractNotification } from '../common/abstract-notification' 7import { AbstractNotification } from '../common/abstract-notification'
8 8
9export class EditionFinishedForOwner extends AbstractNotification <MVideoFullLight> { 9export class StudioEditionFinishedForOwner extends AbstractNotification <MVideoFullLight> {
10 private user: MUserDefault 10 private user: MUserDefault
11 11
12 async prepare () { 12 async prepare () {
@@ -14,11 +14,11 @@ export class EditionFinishedForOwner extends AbstractNotification <MVideoFullLig
14 } 14 }
15 15
16 log () { 16 log () {
17 logger.info('Notifying user %s its video edition %s is finished.', this.user.username, this.payload.url) 17 logger.info('Notifying user %s its video studio edition %s is finished.', this.user.username, this.payload.url)
18 } 18 }
19 19
20 getSetting (user: MUserWithNotificationSetting) { 20 getSetting (user: MUserWithNotificationSetting) {
21 return user.NotificationSetting.myVideoEditionFinished 21 return user.NotificationSetting.myVideoStudioEditionFinished
22 } 22 }
23 23
24 getTargetUsers () { 24 getTargetUsers () {
@@ -29,7 +29,7 @@ export class EditionFinishedForOwner extends AbstractNotification <MVideoFullLig
29 29
30 async createNotification (user: MUserWithNotificationSetting) { 30 async createNotification (user: MUserWithNotificationSetting) {
31 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({ 31 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
32 type: UserNotificationType.MY_VIDEO_EDITION_FINISHED, 32 type: UserNotificationType.MY_VIDEO_STUDIO_EDITION_FINISHED,
33 userId: user.id, 33 userId: user.id,
34 videoId: this.payload.id 34 videoId: this.payload.id
35 }) 35 })
diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts
index b920b73d5..d16a88f65 100644
--- a/server/lib/server-config-manager.ts
+++ b/server/lib/server-config-manager.ts
@@ -159,8 +159,8 @@ class ServerConfigManager {
159 port: CONFIG.LIVE.RTMP.PORT 159 port: CONFIG.LIVE.RTMP.PORT
160 } 160 }
161 }, 161 },
162 videoEditor: { 162 videoStudio: {
163 enabled: CONFIG.VIDEO_EDITOR.ENABLED 163 enabled: CONFIG.VIDEO_STUDIO.ENABLED
164 }, 164 },
165 import: { 165 import: {
166 videos: { 166 videos: {
diff --git a/server/lib/user.ts b/server/lib/user.ts
index 173d89d0b..310a3c30c 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -253,7 +253,7 @@ function createDefaultUserNotificationSettings (user: MUserId, t: Transaction |
253 autoInstanceFollowing: UserNotificationSettingValue.WEB, 253 autoInstanceFollowing: UserNotificationSettingValue.WEB,
254 newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL, 254 newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
255 newPluginVersion: UserNotificationSettingValue.WEB, 255 newPluginVersion: UserNotificationSettingValue.WEB,
256 myVideoEditionFinished: UserNotificationSettingValue.WEB 256 myVideoStudioEditionFinished: UserNotificationSettingValue.WEB
257 } 257 }
258 258
259 return UserNotificationSettingModel.create(values, { transaction: t }) 259 return UserNotificationSettingModel.create(values, { transaction: t })
diff --git a/server/lib/video-state.ts b/server/lib/video-state.ts
index f75f81704..7b207eb87 100644
--- a/server/lib/video-state.ts
+++ b/server/lib/video-state.ts
@@ -135,7 +135,7 @@ async function moveToPublishedState (options: {
135 await federateVideoIfNeeded(video, isNewVideo, transaction) 135 await federateVideoIfNeeded(video, isNewVideo, transaction)
136 136
137 if (previousState === VideoState.TO_EDIT) { 137 if (previousState === VideoState.TO_EDIT) {
138 Notifier.Instance.notifyOfFinishedVideoEdition(video) 138 Notifier.Instance.notifyOfFinishedVideoStudioEdition(video)
139 return 139 return
140 } 140 }
141 141
diff --git a/server/lib/video-editor.ts b/server/lib/video-studio.ts
index 99b0bd949..cdacd35f2 100644
--- a/server/lib/video-editor.ts
+++ b/server/lib/video-studio.ts
@@ -1,6 +1,6 @@
1import { MVideoFullLight } from "@server/types/models" 1import { MVideoFullLight } from '@server/types/models'
2import { getVideoStreamDuration } from "@shared/extra-utils" 2import { getVideoStreamDuration } from '@shared/extra-utils'
3import { VideoEditorTask } from "@shared/models" 3import { VideoStudioTask } from '@shared/models'
4 4
5function buildTaskFileFieldname (indice: number, fieldName = 'file') { 5function buildTaskFileFieldname (indice: number, fieldName = 'file') {
6 return `tasks[${indice}][options][${fieldName}]` 6 return `tasks[${indice}][options][${fieldName}]`
@@ -10,7 +10,7 @@ function getTaskFile (files: Express.Multer.File[], indice: number, fieldName =
10 return files.find(f => f.fieldname === buildTaskFileFieldname(indice, fieldName)) 10 return files.find(f => f.fieldname === buildTaskFileFieldname(indice, fieldName))
11} 11}
12 12
13async function approximateIntroOutroAdditionalSize (video: MVideoFullLight, tasks: VideoEditorTask[], fileFinder: (i: number) => string) { 13async function approximateIntroOutroAdditionalSize (video: MVideoFullLight, tasks: VideoStudioTask[], fileFinder: (i: number) => string) {
14 let additionalDuration = 0 14 let additionalDuration = 0
15 15
16 for (let i = 0; i < tasks.length; i++) { 16 for (let i = 0; i < tasks.length; i++) {