aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-19 10:37:35 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit9b474844e85cce916370693cc24f53339a695570 (patch)
tree10b1148a7581a2754e336a144c085a05ce72a1db /shared
parent32fe00138990627749da58ff9f845584013aa219 (diff)
downloadPeerTube-9b474844e85cce916370693cc24f53339a695570.tar.gz
PeerTube-9b474844e85cce916370693cc24f53339a695570.tar.zst
PeerTube-9b474844e85cce916370693cc24f53339a695570.zip
Add CLI plugins tests
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/users/users.ts21
-rw-r--r--shared/models/videos/video-resolution.enum.ts53
2 files changed, 41 insertions, 33 deletions
diff --git a/shared/extra-utils/users/users.ts b/shared/extra-utils/users/users.ts
index 5fa8cde0c..30ed1bf4a 100644
--- a/shared/extra-utils/users/users.ts
+++ b/shared/extra-utils/users/users.ts
@@ -6,6 +6,7 @@ import { UserRegister } from '../../models/users/user-register.model'
6import { UserRole } from '../../models/users/user-role' 6import { UserRole } from '../../models/users/user-role'
7import { ServerInfo } from '../server/servers' 7import { ServerInfo } from '../server/servers'
8import { userLogin } from './login' 8import { userLogin } from './login'
9import { UserUpdateMe } from '../../models/users'
9 10
10type CreateUserArgs = { url: string, 11type CreateUserArgs = { url: string,
11 accessToken: string, 12 accessToken: string,
@@ -224,19 +225,21 @@ function updateMyUser (options: {
224 displayName?: string 225 displayName?: string
225 description?: string 226 description?: string
226 videosHistoryEnabled?: boolean 227 videosHistoryEnabled?: boolean
228 theme?: string
227}) { 229}) {
228 const path = '/api/v1/users/me' 230 const path = '/api/v1/users/me'
229 231
230 const toSend = {} 232 const toSend: UserUpdateMe = {}
231 if (options.currentPassword !== undefined && options.currentPassword !== null) toSend['currentPassword'] = options.currentPassword 233 if (options.currentPassword !== undefined && options.currentPassword !== null) toSend.currentPassword = options.currentPassword
232 if (options.newPassword !== undefined && options.newPassword !== null) toSend['password'] = options.newPassword 234 if (options.newPassword !== undefined && options.newPassword !== null) toSend.password = options.newPassword
233 if (options.nsfwPolicy !== undefined && options.nsfwPolicy !== null) toSend['nsfwPolicy'] = options.nsfwPolicy 235 if (options.nsfwPolicy !== undefined && options.nsfwPolicy !== null) toSend.nsfwPolicy = options.nsfwPolicy
234 if (options.autoPlayVideo !== undefined && options.autoPlayVideo !== null) toSend['autoPlayVideo'] = options.autoPlayVideo 236 if (options.autoPlayVideo !== undefined && options.autoPlayVideo !== null) toSend.autoPlayVideo = options.autoPlayVideo
235 if (options.email !== undefined && options.email !== null) toSend['email'] = options.email 237 if (options.email !== undefined && options.email !== null) toSend.email = options.email
236 if (options.description !== undefined && options.description !== null) toSend['description'] = options.description 238 if (options.description !== undefined && options.description !== null) toSend.description = options.description
237 if (options.displayName !== undefined && options.displayName !== null) toSend['displayName'] = options.displayName 239 if (options.displayName !== undefined && options.displayName !== null) toSend.displayName = options.displayName
240 if (options.theme !== undefined && options.theme !== null) toSend.theme = options.theme
238 if (options.videosHistoryEnabled !== undefined && options.videosHistoryEnabled !== null) { 241 if (options.videosHistoryEnabled !== undefined && options.videosHistoryEnabled !== null) {
239 toSend['videosHistoryEnabled'] = options.videosHistoryEnabled 242 toSend.videosHistoryEnabled = options.videosHistoryEnabled
240 } 243 }
241 244
242 return makePutBodyRequest({ 245 return makePutBodyRequest({
diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts
index 51efa2e8b..fa26fc3cc 100644
--- a/shared/models/videos/video-resolution.enum.ts
+++ b/shared/models/videos/video-resolution.enum.ts
@@ -18,30 +18,35 @@ export enum VideoResolution {
18 */ 18 */
19function getBaseBitrate (resolution: VideoResolution) { 19function getBaseBitrate (resolution: VideoResolution) {
20 switch (resolution) { 20 switch (resolution) {
21 case VideoResolution.H_240P: 21 case VideoResolution.H_240P:
22 // quality according to Google Live Encoder: 300 - 700 Kbps 22 // quality according to Google Live Encoder: 300 - 700 Kbps
23 // Quality according to YouTube Video Info: 186 Kbps 23 // Quality according to YouTube Video Info: 186 Kbps
24 return 250 * 1000 24 return 250 * 1000
25 case VideoResolution.H_360P: 25
26 // quality according to Google Live Encoder: 400 - 1,000 Kbps 26 case VideoResolution.H_360P:
27 // Quality according to YouTube Video Info: 480 Kbps 27 // quality according to Google Live Encoder: 400 - 1,000 Kbps
28 return 500 * 1000 28 // Quality according to YouTube Video Info: 480 Kbps
29 case VideoResolution.H_480P: 29 return 500 * 1000
30 // quality according to Google Live Encoder: 500 - 2,000 Kbps 30
31 // Quality according to YouTube Video Info: 879 Kbps 31 case VideoResolution.H_480P:
32 return 900 * 1000 32 // quality according to Google Live Encoder: 500 - 2,000 Kbps
33 case VideoResolution.H_720P: 33 // Quality according to YouTube Video Info: 879 Kbps
34 // quality according to Google Live Encoder: 1,500 - 4,000 Kbps 34 return 900 * 1000
35 // Quality according to YouTube Video Info: 1752 Kbps 35
36 return 1750 * 1000 36 case VideoResolution.H_720P:
37 case VideoResolution.H_1080P: 37 // quality according to Google Live Encoder: 1,500 - 4,000 Kbps
38 // quality according to Google Live Encoder: 3000 - 6000 Kbps 38 // Quality according to YouTube Video Info: 1752 Kbps
39 // Quality according to YouTube Video Info: 3277 Kbps 39 return 1750 * 1000
40 return 3300 * 1000 40
41 case VideoResolution.H_4K: // fallthrough 41 case VideoResolution.H_1080P:
42 default: 42 // quality according to Google Live Encoder: 3000 - 6000 Kbps
43 // quality according to Google Live Encoder: 13000 - 34000 Kbps 43 // Quality according to YouTube Video Info: 3277 Kbps
44 return 15000 * 1000 44 return 3300 * 1000
45
46 case VideoResolution.H_4K: // fallthrough
47 default:
48 // quality according to Google Live Encoder: 13000 - 34000 Kbps
49 return 15000 * 1000
45 } 50 }
46} 51}
47 52