From 92e66e04f7f51d37b465cff442ce47f6d6d7cadd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 22 Mar 2022 16:58:49 +0100 Subject: Rename studio to editor --- client/src/app/+video-editor/edit/index.ts | 2 - .../edit/video-editor-edit.component.html | 88 --------- .../edit/video-editor-edit.component.scss | 76 -------- .../edit/video-editor-edit.component.ts | 202 --------------------- .../edit/video-editor-edit.resolver.ts | 18 -- client/src/app/+video-editor/index.ts | 1 - client/src/app/+video-editor/shared/index.ts | 1 - .../+video-editor/shared/video-editor.service.ts | 28 --- .../+video-editor/video-editor-routing.module.ts | 30 --- .../src/app/+video-editor/video-editor.module.ts | 27 --- 10 files changed, 473 deletions(-) delete mode 100644 client/src/app/+video-editor/edit/index.ts delete mode 100644 client/src/app/+video-editor/edit/video-editor-edit.component.html delete mode 100644 client/src/app/+video-editor/edit/video-editor-edit.component.scss delete mode 100644 client/src/app/+video-editor/edit/video-editor-edit.component.ts delete mode 100644 client/src/app/+video-editor/edit/video-editor-edit.resolver.ts delete mode 100644 client/src/app/+video-editor/index.ts delete mode 100644 client/src/app/+video-editor/shared/index.ts delete mode 100644 client/src/app/+video-editor/shared/video-editor.service.ts delete mode 100644 client/src/app/+video-editor/video-editor-routing.module.ts delete mode 100644 client/src/app/+video-editor/video-editor.module.ts (limited to 'client/src/app/+video-editor') diff --git a/client/src/app/+video-editor/edit/index.ts b/client/src/app/+video-editor/edit/index.ts deleted file mode 100644 index 390ca80fc..000000000 --- a/client/src/app/+video-editor/edit/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './video-editor-edit.component' -export * from './video-editor-edit.resolver' diff --git a/client/src/app/+video-editor/edit/video-editor-edit.component.html b/client/src/app/+video-editor/edit/video-editor-edit.component.html deleted file mode 100644 index d33dfaf18..000000000 --- a/client/src/app/+video-editor/edit/video-editor-edit.component.html +++ /dev/null @@ -1,88 +0,0 @@ -
-

Edit {{ video.name }}

- -
-
- -
-

CUT VIDEO

- -
Set a new start/end.
- -
- - -
- -
- - -
-
- -
-

ADD INTRO

- -
Concatenate a file at the beginning of the video.
- -
- -
-
- -
-

ADD OUTRO

- -
Concatenate a file at the end of the video.
- -
- -
-
- -
-

ADD WATERMARK

- -
Add a watermark image to the video.
- -
- -
-
- - -
- - -
-
- - -
- -
- - -
    -
  1. {{ task }}
  2. -
-
-
-
-
diff --git a/client/src/app/+video-editor/edit/video-editor-edit.component.scss b/client/src/app/+video-editor/edit/video-editor-edit.component.scss deleted file mode 100644 index 43f336f59..000000000 --- a/client/src/app/+video-editor/edit/video-editor-edit.component.scss +++ /dev/null @@ -1,76 +0,0 @@ -@use '_variables' as *; -@use '_mixins' as *; - -.columns { - display: flex; - - .information { - width: 100%; - margin-left: 50px; - - > div { - margin-bottom: 30px; - } - - @media screen and (max-width: $small-view) { - display: none; - } - } -} - -h1 { - font-size: 20px; -} - -h2 { - font-weight: $font-bold; - font-size: 16px; - color: pvar(--mainColor); - background-color: pvar(--mainBackgroundColor); - padding: 0 5px; - width: fit-content; - margin: -8px 0 0; -} - -.section { - $min-width: 600px; - - @include padding-left(10px); - - min-width: $min-width; - - margin-bottom: 50px; - border: 1px solid $separator-border-color; - border-radius: 5px; - width: fit-content; - - .form-group, - .description { - @include margin-left(5px); - } - - .description { - color: pvar(--greyForegroundColor); - margin-top: 5px; - margin-bottom: 15px; - } - - @media screen and (max-width: $min-width) { - min-width: none; - } -} - -my-timestamp-input { - display: block; -} - -my-embed { - display: block; - max-width: 500px; - width: 100%; -} - -my-reactive-file { - display: block; - width: fit-content; -} diff --git a/client/src/app/+video-editor/edit/video-editor-edit.component.ts b/client/src/app/+video-editor/edit/video-editor-edit.component.ts deleted file mode 100644 index 0adf93335..000000000 --- a/client/src/app/+video-editor/edit/video-editor-edit.component.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { Component, OnInit } from '@angular/core' -import { ActivatedRoute, Router } from '@angular/router' -import { ConfirmService, Notifier, ServerService } from '@app/core' -import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' -import { Video, VideoDetails } from '@app/shared/shared-main' -import { LoadingBarService } from '@ngx-loading-bar/core' -import { secondsToTime } from '@shared/core-utils' -import { VideoEditorTask, VideoEditorTaskCut } from '@shared/models' -import { VideoEditorService } from '../shared' - -@Component({ - selector: 'my-video-editor-edit', - templateUrl: './video-editor-edit.component.html', - styleUrls: [ './video-editor-edit.component.scss' ] -}) -export class VideoEditorEditComponent extends FormReactive implements OnInit { - isRunningEdition = false - - video: VideoDetails - - constructor ( - protected formValidatorService: FormValidatorService, - private serverService: ServerService, - private notifier: Notifier, - private router: Router, - private route: ActivatedRoute, - private videoEditorService: VideoEditorService, - private loadingBar: LoadingBarService, - private confirmService: ConfirmService - ) { - super() - } - - ngOnInit () { - this.video = this.route.snapshot.data.video - - const defaultValues = { - cut: { - start: 0, - end: this.video.duration - } - } - - this.buildForm({ - cut: { - start: null, - end: null - }, - 'add-intro': { - file: null - }, - 'add-outro': { - file: null - }, - 'add-watermark': { - file: null - } - }, defaultValues) - } - - get videoExtensions () { - return this.serverService.getHTMLConfig().video.file.extensions - } - - get imageExtensions () { - return this.serverService.getHTMLConfig().video.image.extensions - } - - async runEdition () { - if (this.isRunningEdition) return - - const title = $localize`Are you sure you want to edit "${this.video.name}"?` - const listHTML = this.getTasksSummary().map(t => `
  • ${t}
  • `).join('') - - // eslint-disable-next-line max-len - const confirmHTML = $localize`The current video will be overwritten by this edited video and you won't be able to recover it.

    ` + - $localize`As a reminder, the following tasks will be executed:
      ${listHTML}
    ` - - if (await this.confirmService.confirm(confirmHTML, title) !== true) return - - this.isRunningEdition = true - - const tasks = this.buildTasks() - - this.loadingBar.useRef().start() - - return this.videoEditorService.editVideo(this.video.uuid, tasks) - .subscribe({ - next: () => { - this.notifier.success($localize`Video updated.`) - this.router.navigateByUrl(Video.buildWatchUrl(this.video)) - }, - - error: err => { - this.loadingBar.useRef().complete() - this.isRunningEdition = false - this.notifier.error(err.message) - console.error(err) - } - }) - } - - getIntroOutroTooltip () { - return $localize`(extensions: ${this.videoExtensions.join(', ')})` - } - - getWatermarkTooltip () { - return $localize`(extensions: ${this.imageExtensions.join(', ')})` - } - - noEdition () { - return this.buildTasks().length === 0 - } - - getTasksSummary () { - const tasks = this.buildTasks() - - return tasks.map(t => { - if (t.name === 'add-intro') { - return $localize`"${this.getFilename(t.options.file)}" will be added at the beginning of the video` - } - - if (t.name === 'add-outro') { - return $localize`"${this.getFilename(t.options.file)}" will be added at the end of the video` - } - - if (t.name === 'add-watermark') { - return $localize`"${this.getFilename(t.options.file)}" image watermark will be added to the video` - } - - if (t.name === 'cut') { - const { start, end } = t.options - - if (start !== undefined && end !== undefined) { - return $localize`Video will begin at ${secondsToTime(start)} and stop at ${secondsToTime(end)}` - } - - if (start !== undefined) { - return $localize`Video will begin at ${secondsToTime(start)}` - } - - if (end !== undefined) { - return $localize`Video will stop at ${secondsToTime(end)}` - } - } - - return '' - }) - } - - private getFilename (obj: any) { - return obj.name - } - - private buildTasks () { - const tasks: VideoEditorTask[] = [] - const value = this.form.value - - const cut = value['cut'] - if (cut['start'] !== 0 || cut['end'] !== this.video.duration) { - - const options: VideoEditorTaskCut['options'] = {} - if (cut['start'] !== 0) options.start = cut['start'] - if (cut['end'] !== this.video.duration) options.end = cut['end'] - - tasks.push({ - name: 'cut', - options - }) - } - - if (value['add-intro']?.['file']) { - tasks.push({ - name: 'add-intro', - options: { - file: value['add-intro']['file'] - } - }) - } - - if (value['add-outro']?.['file']) { - tasks.push({ - name: 'add-outro', - options: { - file: value['add-outro']['file'] - } - }) - } - - if (value['add-watermark']?.['file']) { - tasks.push({ - name: 'add-watermark', - options: { - file: value['add-watermark']['file'] - } - }) - } - - return tasks - } - -} diff --git a/client/src/app/+video-editor/edit/video-editor-edit.resolver.ts b/client/src/app/+video-editor/edit/video-editor-edit.resolver.ts deleted file mode 100644 index 7b95ae834..000000000 --- a/client/src/app/+video-editor/edit/video-editor-edit.resolver.ts +++ /dev/null @@ -1,18 +0,0 @@ - -import { Injectable } from '@angular/core' -import { ActivatedRouteSnapshot, Resolve } from '@angular/router' -import { VideoService } from '@app/shared/shared-main' - -@Injectable() -export class VideoEditorEditResolver implements Resolve { - constructor ( - private videoService: VideoService - ) { - } - - resolve (route: ActivatedRouteSnapshot) { - const videoId: string = route.params['videoId'] - - return this.videoService.getVideo({ videoId }) - } -} diff --git a/client/src/app/+video-editor/index.ts b/client/src/app/+video-editor/index.ts deleted file mode 100644 index 5a9e9fdd0..000000000 --- a/client/src/app/+video-editor/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-editor.module' diff --git a/client/src/app/+video-editor/shared/index.ts b/client/src/app/+video-editor/shared/index.ts deleted file mode 100644 index eaf88b6f4..000000000 --- a/client/src/app/+video-editor/shared/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './video-editor.service' diff --git a/client/src/app/+video-editor/shared/video-editor.service.ts b/client/src/app/+video-editor/shared/video-editor.service.ts deleted file mode 100644 index 5b7053039..000000000 --- a/client/src/app/+video-editor/shared/video-editor.service.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { catchError } from 'rxjs' -import { HttpClient } from '@angular/common/http' -import { Injectable } from '@angular/core' -import { RestExtractor } from '@app/core' -import { objectToFormData } from '@app/helpers' -import { VideoService } from '@app/shared/shared-main' -import { VideoEditorCreateEdition, VideoEditorTask } from '@shared/models' - -@Injectable() -export class VideoEditorService { - - constructor ( - private authHttp: HttpClient, - private restExtractor: RestExtractor - ) {} - - editVideo (videoId: number | string, tasks: VideoEditorTask[]) { - const url = VideoService.BASE_VIDEO_URL + '/' + videoId + '/editor/edit' - const body: VideoEditorCreateEdition = { - tasks - } - - const data = objectToFormData(body) - - return this.authHttp.post(url, data) - .pipe(catchError(err => this.restExtractor.handleError(err))) - } -} diff --git a/client/src/app/+video-editor/video-editor-routing.module.ts b/client/src/app/+video-editor/video-editor-routing.module.ts deleted file mode 100644 index 9f37a0dae..000000000 --- a/client/src/app/+video-editor/video-editor-routing.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { NgModule } from '@angular/core' -import { RouterModule, Routes } from '@angular/router' -import { VideoEditorEditResolver } from './edit' -import { VideoEditorEditComponent } from './edit/video-editor-edit.component' - -const videoEditorRoutes: Routes = [ - { - path: '', - children: [ - { - path: 'edit/:videoId', - component: VideoEditorEditComponent, - data: { - meta: { - title: $localize`Edit video` - } - }, - resolve: { - video: VideoEditorEditResolver - } - } - ] - } -] - -@NgModule({ - imports: [ RouterModule.forChild(videoEditorRoutes) ], - exports: [ RouterModule ] -}) -export class VideoEditorRoutingModule {} diff --git a/client/src/app/+video-editor/video-editor.module.ts b/client/src/app/+video-editor/video-editor.module.ts deleted file mode 100644 index 7bbebc17b..000000000 --- a/client/src/app/+video-editor/video-editor.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { NgModule } from '@angular/core' -import { SharedFormModule } from '@app/shared/shared-forms' -import { SharedMainModule } from '@app/shared/shared-main' -import { VideoEditorEditComponent, VideoEditorEditResolver } from './edit' -import { VideoEditorService } from './shared' -import { VideoEditorRoutingModule } from './video-editor-routing.module' - -@NgModule({ - imports: [ - VideoEditorRoutingModule, - - SharedMainModule, - SharedFormModule - ], - - declarations: [ - VideoEditorEditComponent - ], - - exports: [], - - providers: [ - VideoEditorService, - VideoEditorEditResolver - ] -}) -export class VideoEditorModule { } -- cgit v1.2.3