aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-02 16:50:56 +0200
committerChocobozzz <me@florianbigard.com>2021-08-02 17:10:07 +0200
commitff4de38385049bf8f6e1d76d8511854fcfabc71c (patch)
tree217dba89333609fc0255c2efbc38c0e7a8379bb8 /client/src/app
parent3da38d6e9f8d600476be276666ac7223aa5f172c (diff)
downloadPeerTube-ff4de38385049bf8f6e1d76d8511854fcfabc71c.tar.gz
PeerTube-ff4de38385049bf8f6e1d76d8511854fcfabc71c.tar.zst
PeerTube-ff4de38385049bf8f6e1d76d8511854fcfabc71c.zip
Filter videos by live in custom markup
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup.service.ts2
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts2
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts2
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts2
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts4
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts34
-rw-r--r--client/src/app/shared/shared-search/find-in-bulk.service.ts13
7 files changed, 29 insertions, 30 deletions
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
index 089728a51..c9d33980e 100644
--- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
+++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
@@ -191,6 +191,8 @@ export class CustomMarkupService {
191 accountHandle: data.accountHandle || undefined, 191 accountHandle: data.accountHandle || undefined,
192 channelHandle: data.channelHandle || undefined, 192 channelHandle: data.channelHandle || undefined,
193 193
194 isLive: this.buildBoolean(data.isLive),
195
194 filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined 196 filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined
195 } 197 }
196 198
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
index bb099deae..5bb045a82 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
@@ -50,7 +50,7 @@ export class ChannelMiniatureMarkupComponent implements CustomMarkupComponent, O
50 this.video = data[0] 50 this.video = data[0]
51 }, 51 },
52 52
53 err => this.notifier.error('Error in channel miniature component: ' + err.message) 53 err => this.notifier.error($localize`Error in channel miniature component: ${err.message}`)
54 ) 54 )
55 } 55 }
56 56
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts
index 97d31c4a7..5a5c34867 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts
@@ -44,7 +44,7 @@ export class PlaylistMiniatureMarkupComponent implements CustomMarkupComponent,
44 .subscribe( 44 .subscribe(
45 playlist => this.playlist = playlist, 45 playlist => this.playlist = playlist,
46 46
47 err => this.notifier.error('Error in playlist miniature component: ' + err.message) 47 err => this.notifier.error($localize`Error in playlist miniature component: ${err.message}`)
48 ) 48 )
49 } 49 }
50} 50}
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts
index ba61aaf51..84c936ee7 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts
@@ -56,7 +56,7 @@ export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnI
56 .subscribe( 56 .subscribe(
57 video => this.video = video, 57 video => this.video = video,
58 58
59 err => this.notifier.error('Error in video miniature component: ' + err.message) 59 err => this.notifier.error($localize`Error in video miniature component: ${err.message}`)
60 ) 60 )
61 } 61 }
62} 62}
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
index d9f77802b..6473e9ba0 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
@@ -22,6 +22,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
22 @Input() count: number 22 @Input() count: number
23 @Input() onlyDisplayTitle: boolean 23 @Input() onlyDisplayTitle: boolean
24 @Input() filter: VideoFilter 24 @Input() filter: VideoFilter
25 @Input() isLive: boolean
25 @Input() maxRows: number 26 @Input() maxRows: number
26 @Input() channelHandle: string 27 @Input() channelHandle: string
27 @Input() accountHandle: string 28 @Input() accountHandle: string
@@ -73,7 +74,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
73 .subscribe( 74 .subscribe(
74 ({ data }) => this.videos = data, 75 ({ data }) => this.videos = data,
75 76
76 err => this.notifier.error('Error in videos list component: ' + err.message) 77 err => this.notifier.error($localize`Error in videos list component: ${err.message}`)
77 ) 78 )
78 } 79 }
79 80
@@ -86,6 +87,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
86 categoryOneOf: this.categoryOneOf, 87 categoryOneOf: this.categoryOneOf,
87 languageOneOf: this.languageOneOf, 88 languageOneOf: this.languageOneOf,
88 filter: this.filter, 89 filter: this.filter,
90 isLive: this.isLive,
89 sort: this.sort as VideoSortField, 91 sort: this.sort as VideoSortField,
90 account: { nameWithHost: this.accountHandle }, 92 account: { nameWithHost: this.accountHandle },
91 videoChannel: { nameWithHost: this.channelHandle } 93 videoChannel: { nameWithHost: this.channelHandle }
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts
index 04a39be0e..4a97719fa 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -210,15 +210,16 @@ export class VideoService implements VideosProvider {
210 } 210 }
211 211
212 getVideos (parameters: { 212 getVideos (parameters: {
213 videoPagination: ComponentPaginationLight, 213 videoPagination: ComponentPaginationLight
214 sort: VideoSortField, 214 sort: VideoSortField
215 filter?: VideoFilter, 215 filter?: VideoFilter
216 categoryOneOf?: number[], 216 categoryOneOf?: number[]
217 languageOneOf?: string[], 217 languageOneOf?: string[]
218 skipCount?: boolean, 218 isLive?: boolean
219 skipCount?: boolean
219 nsfwPolicy?: NSFWPolicyType 220 nsfwPolicy?: NSFWPolicyType
220 }): Observable<ResultList<Video>> { 221 }): Observable<ResultList<Video>> {
221 const { videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount, nsfwPolicy } = parameters 222 const { videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount, nsfwPolicy, isLive } = parameters
222 223
223 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 224 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
224 225
@@ -228,21 +229,10 @@ export class VideoService implements VideosProvider {
228 if (filter) params = params.set('filter', filter) 229 if (filter) params = params.set('filter', filter)
229 if (skipCount) params = params.set('skipCount', skipCount + '') 230 if (skipCount) params = params.set('skipCount', skipCount + '')
230 231
231 if (nsfwPolicy) { 232 if (isLive) params = params.set('isLive', isLive)
232 params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) 233 if (nsfwPolicy) params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy))
233 } 234 if (languageOneOf) this.restService.addArrayParams(params, 'languageOneOf', languageOneOf)
234 235 if (categoryOneOf) this.restService.addArrayParams(params, 'categoryOneOf', categoryOneOf)
235 if (languageOneOf) {
236 for (const l of languageOneOf) {
237 params = params.append('languageOneOf[]', l)
238 }
239 }
240
241 if (categoryOneOf) {
242 for (const c of categoryOneOf) {
243 params = params.append('categoryOneOf[]', c + '')
244 }
245 }
246 236
247 return this.authHttp 237 return this.authHttp
248 .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params }) 238 .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params })
diff --git a/client/src/app/shared/shared-search/find-in-bulk.service.ts b/client/src/app/shared/shared-search/find-in-bulk.service.ts
index 0383d8648..61dd2cbc5 100644
--- a/client/src/app/shared/shared-search/find-in-bulk.service.ts
+++ b/client/src/app/shared/shared-search/find-in-bulk.service.ts
@@ -1,6 +1,6 @@
1import * as debug from 'debug' 1import * as debug from 'debug'
2import { Observable, Subject } from 'rxjs' 2import { Observable, Subject, throwError } from 'rxjs'
3import { map } from 'rxjs/operators' 3import { first, map } from 'rxjs/operators'
4import { Injectable, NgZone } from '@angular/core' 4import { Injectable, NgZone } from '@angular/core'
5import { buildBulkObservable } from '@app/helpers' 5import { buildBulkObservable } from '@app/helpers'
6import { ResultList } from '@shared/models/common' 6import { ResultList } from '@shared/models/common'
@@ -71,12 +71,17 @@ export class FindInBulkService {
71 return new Observable<R>(obs => { 71 return new Observable<R>(obs => {
72 observableObject.result 72 observableObject.result
73 .pipe( 73 .pipe(
74 first(),
74 map(({ data }) => data), 75 map(({ data }) => data),
75 map(data => data.find(finder)) 76 map(data => data.find(finder))
76 ) 77 )
77 .subscribe(result => { 78 .subscribe(result => {
78 obs.next(result) 79 if (!result) {
79 obs.complete() 80 obs.error(new Error($localize`Element ${param} not found`))
81 } else {
82 obs.next(result)
83 obs.complete()
84 }
80 }) 85 })
81 86
82 observableObject.notifier.next(param) 87 observableObject.notifier.next(param)