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 { Location } from '@angular/common'
5 import { NotificationsService } from 'angular2-notifications'
6 import { AuthService } from '../../core/auth'
7 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
8 import { VideoSortField } from '../../shared/video/sort-field.type'
9 import { VideoService } from '../../shared/video/video.service'
10 import { VideoFilter } from '../../../../../shared/models/videos/video-query.type'
11 import { I18n } from '@ngx-translate/i18n-polyfill'
12 import { ScreenService } from '@app/shared/misc/screen.service'
15 selector: 'my-videos-local',
16 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
17 templateUrl: '../../shared/video/abstract-video-list.html'
19 export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
21 currentRoute = '/videos/local'
22 sort = '-publishedAt' as VideoSortField
23 filter: VideoFilter = 'local'
26 protected router: Router,
27 protected route: ActivatedRoute,
28 protected notificationsService: NotificationsService,
29 protected authService: AuthService,
30 protected location: Location,
32 protected screenService: ScreenService,
33 private videoService: VideoService
37 this.titlePage = i18n('Local videos')
43 this.generateSyndicationList()
50 getVideosObservable (page: number) {
51 const newPagination = immutableAssign(this.pagination, { currentPage: page })
53 return this.videoService.getVideos(newPagination, this.sort, this.filter)
56 generateSyndicationList () {
57 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter)