import * as debug from 'debug'
import { Observable, Subject } from 'rxjs'
import { filter, first, map } from 'rxjs/operators'
import { Injectable } from '@angular/core'
import { buildBulkObservable } from '@app/helpers'
import { ResultList } from '@shared/models/common'
import { Video, VideoChannel } from '../shared-main'
import { VideoPlaylist } from '../shared-video-playlist'
import { SearchService } from './search.service'
import { AdvancedSearch } from './advanced-search.model'
const logger = debug('peertube:search:FindInBulkService')
type BulkObservables
= {
notifier: Subject
result: Observable<{ params: P[], response: R }>
}
@Injectable()
export class FindInBulkService {
private advancedSearchForBulk: AdvancedSearch
private getVideoInBulk: BulkObservables>
private getChannelInBulk: BulkObservables>
private getPlaylistInBulk: BulkObservables>
constructor (
private searchService: SearchService
) {
this.getVideoInBulk = this.buildBulkObservableObject(this.getVideosInBulk.bind(this))
this.getChannelInBulk = this.buildBulkObservableObject(this.getChannelsInBulk.bind(this))
this.getPlaylistInBulk = this.buildBulkObservableObject(this.getPlaylistsInBulk.bind(this))
this.advancedSearchForBulk = new AdvancedSearch({ searchTarget: 'local' })
}
getVideo (uuid: string): Observable