diff options
author | Andrés Maldonado <amaldona@etu.utc.fr> | 2019-01-05 19:55:40 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-12 11:19:19 +0100 |
commit | 84929846e743f4b5f3971b386ea2c447db8c416f (patch) | |
tree | bc774e50d0607137071b6aa23fef88e18dbc9f8c /server/tools/peertube-import-videos.ts | |
parent | 4e553a41fdc67c4da186502522ac99a5ba230453 (diff) | |
download | PeerTube-84929846e743f4b5f3971b386ea2c447db8c416f.tar.gz PeerTube-84929846e743f4b5f3971b386ea2c447db8c416f.tar.zst PeerTube-84929846e743f4b5f3971b386ea2c447db8c416f.zip |
Import original publication date (CLI)
* Import original publication date when importing a video from YouTube using the CLI
* Fix lint issues
Diffstat (limited to 'server/tools/peertube-import-videos.ts')
-rw-r--r-- | server/tools/peertube-import-videos.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 151c5a989..4032c5e0d 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts | |||
@@ -212,6 +212,8 @@ 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) | ||
216 | |||
215 | const videoAttributes = { | 217 | const videoAttributes = { |
216 | name: truncate(videoInfo.title, { | 218 | name: truncate(videoInfo.title, { |
217 | 'length': CONSTRAINTS_FIELDS.VIDEOS.NAME.max, | 219 | 'length': CONSTRAINTS_FIELDS.VIDEOS.NAME.max, |
@@ -231,7 +233,8 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st | |||
231 | privacy: VideoPrivacy.PUBLIC, | 233 | privacy: VideoPrivacy.PUBLIC, |
232 | fixture: videoPath, | 234 | fixture: videoPath, |
233 | thumbnailfile, | 235 | thumbnailfile, |
234 | previewfile: thumbnailfile | 236 | previewfile: thumbnailfile, |
237 | originallyPublishedAt: new Date(date).toISOString() | ||
235 | } | 238 | } |
236 | 239 | ||
237 | console.log('\nUploading on PeerTube video "%s".', videoAttributes.name) | 240 | console.log('\nUploading on PeerTube video "%s".', videoAttributes.name) |