diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-07 17:06:00 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | f0a3988066f72a28bb44520af072f18d91d77dde (patch) | |
tree | dfa3a92102557b567530c5dd014c90866621140a /client/src/app/shared/video | |
parent | 830b4faff15fb9c81d88e8e69fcdf94aad32bef8 (diff) | |
download | PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.tar.gz PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.tar.zst PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.zip |
Add to playlist dropdown
Diffstat (limited to 'client/src/app/shared/video')
-rw-r--r-- | client/src/app/shared/video/video.service.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 960846e21..ef489648c 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -31,6 +31,8 @@ import { ServerService } from '@app/core' | |||
31 | import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service' | 31 | import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service' |
32 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 32 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
33 | import { I18n } from '@ngx-translate/i18n-polyfill' | 33 | import { I18n } from '@ngx-translate/i18n-polyfill' |
34 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | ||
35 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | ||
34 | 36 | ||
35 | export interface VideosProvider { | 37 | export interface VideosProvider { |
36 | getVideos ( | 38 | getVideos ( |
@@ -170,6 +172,23 @@ export class VideoService implements VideosProvider { | |||
170 | ) | 172 | ) |
171 | } | 173 | } |
172 | 174 | ||
175 | getPlaylistVideos ( | ||
176 | videoPlaylistId: number | string, | ||
177 | videoPagination: ComponentPagination | ||
178 | ): Observable<{ videos: Video[], totalVideos: number }> { | ||
179 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | ||
180 | |||
181 | let params = new HttpParams() | ||
182 | params = this.restService.addRestGetParams(params, pagination) | ||
183 | |||
184 | return this.authHttp | ||
185 | .get<ResultList<Video>>(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylistId + '/videos', { params }) | ||
186 | .pipe( | ||
187 | switchMap(res => this.extractVideos(res)), | ||
188 | catchError(err => this.restExtractor.handleError(err)) | ||
189 | ) | ||
190 | } | ||
191 | |||
173 | getUserSubscriptionVideos ( | 192 | getUserSubscriptionVideos ( |
174 | videoPagination: ComponentPagination, | 193 | videoPagination: ComponentPagination, |
175 | sort: VideoSortField | 194 | sort: VideoSortField |