- const newTorrentName = uuid + '-' + height + '.torrent'
- return renamePromise(join(torrentDir, oldTorrentName), join(torrentDir, newTorrentName)).then(() => height)
- })
- .then(height => {
- const newVideoFileName = uuid + '-' + height + '.' + ext
- return renamePromise(join(videoFileDir, videoFile), join(videoFileDir, newVideoFileName)).then(() => height)
- })
- .then(height => {
- const query = 'UPDATE "VideoFiles" SET "resolution" = ' + height +
+ const newTorrentName = uuid + '-' + resolution + '.torrent'
+ await rename(join(torrentDir, oldTorrentName), join(torrentDir, newTorrentName)).then(() => resolution)
+
+ const newVideoFileName = uuid + '-' + resolution + '.' + ext
+ await rename(join(videoFileDir, videoFile), join(videoFileDir, newVideoFileName)).then(() => resolution)
+
+ const query = 'UPDATE "VideoFiles" SET "resolution" = ' + resolution +