projects
/
oweals
/
peertube.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'release/1.4.0' into develop
[oweals/peertube.git]
/
server
/
initializers
/
migrations
/
0075-video-resolutions.ts
diff --git
a/server/initializers/migrations/0075-video-resolutions.ts
b/server/initializers/migrations/0075-video-resolutions.ts
index 54ea852b1aadf846f453a4019ace98a953387e55..e4f26cb779748db0fe6dc42738e895f2614af2d8 100644
(file)
--- a/
server/initializers/migrations/0075-video-resolutions.ts
+++ b/
server/initializers/migrations/0075-video-resolutions.ts
@@
-1,9
+1,8
@@
import * as Sequelize from 'sequelize'
import { join } from 'path'
import * as Sequelize from 'sequelize'
import { join } from 'path'
-
-import { readdirPromise, renamePromise } from '../../helpers/core-utils'
-import { CONFIG } from '../../initializers/constants'
+import { CONFIG } from '../../initializers/config'
import { getVideoFileResolution } from '../../helpers/ffmpeg-utils'
import { getVideoFileResolution } from '../../helpers/ffmpeg-utils'
+import { readdir, rename } from 'fs-extra'
function up (utils: {
transaction: Sequelize.Transaction,
function up (utils: {
transaction: Sequelize.Transaction,
@@
-14,7
+13,7
@@
function up (utils: {
const torrentDir = CONFIG.STORAGE.TORRENTS_DIR
const videoFileDir = CONFIG.STORAGE.VIDEOS_DIR
const torrentDir = CONFIG.STORAGE.TORRENTS_DIR
const videoFileDir = CONFIG.STORAGE.VIDEOS_DIR
- return readdir
Promise
(videoFileDir)
+ return readdir(videoFileDir)
.then(videoFiles => {
const tasks: Promise<any>[] = []
for (const videoFile of videoFiles) {
.then(videoFiles => {
const tasks: Promise<any>[] = []
for (const videoFile of videoFiles) {
@@
-31,11
+30,11
@@
function up (utils: {
.then(height => {
const oldTorrentName = uuid + '.torrent'
const newTorrentName = uuid + '-' + height + '.torrent'
.then(height => {
const oldTorrentName = uuid + '.torrent'
const newTorrentName = uuid + '-' + height + '.torrent'
- return rename
Promise
(join(torrentDir, oldTorrentName), join(torrentDir, newTorrentName)).then(() => height)
+ return rename(join(torrentDir, oldTorrentName), join(torrentDir, newTorrentName)).then(() => height)
})
.then(height => {
const newVideoFileName = uuid + '-' + height + '.' + ext
})
.then(height => {
const newVideoFileName = uuid + '-' + height + '.' + ext
- return rename
Promise
(join(videoFileDir, videoFile), join(videoFileDir, newVideoFileName)).then(() => height)
+ return rename(join(videoFileDir, videoFile), join(videoFileDir, newVideoFileName)).then(() => height)
})
.then(height => {
const query = 'UPDATE "VideoFiles" SET "resolution" = ' + height +
})
.then(height => {
const query = 'UPDATE "VideoFiles" SET "resolution" = ' + height +