diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-12 11:47:23 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-12 11:47:23 +0100 |
commit | c74c9be934fa1584edf6f4f7a41f00c4d3f2a8b3 (patch) | |
tree | 42370ebba95a968b45e59bbc81ae40947b541174 /server/tools/peertube-import-videos.ts | |
parent | 84929846e743f4b5f3971b386ea2c447db8c416f (diff) | |
download | PeerTube-c74c9be934fa1584edf6f4f7a41f00c4d3f2a8b3.tar.gz PeerTube-c74c9be934fa1584edf6f4f7a41f00c4d3f2a8b3.tar.zst PeerTube-c74c9be934fa1584edf6f4f7a41f00c4d3f2a8b3.zip |
Refractor published date on video import
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) |