aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/tools/peertube-import-videos.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index 13090a028..21505b79d 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -10,6 +10,7 @@ import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo
10import { truncate } from 'lodash' 10import { 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 { safeGetYoutubeDL } from '../helpers/youtube-dl' 14import { safeGetYoutubeDL } from '../helpers/youtube-dl'
14import { getSettings, netrc } from './cli' 15import { getSettings, netrc } from './cli'
15 16
@@ -133,8 +134,7 @@ async function run (user, url: string) {
133 await processVideo(info, program['language'], processOptions.cwd, url, user) 134 await processVideo(info, program['language'], processOptions.cwd, url, user)
134 } 135 }
135 136
136 // https://www.youtube.com/watch?v=2Upx39TBc1s 137 console.log('Video/s for user %s imported: %s', program['username'], program['targetUrl'])
137 console.log('I\'m finished!')
138 process.exit(0) 138 process.exit(0)
139 }) 139 })
140} 140}
@@ -155,7 +155,7 @@ function processVideo (info: any, languageCode: string, cwd: string, url: string
155 return res() 155 return res()
156 } 156 }
157 157
158 const path = join(cwd, new Date().getTime() + '.mp4') 158 const path = join(cwd, sha256(videoInfo.url) + '.mp4')
159 159
160 console.log('Downloading video "%s"...', videoInfo.title) 160 console.log('Downloading video "%s"...', videoInfo.title)
161 161
@@ -192,7 +192,7 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st
192 192
193 let thumbnailfile 193 let thumbnailfile
194 if (videoInfo.thumbnail) { 194 if (videoInfo.thumbnail) {
195 thumbnailfile = join(cwd, 'thumbnail.jpg') 195 thumbnailfile = join(cwd, sha256(videoInfo.thumbnail) + '.jpg')
196 196
197 await doRequestAndSaveToFile({ 197 await doRequestAndSaveToFile({
198 method: 'GET', 198 method: 'GET',