1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { immutableAssign } from '@app/shared/misc/utils'
4 import { NotificationsService } from 'angular2-notifications'
5 import { AuthService } from '../../core/auth'
6 import { PopoverModule } from 'ngx-bootstrap/popover'
7 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
8 import { SortField } from '../../shared/video/sort-field.type'
9 import { VideoService } from '../../shared/video/video.service'
10 import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
11 import * as url from 'url'
14 selector: 'my-videos-local',
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
18 export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
19 titlePage = 'Local videos'
20 currentRoute = '/videos/local'
21 sort = '-createdAt' as SortField
23 constructor (protected router: Router,
24 protected route: ActivatedRoute,
25 protected notificationsService: NotificationsService,
26 protected authService: AuthService,
27 private videoService: VideoService) {
33 this.generateSyndicationList()
40 getVideosObservable (page: number) {
41 const newPagination = immutableAssign(this.pagination, { currentPage: page })
43 return this.videoService.getVideos(newPagination, this.sort, 'local')
46 generateSyndicationList () {
47 const feeds = this.videoService.getFeed('local')
48 this.syndicationItems['rss 2.0'] = feeds[FeedFormat.RSS]
49 this.syndicationItems['atom 1.0'] = feeds[FeedFormat.ATOM]
50 this.syndicationItems['json 1.0'] = feeds[FeedFormat.JSON]