mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-30 00:20:57 +03:00
39 lines
948 B
TypeScript
39 lines
948 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { PostsService } from 'app/posts.services';
|
|
|
|
@Component({
|
|
selector: 'app-recent-videos',
|
|
templateUrl: './recent-videos.component.html',
|
|
styleUrls: ['./recent-videos.component.scss']
|
|
})
|
|
export class RecentVideosComponent implements OnInit {
|
|
|
|
normal_files_received = false;
|
|
subscription_files_received = false;
|
|
files: any[] = null;
|
|
|
|
constructor(private postsService: PostsService) { }
|
|
|
|
ngOnInit(): void {
|
|
this.postsService.service_initialized.subscribe(init => {
|
|
if (init) {
|
|
this.getAllFiles();
|
|
}
|
|
});
|
|
}
|
|
|
|
getAllFiles() {
|
|
this.normal_files_received = false;
|
|
this.postsService.getAllFiles().subscribe(res => {
|
|
this.files = res['files'];
|
|
this.files.sort(this.sortFiles);
|
|
});
|
|
}
|
|
|
|
sortFiles(a, b) {
|
|
// uses the 'registered' flag as the timestamp
|
|
const result = b.registered - a.registered;
|
|
return result;
|
|
}
|
|
}
|