diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-17 10:33:36 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-17 10:33:36 +0200 |
commit | 66a7fc947321b923fa1e7182202e03d0e21ffb3e (patch) | |
tree | 5cb913531d3b84d0f2d4bbcc0d34f0a9a6435bc5 /server | |
parent | 0305db28c98fd6cf43a3c50ba92c76215e99d512 (diff) | |
download | PeerTube-66a7fc947321b923fa1e7182202e03d0e21ffb3e.tar.gz PeerTube-66a7fc947321b923fa1e7182202e03d0e21ffb3e.tar.zst PeerTube-66a7fc947321b923fa1e7182202e03d0e21ffb3e.zip |
Remove optimize old videos script
It is not compatible with HLS and I don't have time to maintain it
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/object-storage/keys.ts | 2 | ||||
-rw-r--r-- | server/tests/cli/index.ts | 1 | ||||
-rw-r--r-- | server/tests/cli/optimize-old-videos.ts | 96 |
3 files changed, 1 insertions, 98 deletions
diff --git a/server/lib/object-storage/keys.ts b/server/lib/object-storage/keys.ts index 519474775..12acb3aec 100644 --- a/server/lib/object-storage/keys.ts +++ b/server/lib/object-storage/keys.ts | |||
@@ -6,7 +6,7 @@ function generateHLSObjectStorageKey (playlist: MStreamingPlaylist, video: MVide | |||
6 | } | 6 | } |
7 | 7 | ||
8 | function generateHLSObjectBaseStorageKey (playlist: MStreamingPlaylist, video: MVideoUUID) { | 8 | function generateHLSObjectBaseStorageKey (playlist: MStreamingPlaylist, video: MVideoUUID) { |
9 | return playlist.getStringType() + '_' + video.uuid | 9 | return join(playlist.getStringType(), video.uuid) |
10 | } | 10 | } |
11 | 11 | ||
12 | function generateWebTorrentObjectStorageKey (filename: string) { | 12 | function generateWebTorrentObjectStorageKey (filename: string) { |
diff --git a/server/tests/cli/index.ts b/server/tests/cli/index.ts index 7e6eebd17..c6dd0581a 100644 --- a/server/tests/cli/index.ts +++ b/server/tests/cli/index.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | // Order of the tests we want to execute | 1 | // Order of the tests we want to execute |
2 | import './create-import-video-file-job' | 2 | import './create-import-video-file-job' |
3 | import './create-transcoding-job' | 3 | import './create-transcoding-job' |
4 | import './optimize-old-videos' | ||
5 | import './peertube' | 4 | import './peertube' |
6 | import './plugins' | 5 | import './plugins' |
7 | import './print-transcode-command' | 6 | import './print-transcode-command' |
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts deleted file mode 100644 index 9b75ae164..000000000 --- a/server/tests/cli/optimize-old-videos.ts +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import 'mocha' | ||
4 | import * as chai from 'chai' | ||
5 | import { getMaxBitrate } from '@shared/core-utils' | ||
6 | import { | ||
7 | cleanupTests, | ||
8 | createMultipleServers, | ||
9 | doubleFollow, | ||
10 | generateHighBitrateVideo, | ||
11 | PeerTubeServer, | ||
12 | setAccessTokensToServers, | ||
13 | wait, | ||
14 | waitJobs | ||
15 | } from '@shared/extra-utils' | ||
16 | import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffprobe-utils' | ||
17 | |||
18 | const expect = chai.expect | ||
19 | |||
20 | describe('Test optimize old videos', function () { | ||
21 | let servers: PeerTubeServer[] = [] | ||
22 | |||
23 | before(async function () { | ||
24 | this.timeout(200000) | ||
25 | |||
26 | // Run server 2 to have transcoding enabled | ||
27 | servers = await createMultipleServers(2) | ||
28 | await setAccessTokensToServers(servers) | ||
29 | |||
30 | await doubleFollow(servers[0], servers[1]) | ||
31 | |||
32 | const tempFixturePath = await generateHighBitrateVideo() | ||
33 | |||
34 | // Upload two videos for our needs | ||
35 | await servers[0].videos.upload({ attributes: { name: 'video1', fixture: tempFixturePath } }) | ||
36 | await servers[0].videos.upload({ attributes: { name: 'video2', fixture: tempFixturePath } }) | ||
37 | |||
38 | await waitJobs(servers) | ||
39 | }) | ||
40 | |||
41 | it('Should have two video files on each server', async function () { | ||
42 | this.timeout(30000) | ||
43 | |||
44 | for (const server of servers) { | ||
45 | const { data } = await server.videos.list() | ||
46 | expect(data).to.have.lengthOf(2) | ||
47 | |||
48 | for (const video of data) { | ||
49 | const videoDetails = await server.videos.get({ id: video.uuid }) | ||
50 | expect(videoDetails.files).to.have.lengthOf(1) | ||
51 | } | ||
52 | } | ||
53 | }) | ||
54 | |||
55 | it('Should run optimize script', async function () { | ||
56 | this.timeout(200000) | ||
57 | |||
58 | await servers[0].cli.execWithEnv('npm run optimize-old-videos') | ||
59 | await waitJobs(servers) | ||
60 | |||
61 | for (const server of servers) { | ||
62 | const { data } = await server.videos.list() | ||
63 | expect(data).to.have.lengthOf(2) | ||
64 | |||
65 | for (const video of data) { | ||
66 | await server.videos.view({ id: video.uuid }) | ||
67 | |||
68 | // Refresh video | ||
69 | await waitJobs(servers) | ||
70 | await wait(5000) | ||
71 | await waitJobs(servers) | ||
72 | |||
73 | const videoDetails = await server.videos.get({ id: video.uuid }) | ||
74 | |||
75 | expect(videoDetails.files).to.have.lengthOf(1) | ||
76 | const file = videoDetails.files[0] | ||
77 | |||
78 | expect(file.size).to.be.below(8000000) | ||
79 | |||
80 | const path = servers[0].servers.buildWebTorrentFilePath(file.fileUrl) | ||
81 | const bitrate = await getVideoFileBitrate(path) | ||
82 | const fps = await getVideoFileFPS(path) | ||
83 | const data = await getVideoFileResolution(path) | ||
84 | |||
85 | expect(data.resolution).to.equal(file.resolution.id) | ||
86 | |||
87 | const maxBitrate = getMaxBitrate({ ...data, fps }) | ||
88 | expect(bitrate).to.be.below(maxBitrate) | ||
89 | } | ||
90 | } | ||
91 | }) | ||
92 | |||
93 | after(async function () { | ||
94 | await cleanupTests(servers) | ||
95 | }) | ||
96 | }) | ||