Filter videos by live in custom markup
This commit is contained in:
parent
3da38d6e9f
commit
ff4de38385
|
@ -191,6 +191,8 @@ export class CustomMarkupService {
|
||||||
accountHandle: data.accountHandle || undefined,
|
accountHandle: data.accountHandle || undefined,
|
||||||
channelHandle: data.channelHandle || undefined,
|
channelHandle: data.channelHandle || undefined,
|
||||||
|
|
||||||
|
isLive: this.buildBoolean(data.isLive),
|
||||||
|
|
||||||
filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined
|
filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class ChannelMiniatureMarkupComponent implements CustomMarkupComponent, O
|
||||||
this.video = data[0]
|
this.video = data[0]
|
||||||
},
|
},
|
||||||
|
|
||||||
err => this.notifier.error('Error in channel miniature component: ' + err.message)
|
err => this.notifier.error($localize`Error in channel miniature component: ${err.message}`)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ export class PlaylistMiniatureMarkupComponent implements CustomMarkupComponent,
|
||||||
.subscribe(
|
.subscribe(
|
||||||
playlist => this.playlist = playlist,
|
playlist => this.playlist = playlist,
|
||||||
|
|
||||||
err => this.notifier.error('Error in playlist miniature component: ' + err.message)
|
err => this.notifier.error($localize`Error in playlist miniature component: ${err.message}`)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnI
|
||||||
.subscribe(
|
.subscribe(
|
||||||
video => this.video = video,
|
video => this.video = video,
|
||||||
|
|
||||||
err => this.notifier.error('Error in video miniature component: ' + err.message)
|
err => this.notifier.error($localize`Error in video miniature component: ${err.message}`)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
|
||||||
@Input() count: number
|
@Input() count: number
|
||||||
@Input() onlyDisplayTitle: boolean
|
@Input() onlyDisplayTitle: boolean
|
||||||
@Input() filter: VideoFilter
|
@Input() filter: VideoFilter
|
||||||
|
@Input() isLive: boolean
|
||||||
@Input() maxRows: number
|
@Input() maxRows: number
|
||||||
@Input() channelHandle: string
|
@Input() channelHandle: string
|
||||||
@Input() accountHandle: string
|
@Input() accountHandle: string
|
||||||
|
@ -73,7 +74,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
|
||||||
.subscribe(
|
.subscribe(
|
||||||
({ data }) => this.videos = data,
|
({ data }) => this.videos = data,
|
||||||
|
|
||||||
err => this.notifier.error('Error in videos list component: ' + err.message)
|
err => this.notifier.error($localize`Error in videos list component: ${err.message}`)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
|
||||||
categoryOneOf: this.categoryOneOf,
|
categoryOneOf: this.categoryOneOf,
|
||||||
languageOneOf: this.languageOneOf,
|
languageOneOf: this.languageOneOf,
|
||||||
filter: this.filter,
|
filter: this.filter,
|
||||||
|
isLive: this.isLive,
|
||||||
sort: this.sort as VideoSortField,
|
sort: this.sort as VideoSortField,
|
||||||
account: { nameWithHost: this.accountHandle },
|
account: { nameWithHost: this.accountHandle },
|
||||||
videoChannel: { nameWithHost: this.channelHandle }
|
videoChannel: { nameWithHost: this.channelHandle }
|
||||||
|
|
|
@ -210,15 +210,16 @@ export class VideoService implements VideosProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
getVideos (parameters: {
|
getVideos (parameters: {
|
||||||
videoPagination: ComponentPaginationLight,
|
videoPagination: ComponentPaginationLight
|
||||||
sort: VideoSortField,
|
sort: VideoSortField
|
||||||
filter?: VideoFilter,
|
filter?: VideoFilter
|
||||||
categoryOneOf?: number[],
|
categoryOneOf?: number[]
|
||||||
languageOneOf?: string[],
|
languageOneOf?: string[]
|
||||||
skipCount?: boolean,
|
isLive?: boolean
|
||||||
|
skipCount?: boolean
|
||||||
nsfwPolicy?: NSFWPolicyType
|
nsfwPolicy?: NSFWPolicyType
|
||||||
}): Observable<ResultList<Video>> {
|
}): Observable<ResultList<Video>> {
|
||||||
const { videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount, nsfwPolicy } = parameters
|
const { videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount, nsfwPolicy, isLive } = parameters
|
||||||
|
|
||||||
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
||||||
|
|
||||||
|
@ -228,21 +229,10 @@ export class VideoService implements VideosProvider {
|
||||||
if (filter) params = params.set('filter', filter)
|
if (filter) params = params.set('filter', filter)
|
||||||
if (skipCount) params = params.set('skipCount', skipCount + '')
|
if (skipCount) params = params.set('skipCount', skipCount + '')
|
||||||
|
|
||||||
if (nsfwPolicy) {
|
if (isLive) params = params.set('isLive', isLive)
|
||||||
params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy))
|
if (nsfwPolicy) params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy))
|
||||||
}
|
if (languageOneOf) this.restService.addArrayParams(params, 'languageOneOf', languageOneOf)
|
||||||
|
if (categoryOneOf) this.restService.addArrayParams(params, 'categoryOneOf', categoryOneOf)
|
||||||
if (languageOneOf) {
|
|
||||||
for (const l of languageOneOf) {
|
|
||||||
params = params.append('languageOneOf[]', l)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (categoryOneOf) {
|
|
||||||
for (const c of categoryOneOf) {
|
|
||||||
params = params.append('categoryOneOf[]', c + '')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.authHttp
|
return this.authHttp
|
||||||
.get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params })
|
.get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params })
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as debug from 'debug'
|
import * as debug from 'debug'
|
||||||
import { Observable, Subject } from 'rxjs'
|
import { Observable, Subject, throwError } from 'rxjs'
|
||||||
import { map } from 'rxjs/operators'
|
import { first, map } from 'rxjs/operators'
|
||||||
import { Injectable, NgZone } from '@angular/core'
|
import { Injectable, NgZone } from '@angular/core'
|
||||||
import { buildBulkObservable } from '@app/helpers'
|
import { buildBulkObservable } from '@app/helpers'
|
||||||
import { ResultList } from '@shared/models/common'
|
import { ResultList } from '@shared/models/common'
|
||||||
|
@ -71,12 +71,17 @@ export class FindInBulkService {
|
||||||
return new Observable<R>(obs => {
|
return new Observable<R>(obs => {
|
||||||
observableObject.result
|
observableObject.result
|
||||||
.pipe(
|
.pipe(
|
||||||
|
first(),
|
||||||
map(({ data }) => data),
|
map(({ data }) => data),
|
||||||
map(data => data.find(finder))
|
map(data => data.find(finder))
|
||||||
)
|
)
|
||||||
.subscribe(result => {
|
.subscribe(result => {
|
||||||
obs.next(result)
|
if (!result) {
|
||||||
obs.complete()
|
obs.error(new Error($localize`Element ${param} not found`))
|
||||||
|
} else {
|
||||||
|
obs.next(result)
|
||||||
|
obs.complete()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
observableObject.notifier.next(param)
|
observableObject.notifier.next(param)
|
||||||
|
|
|
@ -36,6 +36,8 @@ export type VideosListMarkupData = {
|
||||||
channelHandle?: string
|
channelHandle?: string
|
||||||
accountHandle?: string
|
accountHandle?: string
|
||||||
|
|
||||||
|
isLive?: string // number
|
||||||
|
|
||||||
onlyLocal?: string // boolean
|
onlyLocal?: string // boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue