diff options
Diffstat (limited to 'client/src/app/shared/video/video.service.ts')
-rw-r--r-- | client/src/app/shared/video/video.service.ts | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 009155410..4c19c3765 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -117,45 +117,53 @@ export class VideoService { | |||
117 | .catch((res) => this.restExtractor.handleError(res)) | 117 | .catch((res) => this.restExtractor.handleError(res)) |
118 | } | 118 | } |
119 | 119 | ||
120 | baseFeed () { | 120 | buildBaseFeedUrls () { |
121 | const feed = {} | 121 | const feeds = [ |
122 | 122 | { | |
123 | for (let item in FeedFormat) { | 123 | label: 'rss 2.0', |
124 | feed[FeedFormat[item]] = VideoService.BASE_FEEDS_URL + item.toLowerCase() | 124 | url: VideoService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase() |
125 | } | 125 | }, |
126 | 126 | { | |
127 | return feed | 127 | label: 'atom 1.0', |
128 | } | 128 | url: VideoService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase() |
129 | 129 | }, | |
130 | getFeed ( | 130 | { |
131 | filter?: VideoFilter | 131 | label: 'json 1.0', |
132 | ) { | 132 | url: VideoService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase() |
133 | } | ||
134 | ] | ||
135 | |||
136 | return feeds | ||
137 | } | ||
138 | |||
139 | getVideoFeedUrls (filter?: VideoFilter) { | ||
133 | let params = this.restService.addRestGetParams(new HttpParams()) | 140 | let params = this.restService.addRestGetParams(new HttpParams()) |
134 | const feed = this.baseFeed() | 141 | const feeds = this.buildBaseFeedUrls() |
135 | 142 | ||
136 | if (filter) { | 143 | if (filter) params = params.set('filter', filter) |
137 | params = params.set('filter', filter) | 144 | |
138 | } | 145 | if (params.keys().length !== 0) { |
139 | for (let item in feed) { | 146 | for (let item of feeds) { |
140 | feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() | 147 | item.url += `?${params.toString()}` |
148 | } | ||
141 | } | 149 | } |
142 | 150 | ||
143 | return feed | 151 | return feeds |
144 | } | 152 | } |
145 | 153 | ||
146 | getAccountFeed ( | 154 | getAccountFeedUrls (accountId: number) { |
147 | accountId: number, | ||
148 | host?: string | ||
149 | ) { | ||
150 | let params = this.restService.addRestGetParams(new HttpParams()) | 155 | let params = this.restService.addRestGetParams(new HttpParams()) |
151 | const feed = this.baseFeed() | 156 | const feeds = this.buildBaseFeedUrls() |
152 | 157 | ||
153 | params = params.set('accountId', accountId.toString()) | 158 | params = params.set('accountId', accountId.toString()) |
154 | for (let item in feed) { | 159 | |
155 | feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() | 160 | if (params.keys().length !== 0) { |
161 | for (let item of feeds) { | ||
162 | item.url += `?${params.toString()}` | ||
163 | } | ||
156 | } | 164 | } |
157 | 165 | ||
158 | return feed | 166 | return feeds |
159 | } | 167 | } |
160 | 168 | ||
161 | searchVideos ( | 169 | searchVideos ( |