diff options
Diffstat (limited to 'server/tools/peertube-import-videos.ts')
-rw-r--r-- | server/tools/peertube-import-videos.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 4032c5e0d..04e24e818 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts | |||
@@ -11,7 +11,7 @@ import { truncate } from 'lodash' | |||
11 | import * as prompt from 'prompt' | 11 | import * as prompt from 'prompt' |
12 | import { remove } from 'fs-extra' | 12 | import { remove } from 'fs-extra' |
13 | import { sha256 } from '../helpers/core-utils' | 13 | import { sha256 } from '../helpers/core-utils' |
14 | import { safeGetYoutubeDL } from '../helpers/youtube-dl' | 14 | import { safeGetYoutubeDL, buildOriginallyPublishedAt } from '../helpers/youtube-dl' |
15 | import { getSettings, netrc } from './cli' | 15 | import { getSettings, netrc } from './cli' |
16 | 16 | ||
17 | let accessToken: string | 17 | let accessToken: string |
@@ -212,7 +212,7 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st | |||
212 | }, thumbnailfile) | 212 | }, thumbnailfile) |
213 | } | 213 | } |
214 | 214 | ||
215 | const date = videoInfo.upload_date.slice(0,4) + ',' + videoInfo.upload_date.slice(4,6) + ',' + videoInfo.upload_date.slice(6,8) | 215 | const originallyPublishedAt = buildOriginallyPublishedAt(videoInfo) |
216 | 216 | ||
217 | const videoAttributes = { | 217 | const videoAttributes = { |
218 | name: truncate(videoInfo.title, { | 218 | name: truncate(videoInfo.title, { |
@@ -234,7 +234,7 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st | |||
234 | fixture: videoPath, | 234 | fixture: videoPath, |
235 | thumbnailfile, | 235 | thumbnailfile, |
236 | previewfile: thumbnailfile, | 236 | previewfile: thumbnailfile, |
237 | originallyPublishedAt: new Date(date).toISOString() | 237 | originallyPublishedAt: originallyPublishedAt ? originallyPublishedAt.toISOString() : null |
238 | } | 238 | } |
239 | 239 | ||
240 | console.log('\nUploading on PeerTube video "%s".', videoAttributes.name) | 240 | console.log('\nUploading on PeerTube video "%s".', videoAttributes.name) |