aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-12 11:47:23 +0100
committerChocobozzz <me@florianbigard.com>2019-02-12 11:47:23 +0100
commitc74c9be934fa1584edf6f4f7a41f00c4d3f2a8b3 (patch)
tree42370ebba95a968b45e59bbc81ae40947b541174 /server/tools
parent84929846e743f4b5f3971b386ea2c447db8c416f (diff)
downloadPeerTube-c74c9be934fa1584edf6f4f7a41f00c4d3f2a8b3.tar.gz
PeerTube-c74c9be934fa1584edf6f4f7a41f00c4d3f2a8b3.tar.zst
PeerTube-c74c9be934fa1584edf6f4f7a41f00c4d3f2a8b3.zip
Refractor published date on video import
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/peertube-import-videos.ts6
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'
11import * as prompt from 'prompt' 11import * as prompt from 'prompt'
12import { remove } from 'fs-extra' 12import { remove } from 'fs-extra'
13import { sha256 } from '../helpers/core-utils' 13import { sha256 } from '../helpers/core-utils'
14import { safeGetYoutubeDL } from '../helpers/youtube-dl' 14import { safeGetYoutubeDL, buildOriginallyPublishedAt } from '../helpers/youtube-dl'
15import { getSettings, netrc } from './cli' 15import { getSettings, netrc } from './cli'
16 16
17let accessToken: string 17let 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)