X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftools%2Fpeertube-import-videos.ts;h=04e24e81847bbc60ce67a57e6a5e5367ee05f4d4;hb=c74c9be934fa1584edf6f4f7a41f00c4d3f2a8b3;hp=151c5a9896690ffd630d8ae7bc1983aa86e4c06c;hpb=88108880bbdba473cfe36ecbebc1c3c4f972e102;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 151c5a989..04e24e818 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -11,7 +11,7 @@ import { truncate } from 'lodash' import * as prompt from 'prompt' import { remove } from 'fs-extra' import { sha256 } from '../helpers/core-utils' -import { safeGetYoutubeDL } from '../helpers/youtube-dl' +import { safeGetYoutubeDL, buildOriginallyPublishedAt } from '../helpers/youtube-dl' import { getSettings, netrc } from './cli' let accessToken: string @@ -212,6 +212,8 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st }, thumbnailfile) } + const originallyPublishedAt = buildOriginallyPublishedAt(videoInfo) + const videoAttributes = { name: truncate(videoInfo.title, { 'length': CONSTRAINTS_FIELDS.VIDEOS.NAME.max, @@ -231,7 +233,8 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st privacy: VideoPrivacy.PUBLIC, fixture: videoPath, thumbnailfile, - previewfile: thumbnailfile + previewfile: thumbnailfile, + originallyPublishedAt: originallyPublishedAt ? originallyPublishedAt.toISOString() : null } console.log('\nUploading on PeerTube video "%s".', videoAttributes.name)