]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/videos/video-list/video-trending.component.ts
Hide big play button on autoplay
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-trending.component.ts
... / ...
CommitLineData
1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
4import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth'
6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7import { SortField } from '../../shared/video/sort-field.type'
8import { VideoService } from '../../shared/video/video.service'
9import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
10import * as url from 'url'
11
12@Component({
13 selector: 'my-videos-trending',
14 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
15 templateUrl: '../../shared/video/abstract-video-list.html'
16})
17export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy {
18 titlePage = 'Trending'
19 currentRoute = '/videos/trending'
20 defaultSort: SortField = '-views'
21
22 constructor (protected router: Router,
23 protected route: ActivatedRoute,
24 protected notificationsService: NotificationsService,
25 protected authService: AuthService,
26 private videoService: VideoService) {
27 super()
28 }
29
30 ngOnInit () {
31 super.ngOnInit()
32 this.generateSyndicationList()
33 }
34
35 ngOnDestroy () {
36 super.ngOnDestroy()
37 }
38
39 getVideosObservable (page: number) {
40 const newPagination = immutableAssign(this.pagination, { currentPage: page })
41 return this.videoService.getVideos(newPagination, this.sort)
42 }
43
44 generateSyndicationList () {
45 const feeds = this.videoService.getFeed('local')
46 this.syndicationItems['rss 2.0'] = feeds[FeedFormat.RSS]
47 this.syndicationItems['atom 1.0'] = feeds[FeedFormat.ATOM]
48 this.syndicationItems['json 1.0'] = feeds[FeedFormat.JSON]
49 }
50}