diff options
Diffstat (limited to 'client/src/app/videos/shared')
-rw-r--r-- | client/src/app/videos/shared/video.model.ts | 7 | ||||
-rw-r--r-- | client/src/app/videos/shared/video.service.ts | 18 |
2 files changed, 14 insertions, 11 deletions
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts index f5e16fc13..9ed6a0641 100644 --- a/client/src/app/videos/shared/video.model.ts +++ b/client/src/app/videos/shared/video.model.ts | |||
@@ -14,7 +14,8 @@ export class Video implements VideoServerModel { | |||
14 | description: string | 14 | description: string |
15 | duration: number | 15 | duration: number |
16 | durationLabel: string | 16 | durationLabel: string |
17 | id: string | 17 | id: number |
18 | uuid: string | ||
18 | isLocal: boolean | 19 | isLocal: boolean |
19 | magnetUri: string | 20 | magnetUri: string |
20 | name: string | 21 | name: string |
@@ -51,7 +52,8 @@ export class Video implements VideoServerModel { | |||
51 | language: number | 52 | language: number |
52 | description: string, | 53 | description: string, |
53 | duration: number | 54 | duration: number |
54 | id: string, | 55 | id: number, |
56 | uuid: string, | ||
55 | isLocal: boolean, | 57 | isLocal: boolean, |
56 | magnetUri: string, | 58 | magnetUri: string, |
57 | name: string, | 59 | name: string, |
@@ -75,6 +77,7 @@ export class Video implements VideoServerModel { | |||
75 | this.duration = hash.duration | 77 | this.duration = hash.duration |
76 | this.durationLabel = Video.createDurationString(hash.duration) | 78 | this.durationLabel = Video.createDurationString(hash.duration) |
77 | this.id = hash.id | 79 | this.id = hash.id |
80 | this.uuid = hash.uuid | ||
78 | this.isLocal = hash.isLocal | 81 | this.isLocal = hash.isLocal |
79 | this.magnetUri = hash.magnetUri | 82 | this.magnetUri = hash.magnetUri |
80 | this.name = hash.name | 83 | this.name = hash.name |
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index dc12c0637..67091a8d8 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts | |||
@@ -52,8 +52,8 @@ export class VideoService { | |||
52 | return this.loadVideoAttributeEnum('languages', this.videoLanguages) | 52 | return this.loadVideoAttributeEnum('languages', this.videoLanguages) |
53 | } | 53 | } |
54 | 54 | ||
55 | getVideo (id: string): Observable<Video> { | 55 | getVideo (uuid: string): Observable<Video> { |
56 | return this.http.get(VideoService.BASE_VIDEO_URL + id) | 56 | return this.http.get(VideoService.BASE_VIDEO_URL + uuid) |
57 | .map(this.restExtractor.extractDataGet) | 57 | .map(this.restExtractor.extractDataGet) |
58 | .map(videoHash => new Video(videoHash)) | 58 | .map(videoHash => new Video(videoHash)) |
59 | .catch((res) => this.restExtractor.handleError(res)) | 59 | .catch((res) => this.restExtractor.handleError(res)) |
@@ -89,7 +89,7 @@ export class VideoService { | |||
89 | .catch((res) => this.restExtractor.handleError(res)) | 89 | .catch((res) => this.restExtractor.handleError(res)) |
90 | } | 90 | } |
91 | 91 | ||
92 | removeVideo (id: string) { | 92 | removeVideo (id: number) { |
93 | return this.authHttp.delete(VideoService.BASE_VIDEO_URL + id) | 93 | return this.authHttp.delete(VideoService.BASE_VIDEO_URL + id) |
94 | .map(this.restExtractor.extractDataBool) | 94 | .map(this.restExtractor.extractDataBool) |
95 | .catch((res) => this.restExtractor.handleError(res)) | 95 | .catch((res) => this.restExtractor.handleError(res)) |
@@ -106,7 +106,7 @@ export class VideoService { | |||
106 | .catch((res) => this.restExtractor.handleError(res)) | 106 | .catch((res) => this.restExtractor.handleError(res)) |
107 | } | 107 | } |
108 | 108 | ||
109 | reportVideo (id: string, reason: string) { | 109 | reportVideo (id: number, reason: string) { |
110 | const url = VideoService.BASE_VIDEO_URL + id + '/abuse' | 110 | const url = VideoService.BASE_VIDEO_URL + id + '/abuse' |
111 | const body: VideoAbuseCreate = { | 111 | const body: VideoAbuseCreate = { |
112 | reason | 112 | reason |
@@ -117,15 +117,15 @@ export class VideoService { | |||
117 | .catch((res) => this.restExtractor.handleError(res)) | 117 | .catch((res) => this.restExtractor.handleError(res)) |
118 | } | 118 | } |
119 | 119 | ||
120 | setVideoLike (id: string) { | 120 | setVideoLike (id: number) { |
121 | return this.setVideoRate(id, 'like') | 121 | return this.setVideoRate(id, 'like') |
122 | } | 122 | } |
123 | 123 | ||
124 | setVideoDislike (id: string) { | 124 | setVideoDislike (id: number) { |
125 | return this.setVideoRate(id, 'dislike') | 125 | return this.setVideoRate(id, 'dislike') |
126 | } | 126 | } |
127 | 127 | ||
128 | getUserVideoRating (id: string): Observable<UserVideoRate> { | 128 | getUserVideoRating (id: number): Observable<UserVideoRate> { |
129 | const url = UserService.BASE_USERS_URL + '/me/videos/' + id + '/rating' | 129 | const url = UserService.BASE_USERS_URL + '/me/videos/' + id + '/rating' |
130 | 130 | ||
131 | return this.authHttp.get(url) | 131 | return this.authHttp.get(url) |
@@ -133,13 +133,13 @@ export class VideoService { | |||
133 | .catch((res) => this.restExtractor.handleError(res)) | 133 | .catch((res) => this.restExtractor.handleError(res)) |
134 | } | 134 | } |
135 | 135 | ||
136 | blacklistVideo (id: string) { | 136 | blacklistVideo (id: number) { |
137 | return this.authHttp.post(VideoService.BASE_VIDEO_URL + id + '/blacklist', {}) | 137 | return this.authHttp.post(VideoService.BASE_VIDEO_URL + id + '/blacklist', {}) |
138 | .map(this.restExtractor.extractDataBool) | 138 | .map(this.restExtractor.extractDataBool) |
139 | .catch((res) => this.restExtractor.handleError(res)) | 139 | .catch((res) => this.restExtractor.handleError(res)) |
140 | } | 140 | } |
141 | 141 | ||
142 | private setVideoRate (id: string, rateType: VideoRateType) { | 142 | private setVideoRate (id: number, rateType: VideoRateType) { |
143 | const url = VideoService.BASE_VIDEO_URL + id + '/rate' | 143 | const url = VideoService.BASE_VIDEO_URL + id + '/rate' |
144 | const body: UserVideoRateUpdate = { | 144 | const body: UserVideoRateUpdate = { |
145 | rating: rateType | 145 | rating: rateType |