1
0
Fork 0

Allow to edit video attribute "importedFrom" with the UI

This commit is contained in:
Alex Kotov 2023-05-26 11:44:21 +04:00
parent d1d14cd540
commit 43cb1772c1
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
9 changed files with 38 additions and 1 deletions

View File

@ -350,6 +350,29 @@
<input type="text" [disabled]="true" id="filename" class="form-control" [value]="videoSource.filename" /> <input type="text" [disabled]="true" id="filename" class="form-control" [value]="videoSource.filename" />
</div> </div>
<div class="form-group imported-from">
<label i18n for="importedFrom">Imported from</label>
<my-help>
<ng-template ptTemplate="preHtml">
<ng-container i18n>
The URL where this video is imported from
</ng-container>
</ng-template>
</my-help>
<input
id="importedFrom"
formControlName="importedFrom"
type="text"
class="form-control"
/>
<div *ngIf="formErrors.importedFrom" class="form-error">
{{ formErrors.importedFrom }}
</div>
</div>
<div class="form-group originally-published-at"> <div class="form-group originally-published-at">
<label i18n for="originallyPublishedAt">Original publication date</label> <label i18n for="originallyPublishedAt">Original publication date</label>
<my-help> <my-help>

View File

@ -161,6 +161,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
previewfile: null, previewfile: null,
support: VIDEO_SUPPORT_VALIDATOR, support: VIDEO_SUPPORT_VALIDATOR,
schedulePublicationAt: VIDEO_SCHEDULE_PUBLICATION_AT_VALIDATOR, schedulePublicationAt: VIDEO_SCHEDULE_PUBLICATION_AT_VALIDATOR,
importedFrom: null,
originallyPublishedAt: VIDEO_ORIGINALLY_PUBLISHED_AT_VALIDATOR, originallyPublishedAt: VIDEO_ORIGINALLY_PUBLISHED_AT_VALIDATOR,
liveStreamKey: null, liveStreamKey: null,
permanentLive: null, permanentLive: null,

View File

@ -23,6 +23,7 @@ export class VideoEdit implements VideoUpdate {
thumbnailUrl: string thumbnailUrl: string
previewUrl: string previewUrl: string
scheduleUpdate?: VideoScheduleUpdate scheduleUpdate?: VideoScheduleUpdate
importedFrom?: string
originallyPublishedAt?: Date | string originallyPublishedAt?: Date | string
id?: number id?: number
@ -57,6 +58,7 @@ export class VideoEdit implements VideoUpdate {
if (video.previewPath) this.previewUrl = getAbsoluteAPIUrl() + video.previewPath if (video.previewPath) this.previewUrl = getAbsoluteAPIUrl() + video.previewPath
this.scheduleUpdate = video.scheduledUpdate this.scheduleUpdate = video.scheduledUpdate
this.importedFrom = video.importedFrom
this.originallyPublishedAt = video.originallyPublishedAt this.originallyPublishedAt = video.originallyPublishedAt
? new Date(video.originallyPublishedAt) ? new Date(video.originallyPublishedAt)
: null : null
@ -110,6 +112,7 @@ export class VideoEdit implements VideoUpdate {
waitTranscoding: this.waitTranscoding, waitTranscoding: this.waitTranscoding,
channelId: this.channelId, channelId: this.channelId,
privacy: this.privacy, privacy: this.privacy,
importedFrom: this.importedFrom,
originallyPublishedAt: this.originallyPublishedAt originallyPublishedAt: this.originallyPublishedAt
} }

View File

@ -87,6 +87,7 @@ export class VideoService {
const description = video.description || null const description = video.description || null
const support = video.support || null const support = video.support || null
const scheduleUpdate = video.scheduleUpdate || null const scheduleUpdate = video.scheduleUpdate || null
const importedFrom = video.importedFrom || null
const originallyPublishedAt = video.originallyPublishedAt || null const originallyPublishedAt = video.originallyPublishedAt || null
const body: VideoUpdate = { const body: VideoUpdate = {
@ -107,6 +108,7 @@ export class VideoService {
previewfile: video.previewfile, previewfile: video.previewfile,
pluginData: video.pluginData, pluginData: video.pluginData,
scheduleUpdate, scheduleUpdate,
importedFrom,
originallyPublishedAt originallyPublishedAt
} }

View File

@ -77,7 +77,8 @@ async function updateVideo (req: express.Request, res: express.Response) {
'support', 'support',
'description', 'description',
'commentsEnabled', 'commentsEnabled',
'downloadEnabled' 'downloadEnabled',
'importedFrom'
] ]
for (const key of keysToUpdate) { for (const key of keysToUpdate) {

View File

@ -28,6 +28,7 @@ function buildLocalVideoFromReq (videoInfo: VideoCreate, channelId: number): Fil
support: videoInfo.support, support: videoInfo.support,
privacy: videoInfo.privacy || VideoPrivacy.PRIVATE, privacy: videoInfo.privacy || VideoPrivacy.PRIVATE,
channelId, channelId,
importedFrom: null,
originallyPublishedAt: videoInfo.originallyPublishedAt originallyPublishedAt: videoInfo.originallyPublishedAt
? new Date(videoInfo.originallyPublishedAt) ? new Date(videoInfo.originallyPublishedAt)
: null : null

View File

@ -17,6 +17,7 @@ export interface VideoCreate {
downloadEnabled?: boolean downloadEnabled?: boolean
privacy: VideoPrivacy privacy: VideoPrivacy
scheduleUpdate?: VideoScheduleUpdate scheduleUpdate?: VideoScheduleUpdate
importedFrom?: string
originallyPublishedAt?: Date | string originallyPublishedAt?: Date | string
thumbnailfile?: Blob | string thumbnailfile?: Blob | string

View File

@ -18,6 +18,7 @@ export interface VideoUpdate {
thumbnailfile?: Blob thumbnailfile?: Blob
previewfile?: Blob previewfile?: Blob
scheduleUpdate?: VideoScheduleUpdate scheduleUpdate?: VideoScheduleUpdate
importedFrom?: string
originallyPublishedAt?: Date | string originallyPublishedAt?: Date | string
pluginData?: any pluginData?: any

View File

@ -6426,6 +6426,10 @@ components:
format: date-time format: date-time
example: 2021-05-04T08:01:01.502Z example: 2021-05-04T08:01:01.502Z
description: last time the video's metadata was modified description: last time the video's metadata was modified
importedFrom:
type: string
example: https://youtu.be/fe8agy1pb44
description: the URL where this video is imported from
originallyPublishedAt: originallyPublishedAt:
type: string type: string
format: date-time format: date-time