aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts15
-rw-r--r--server/initializers/migrations/0530-playlist-multiple-video.ts46
2 files changed, 55 insertions, 6 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 691d29283..c26c3a88c 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -23,7 +23,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
23 23
24// --------------------------------------------------------------------------- 24// ---------------------------------------------------------------------------
25 25
26const LAST_MIGRATION_VERSION = 525 26const LAST_MIGRATION_VERSION = 530
27 27
28// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
29 29
@@ -417,7 +417,9 @@ const MIMETYPES = {
417 'audio/x-ms-wma': '.wma', 417 'audio/x-ms-wma': '.wma',
418 'audio/wav': '.wav', 418 'audio/wav': '.wav',
419 'audio/x-flac': '.flac', 419 'audio/x-flac': '.flac',
420 'audio/flac': '.flac' 420 'audio/flac': '.flac',
421 '‎audio/aac': '.aac',
422 'audio/ac3': '.ac3'
421 }, 423 },
422 EXT_MIMETYPE: null as { [ id: string ]: string } 424 EXT_MIMETYPE: null as { [ id: string ]: string }
423 }, 425 },
@@ -841,7 +843,7 @@ function buildVideoMimetypeExt () {
841 'video/x-matroska': '.mkv', 843 'video/x-matroska': '.mkv',
842 844
843 // Developed by Apple 845 // Developed by Apple
844 'video/quicktime': '.mov', // often used as output format by editing software 846 'video/quicktime': [ '.mov', '.qt', '.mqv' ], // often used as output format by editing software
845 'video/x-m4v': '.m4v', 847 'video/x-m4v': '.m4v',
846 'video/m4v': '.m4v', 848 'video/m4v': '.m4v',
847 849
@@ -856,8 +858,8 @@ function buildVideoMimetypeExt () {
856 858
857 // Developed by 3GPP 859 // Developed by 3GPP
858 // common video formats for cell phones 860 // common video formats for cell phones
859 'video/3gpp': '.3gp', 861 'video/3gpp': [ '.3gp', '.3gpp' ],
860 'video/3gpp2': '.3g2', 862 'video/3gpp2': [ '.3g2', '.3gpp2' ],
861 863
862 // Developed by FFmpeg/Mplayer 864 // Developed by FFmpeg/Mplayer
863 'application/x-nut': '.nut', 865 'application/x-nut': '.nut',
@@ -870,7 +872,8 @@ function buildVideoMimetypeExt () {
870 // Old formats reliant on MPEG-1/MPEG-2 872 // Old formats reliant on MPEG-1/MPEG-2
871 'video/mpv': '.mpv', 873 'video/mpv': '.mpv',
872 'video/mpeg2': '.m2v', 874 'video/mpeg2': '.m2v',
873 'video/mpeg': '.mpeg', 875 'video/mpeg': [ '.m1v', '.mpg', '.mpe', '.mpeg', '.vob' ],
876 'video/dvd': '.vob',
874 877
875 // Could be anything 878 // Could be anything
876 'application/octet-stream': null, 879 'application/octet-stream': null,
diff --git a/server/initializers/migrations/0530-playlist-multiple-video.ts b/server/initializers/migrations/0530-playlist-multiple-video.ts
new file mode 100644
index 000000000..51a8c06b0
--- /dev/null
+++ b/server/initializers/migrations/0530-playlist-multiple-video.ts
@@ -0,0 +1,46 @@
1import * as Sequelize from 'sequelize'
2import { WEBSERVER } from '../constants'
3
4async function up (utils: {
5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize
8}): Promise<void> {
9 {
10 const field = {
11 type: Sequelize.STRING,
12 allowNull: true
13 }
14 await utils.queryInterface.changeColumn('videoPlaylistElement', 'url', field)
15 }
16
17 {
18 await utils.sequelize.query('DROP INDEX IF EXISTS video_playlist_element_video_playlist_id_video_id;')
19 }
20
21 {
22 const selectPlaylistUUID = 'SELECT "uuid" FROM "videoPlaylist" WHERE "id" = "videoPlaylistElement"."videoPlaylistId"'
23 const url = `'${WEBSERVER.URL}' || '/video-playlists/' || (${selectPlaylistUUID}) || '/videos/' || "videoPlaylistElement"."id"`
24
25 const query = `
26 UPDATE "videoPlaylistElement" SET "url" = ${url} WHERE id IN (
27 SELECT "videoPlaylistElement"."id" FROM "videoPlaylistElement"
28 INNER JOIN "videoPlaylist" ON "videoPlaylist".id = "videoPlaylistElement"."videoPlaylistId"
29 INNER JOIN account ON account.id = "videoPlaylist"."ownerAccountId"
30 INNER JOIN actor ON actor.id = account."actorId"
31 WHERE actor."serverId" IS NULL
32 )`
33
34 await utils.sequelize.query(query)
35 }
36
37}
38
39function down (options) {
40 throw new Error('Not implemented.')
41}
42
43export {
44 up,
45 down
46}