diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-03-27 21:11:37 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-03-27 21:11:37 +0200 |
commit | d07137b90b2b2b0c1e93a6f0e7bf8719b133027c (patch) | |
tree | 0bb642609819bc1c8ff2761c848f8db3a9934d88 /client/src/app/videos/shared | |
parent | 6f0c39e2de400685b7baf8340b9e132f2659365a (diff) | |
download | PeerTube-d07137b90b2b2b0c1e93a6f0e7bf8719b133027c.tar.gz PeerTube-d07137b90b2b2b0c1e93a6f0e7bf8719b133027c.tar.zst PeerTube-d07137b90b2b2b0c1e93a6f0e7bf8719b133027c.zip |
Client: add support for video licences
Diffstat (limited to 'client/src/app/videos/shared')
-rw-r--r-- | client/src/app/videos/shared/video.model.ts | 3 | ||||
-rw-r--r-- | client/src/app/videos/shared/video.service.ts | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts index b5d96f63a..5ed622dce 100644 --- a/client/src/app/videos/shared/video.model.ts +++ b/client/src/app/videos/shared/video.model.ts | |||
@@ -3,6 +3,7 @@ export class Video { | |||
3 | by: string; | 3 | by: string; |
4 | createdAt: Date; | 4 | createdAt: Date; |
5 | categoryLabel: string; | 5 | categoryLabel: string; |
6 | licenceLabel: string; | ||
6 | description: string; | 7 | description: string; |
7 | duration: string; | 8 | duration: string; |
8 | id: string; | 9 | id: string; |
@@ -33,6 +34,7 @@ export class Video { | |||
33 | author: string, | 34 | author: string, |
34 | createdAt: string, | 35 | createdAt: string, |
35 | categoryLabel: string, | 36 | categoryLabel: string, |
37 | licenceLabel: string, | ||
36 | description: string, | 38 | description: string, |
37 | duration: number; | 39 | duration: number; |
38 | id: string, | 40 | id: string, |
@@ -49,6 +51,7 @@ export class Video { | |||
49 | this.author = hash.author; | 51 | this.author = hash.author; |
50 | this.createdAt = new Date(hash.createdAt); | 52 | this.createdAt = new Date(hash.createdAt); |
51 | this.categoryLabel = hash.categoryLabel; | 53 | this.categoryLabel = hash.categoryLabel; |
54 | this.licenceLabel = hash.licenceLabel; | ||
52 | this.description = hash.description; | 55 | this.description = hash.description; |
53 | this.duration = Video.createDurationString(hash.duration); | 56 | this.duration = Video.createDurationString(hash.duration); |
54 | this.id = hash.id; | 57 | this.id = hash.id; |
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index debc114aa..15f017e33 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts | |||
@@ -23,6 +23,7 @@ export class VideoService { | |||
23 | private static BASE_VIDEO_URL = '/api/v1/videos/'; | 23 | private static BASE_VIDEO_URL = '/api/v1/videos/'; |
24 | 24 | ||
25 | videoCategories: Array<{ id: number, label: string }> = []; | 25 | videoCategories: Array<{ id: number, label: string }> = []; |
26 | videoLicences: Array<{ id: number, label: string }> = []; | ||
26 | 27 | ||
27 | constructor( | 28 | constructor( |
28 | private authService: AuthService, | 29 | private authService: AuthService, |
@@ -45,6 +46,19 @@ export class VideoService { | |||
45 | }); | 46 | }); |
46 | } | 47 | } |
47 | 48 | ||
49 | loadVideoLicences() { | ||
50 | return this.http.get(VideoService.BASE_VIDEO_URL + 'licences') | ||
51 | .map(this.restExtractor.extractDataGet) | ||
52 | .subscribe(data => { | ||
53 | Object.keys(data).forEach(licenceKey => { | ||
54 | this.videoLicences.push({ | ||
55 | id: parseInt(licenceKey), | ||
56 | label: data[licenceKey] | ||
57 | }); | ||
58 | }); | ||
59 | }); | ||
60 | } | ||
61 | |||
48 | getVideo(id: string): Observable<Video> { | 62 | getVideo(id: string): Observable<Video> { |
49 | return this.http.get(VideoService.BASE_VIDEO_URL + id) | 63 | return this.http.get(VideoService.BASE_VIDEO_URL + id) |
50 | .map(this.restExtractor.extractDataGet) | 64 | .map(this.restExtractor.extractDataGet) |