From d7a25329f9e607894d29ab342b9cb66638b56dc0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 15 Nov 2019 15:06:03 +0100 Subject: Add ability to disable webtorrent In favour of HLS --- .../migrations/0065-video-file-size.ts | 3 +- .../migrations/0450-streaming-playlist-files.ts | 40 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 server/initializers/migrations/0450-streaming-playlist-files.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0065-video-file-size.ts b/server/initializers/migrations/0065-video-file-size.ts index 66f25016a..e9ce77e50 100644 --- a/server/initializers/migrations/0065-video-file-size.ts +++ b/server/initializers/migrations/0065-video-file-size.ts @@ -2,6 +2,7 @@ import * as Sequelize from 'sequelize' import * as Promise from 'bluebird' import { stat } from 'fs-extra' import { VideoModel } from '../../models/video/video' +import { getVideoFilePath } from '@server/lib/video-paths' function up (utils: { transaction: Sequelize.Transaction, @@ -16,7 +17,7 @@ function up (utils: { videos.forEach(video => { video.VideoFiles.forEach(videoFile => { const p = new Promise((res, rej) => { - stat(video.getVideoFilePath(videoFile), (err, stats) => { + stat(getVideoFilePath(video, videoFile), (err, stats) => { if (err) return rej(err) videoFile.size = stats.size diff --git a/server/initializers/migrations/0450-streaming-playlist-files.ts b/server/initializers/migrations/0450-streaming-playlist-files.ts new file mode 100644 index 000000000..536ef00f9 --- /dev/null +++ b/server/initializers/migrations/0450-streaming-playlist-files.ts @@ -0,0 +1,40 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize, + db: any +}): Promise { + { + const data = { + type: Sequelize.INTEGER, + allowNull: true, + references: { + model: 'videoStreamingPlaylist', + key: 'id' + }, + onDelete: 'CASCADE' + } + + await utils.queryInterface.addColumn('videoFile', 'videoStreamingPlaylistId', data) + } + + { + const data = { + type: Sequelize.INTEGER, + allowNull: true + } + + await utils.queryInterface.changeColumn('videoFile', 'videoId', data) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3