X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-import.ts;h=9bc0f17f53efaa52b810a4678bb60aa38b41909e;hb=9c6ca37fc1512a99d420ea90707cebcd06cdc970;hp=9d1f783c75e3a91d6cd647544ec13d89b15e2b0e;hpb=268eebed921ac13a9ce0f4717f4923aa24190657;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts index 9d1f783c7..9bc0f17f5 100644 --- a/server/models/video/video-import.ts +++ b/server/models/video/video-import.ts @@ -115,7 +115,7 @@ export class VideoImportModel extends Model { } static loadAndPopulateVideo (id: number) { - return VideoImportModel.findById(id) + return VideoImportModel.findByPk(id) } static listUserVideoImportsForApi (userId: number, start: number, count: number, sort: string) { @@ -144,14 +144,17 @@ export class VideoImportModel extends Model { }) } + getTargetIdentifier () { + return this.targetUrl || this.magnetUri || this.torrentName + } + toFormattedJSON (): VideoImport { const videoFormatOptions = { + completeDescription: true, additionalAttributes: { state: true, waitTranscoding: true, scheduledUpdate: true } } const video = this.Video - ? Object.assign(this.Video.toFormattedJSON(videoFormatOptions), { - tags: this.Video.Tags.map(t => t.name) - }) + ? Object.assign(this.Video.toFormattedJSON(videoFormatOptions), { tags: this.Video.Tags.map(t => t.name) }) : undefined return {