aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/helpers/youtube-dl.ts2
-rw-r--r--server/tools/peertube-import-videos.ts5
-rw-r--r--shared/utils/videos/videos.ts5
3 files changed, 10 insertions, 2 deletions
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts
index 4d4b37ef9..a5ab92df0 100644
--- a/server/helpers/youtube-dl.ts
+++ b/server/helpers/youtube-dl.ts
@@ -175,7 +175,7 @@ function normalizeObject (obj: any) {
175 175
176function buildVideoInfo (obj: any) { 176function buildVideoInfo (obj: any) {
177 177
178 const date = obj.upload_date.slice(0,4)+","+obj.upload_date.slice(4,6)+","+obj.upload_date.slice(6,8) 178 const date = obj.upload_date.slice(0,4) + ',' + obj.upload_date.slice(4,6) + ',' + obj.upload_date.slice(6,8)
179 179
180 return { 180 return {
181 name: titleTruncation(obj.title), 181 name: titleTruncation(obj.title),
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)
diff --git a/shared/utils/videos/videos.ts b/shared/utils/videos/videos.ts
index 16ecbfe84..92dadfb69 100644
--- a/shared/utils/videos/videos.ts
+++ b/shared/utils/videos/videos.ts
@@ -42,6 +42,7 @@ type VideoAttributes = {
42 updateAt: string 42 updateAt: string
43 privacy?: VideoPrivacy 43 privacy?: VideoPrivacy
44 } 44 }
45 originallyPublishedAt?: string
45} 46}
46 47
47function getVideoCategories (url: string) { 48function getVideoCategories (url: string) {
@@ -373,6 +374,10 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
373 } 374 }
374 } 375 }
375 376
377 if (attributes.originallyPublishedAt !== undefined) {
378 req.field('originallyPublishedAt', attributes.originallyPublishedAt)
379 }
380
376 return req.attach('videofile', buildAbsoluteFixturePath(attributes.fixture)) 381 return req.attach('videofile', buildAbsoluteFixturePath(attributes.fixture))
377 .expect(specialStatus) 382 .expect(specialStatus)
378} 383}