aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/shared
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-04-07 14:57:05 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-04-07 14:57:05 +0200
commitdb216afd980846c418a4ebab8190c3ead561dfc1 (patch)
tree4542ab1e5c9b4d750f5877e22b1de627892564d2 /client/src/app/videos/shared
parent3092476e64d09b449b4ad4f5198024afec1b22ca (diff)
downloadPeerTube-db216afd980846c418a4ebab8190c3ead561dfc1.tar.gz
PeerTube-db216afd980846c418a4ebab8190c3ead561dfc1.tar.zst
PeerTube-db216afd980846c418a4ebab8190c3ead561dfc1.zip
Client: support video language
Diffstat (limited to 'client/src/app/videos/shared')
-rw-r--r--client/src/app/videos/shared/video.model.ts3
-rw-r--r--client/src/app/videos/shared/video.service.ts14
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 3c588c446..f135ca707 100644
--- a/client/src/app/videos/shared/video.model.ts
+++ b/client/src/app/videos/shared/video.model.ts
@@ -6,6 +6,7 @@ export class Video {
6 createdAt: Date; 6 createdAt: Date;
7 categoryLabel: string; 7 categoryLabel: string;
8 licenceLabel: string; 8 licenceLabel: string;
9 languageLabel: string;
9 description: string; 10 description: string;
10 duration: string; 11 duration: string;
11 id: string; 12 id: string;
@@ -38,6 +39,7 @@ export class Video {
38 createdAt: string, 39 createdAt: string,
39 categoryLabel: string, 40 categoryLabel: string,
40 licenceLabel: string, 41 licenceLabel: string,
42 languageLabel: string;
41 description: string, 43 description: string,
42 duration: number; 44 duration: number;
43 id: string, 45 id: string,
@@ -56,6 +58,7 @@ export class Video {
56 this.createdAt = new Date(hash.createdAt); 58 this.createdAt = new Date(hash.createdAt);
57 this.categoryLabel = hash.categoryLabel; 59 this.categoryLabel = hash.categoryLabel;
58 this.licenceLabel = hash.licenceLabel; 60 this.licenceLabel = hash.licenceLabel;
61 this.languageLabel = hash.languageLabel;
59 this.description = hash.description; 62 this.description = hash.description;
60 this.duration = Video.createDurationString(hash.duration); 63 this.duration = Video.createDurationString(hash.duration);
61 this.id = hash.id; 64 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 15f017e33..13d4ca246 100644
--- a/client/src/app/videos/shared/video.service.ts
+++ b/client/src/app/videos/shared/video.service.ts
@@ -24,6 +24,7 @@ export class VideoService {
24 24
25 videoCategories: Array<{ id: number, label: string }> = []; 25 videoCategories: Array<{ id: number, label: string }> = [];
26 videoLicences: Array<{ id: number, label: string }> = []; 26 videoLicences: Array<{ id: number, label: string }> = [];
27 videoLanguages: Array<{ id: number, label: string }> = [];
27 28
28 constructor( 29 constructor(
29 private authService: AuthService, 30 private authService: AuthService,
@@ -59,6 +60,19 @@ export class VideoService {
59 }); 60 });
60 } 61 }
61 62
63 loadVideoLanguages() {
64 return this.http.get(VideoService.BASE_VIDEO_URL + 'languages')
65 .map(this.restExtractor.extractDataGet)
66 .subscribe(data => {
67 Object.keys(data).forEach(languageKey => {
68 this.videoLanguages.push({
69 id: parseInt(languageKey),
70 label: data[languageKey]
71 });
72 });
73 });
74 }
75
62 getVideo(id: string): Observable<Video> { 76 getVideo(id: string): Observable<Video> {
63 return this.http.get(VideoService.BASE_VIDEO_URL + id) 77 return this.http.get(VideoService.BASE_VIDEO_URL + id)
64 .map(this.restExtractor.extractDataGet) 78 .map(this.restExtractor.extractDataGet)