aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-27 16:23:34 +0200
committerChocobozzz <me@florianbigard.com>2018-08-27 16:23:34 +0200
commit62689b942b71cd1dd0d050c6ed05f884a0b325c2 (patch)
treec45c35d35d7a3e32621fba06edc63646930c8efd /server/tools
parent84b6dbcc6e8654f39ec798905e1151ba915cd1aa (diff)
downloadPeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.tar.gz
PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.tar.zst
PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.zip
Correctly migrate to fs-extra
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/import-videos.ts8
-rw-r--r--server/tools/upload.ts5
2 files changed, 4 insertions, 9 deletions
diff --git a/server/tools/import-videos.ts b/server/tools/import-videos.ts
index e49fbb2f5..812600f8b 100644
--- a/server/tools/import-videos.ts
+++ b/server/tools/import-videos.ts
@@ -5,12 +5,12 @@ import * as program from 'commander'
5import { join } from 'path' 5import { join } from 'path'
6import * as youtubeDL from 'youtube-dl' 6import * as youtubeDL from 'youtube-dl'
7import { VideoPrivacy } from '../../shared/models/videos' 7import { VideoPrivacy } from '../../shared/models/videos'
8import { unlinkPromise } from '../helpers/core-utils'
9import { doRequestAndSaveToFile } from '../helpers/requests' 8import { doRequestAndSaveToFile } from '../helpers/requests'
10import { CONSTRAINTS_FIELDS } from '../initializers' 9import { CONSTRAINTS_FIELDS } from '../initializers'
11import { getClient, getVideoCategories, login, searchVideo, uploadVideo } from '../tests/utils' 10import { getClient, getVideoCategories, login, searchVideo, uploadVideo } from '../tests/utils'
12import { truncate } from 'lodash' 11import { truncate } from 'lodash'
13import * as prompt from 'prompt' 12import * as prompt from 'prompt'
13import { remove } from 'fs-extra'
14 14
15program 15program
16 .option('-u, --url <url>', 'Server url') 16 .option('-u, --url <url>', 'Server url')
@@ -204,10 +204,8 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, languag
204 } 204 }
205 } 205 }
206 206
207 await unlinkPromise(videoPath) 207 await remove(videoPath)
208 if (thumbnailfile) { 208 if (thumbnailfile) await remove(thumbnailfile)
209 await unlinkPromise(thumbnailfile)
210 }
211 209
212 console.log('Uploaded video "%s"!\n', videoAttributes.name) 210 console.log('Uploaded video "%s"!\n', videoAttributes.name)
213} 211}
diff --git a/server/tools/upload.ts b/server/tools/upload.ts
index b5630bb9c..796a0f723 100644
--- a/server/tools/upload.ts
+++ b/server/tools/upload.ts
@@ -1,13 +1,10 @@
1import * as program from 'commander' 1import * as program from 'commander'
2import { access, constants } from 'fs-extra' 2import { access, constants } from 'fs-extra'
3import { isAbsolute } from 'path' 3import { isAbsolute } from 'path'
4import { promisify } from 'util'
5import { getClient, login } from '../tests/utils' 4import { getClient, login } from '../tests/utils'
6import { uploadVideo } from '../tests/utils/index' 5import { uploadVideo } from '../tests/utils/index'
7import { VideoPrivacy } from '../../shared/models/videos' 6import { VideoPrivacy } from '../../shared/models/videos'
8 7
9const accessPromise = promisify(access)
10
11program 8program
12 .option('-u, --url <url>', 'Server url') 9 .option('-u, --url <url>', 'Server url')
13 .option('-U, --username <username>', 'Username') 10 .option('-U, --username <username>', 'Username')
@@ -68,7 +65,7 @@ async function run () {
68 const res2 = await login(program[ 'url' ], client, user) 65 const res2 = await login(program[ 'url' ], client, user)
69 const accessToken = res2.body.access_token 66 const accessToken = res2.body.access_token
70 67
71 await accessPromise(program[ 'file' ], constants.F_OK) 68 await access(program[ 'file' ], constants.F_OK)
72 69
73 console.log('Uploading %s video...', program[ 'videoName' ]) 70 console.log('Uploading %s video...', program[ 'videoName' ])
74 71