diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/core-utils/common/object.ts | 5 | ||||
-rw-r--r-- | shared/core-utils/videos/bitrate.ts | 2 | ||||
-rw-r--r-- | shared/core-utils/videos/index.ts | 1 | ||||
-rw-r--r-- | shared/extra-utils/index.ts | 1 | ||||
-rw-r--r-- | shared/extra-utils/uuid.ts (renamed from shared/core-utils/videos/uuid.ts) | 0 | ||||
-rw-r--r-- | shared/server-commands/videos/videos-command.ts | 3 |
6 files changed, 9 insertions, 3 deletions
diff --git a/shared/core-utils/common/object.ts b/shared/core-utils/common/object.ts index 88d6b7514..49d209819 100644 --- a/shared/core-utils/common/object.ts +++ b/shared/core-utils/common/object.ts | |||
@@ -10,6 +10,10 @@ function pick <O extends object, K extends keyof O> (object: O, keys: K[]): Pick | |||
10 | return result | 10 | return result |
11 | } | 11 | } |
12 | 12 | ||
13 | function getKeys <O extends object, K extends keyof O> (object: O, keys: K[]): K[] { | ||
14 | return (Object.keys(object) as K[]).filter(k => keys.includes(k)) | ||
15 | } | ||
16 | |||
13 | function sortObjectComparator (key: string, order: 'asc' | 'desc') { | 17 | function sortObjectComparator (key: string, order: 'asc' | 'desc') { |
14 | return (a: any, b: any) => { | 18 | return (a: any, b: any) => { |
15 | if (a[key] < b[key]) { | 19 | if (a[key] < b[key]) { |
@@ -26,5 +30,6 @@ function sortObjectComparator (key: string, order: 'asc' | 'desc') { | |||
26 | 30 | ||
27 | export { | 31 | export { |
28 | pick, | 32 | pick, |
33 | getKeys, | ||
29 | sortObjectComparator | 34 | sortObjectComparator |
30 | } | 35 | } |
diff --git a/shared/core-utils/videos/bitrate.ts b/shared/core-utils/videos/bitrate.ts index c1891188f..30d22df09 100644 --- a/shared/core-utils/videos/bitrate.ts +++ b/shared/core-utils/videos/bitrate.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { VideoResolution } from "@shared/models" | 1 | import { VideoResolution } from '@shared/models' |
2 | 2 | ||
3 | type BitPerPixel = { [ id in VideoResolution ]: number } | 3 | type BitPerPixel = { [ id in VideoResolution ]: number } |
4 | 4 | ||
diff --git a/shared/core-utils/videos/index.ts b/shared/core-utils/videos/index.ts index 8f6736d39..620e3a716 100644 --- a/shared/core-utils/videos/index.ts +++ b/shared/core-utils/videos/index.ts | |||
@@ -1,3 +1,2 @@ | |||
1 | export * from './bitrate' | 1 | export * from './bitrate' |
2 | export * from './privacy' | 2 | export * from './privacy' |
3 | export * from './uuid' | ||
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index 373d27cb4..e2e161a7b 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './crypto' | 1 | export * from './crypto' |
2 | export * from './ffprobe' | 2 | export * from './ffprobe' |
3 | export * from './file' | 3 | export * from './file' |
4 | export * from './uuid' | ||
diff --git a/shared/core-utils/videos/uuid.ts b/shared/extra-utils/uuid.ts index f3c80e046..f3c80e046 100644 --- a/shared/core-utils/videos/uuid.ts +++ b/shared/extra-utils/uuid.ts | |||
diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts index ead57b9aa..21753ddc4 100644 --- a/shared/server-commands/videos/videos-command.ts +++ b/shared/server-commands/videos/videos-command.ts | |||
@@ -5,7 +5,8 @@ import { createReadStream, stat } from 'fs-extra' | |||
5 | import got, { Response as GotResponse } from 'got' | 5 | import got, { Response as GotResponse } from 'got' |
6 | import { omit } from 'lodash' | 6 | import { omit } from 'lodash' |
7 | import validator from 'validator' | 7 | import validator from 'validator' |
8 | import { buildAbsoluteFixturePath, buildUUID, pick, wait } from '@shared/core-utils' | 8 | import { buildAbsoluteFixturePath, pick, wait } from '@shared/core-utils' |
9 | import { buildUUID } from '@shared/extra-utils' | ||
9 | import { | 10 | import { |
10 | HttpStatusCode, | 11 | HttpStatusCode, |
11 | ResultList, | 12 | ResultList, |