]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-local.component.ts
feature: initial syndication feeds support
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-local.component.ts
CommitLineData
9af61e84 1import { Component, OnDestroy, OnInit } from '@angular/core'
066e94c5
C
2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
4import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth'
244e76a5 6import { PopoverModule } from 'ngx-bootstrap/popover'
066e94c5
C
7import { AbstractVideoList } from '../../shared/video/abstract-video-list'
8import { SortField } from '../../shared/video/sort-field.type'
9import { VideoService } from '../../shared/video/video.service'
244e76a5
RK
10import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
11import * as url from 'url'
066e94c5
C
12
13@Component({
14 selector: 'my-videos-local',
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
17})
9af61e84 18export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
066e94c5
C
19 titlePage = 'Local videos'
20 currentRoute = '/videos/local'
21 sort = '-createdAt' as SortField
22
23 constructor (protected router: Router,
24 protected route: ActivatedRoute,
25 protected notificationsService: NotificationsService,
26 protected authService: AuthService,
27 private videoService: VideoService) {
28 super()
29 }
30
31 ngOnInit () {
32 super.ngOnInit()
244e76a5 33 this.generateSyndicationList()
066e94c5
C
34 }
35
9af61e84
C
36 ngOnDestroy () {
37 super.ngOnDestroy()
38 }
39
066e94c5
C
40 getVideosObservable (page: number) {
41 const newPagination = immutableAssign(this.pagination, { currentPage: page })
42
43 return this.videoService.getVideos(newPagination, this.sort, 'local')
44 }
244e76a5
RK
45
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]
51 }
066e94c5 52}