mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-08 17:01:27 +03:00
Files are now reloaded when you navigate back home
This commit is contained in:
@@ -55,17 +55,21 @@ export class RecentVideosComponent implements OnInit {
|
|||||||
if (localStorage.getItem('cached_file_count')) {
|
if (localStorage.getItem('cached_file_count')) {
|
||||||
this.cached_file_count = +localStorage.getItem('cached_file_count');
|
this.cached_file_count = +localStorage.getItem('cached_file_count');
|
||||||
this.loading_files = Array(this.cached_file_count).fill(0);
|
this.loading_files = Array(this.cached_file_count).fill(0);
|
||||||
console.log(this.loading_files);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
if (this.postsService.initialized) {
|
||||||
|
this.getAllFiles();
|
||||||
|
}
|
||||||
|
|
||||||
this.postsService.service_initialized.subscribe(init => {
|
this.postsService.service_initialized.subscribe(init => {
|
||||||
if (init) {
|
if (init) {
|
||||||
this.getAllFiles();
|
this.getAllFiles();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// set filter property to cached
|
// set filter property to cached
|
||||||
const cached_filter_property = localStorage.getItem('filter_property');
|
const cached_filter_property = localStorage.getItem('filter_property');
|
||||||
if (cached_filter_property && this.filterProperties[cached_filter_property]) {
|
if (cached_filter_property && this.filterProperties[cached_filter_property]) {
|
||||||
@@ -145,7 +149,7 @@ export class RecentVideosComponent implements OnInit {
|
|||||||
navigateToFile(file) {
|
navigateToFile(file) {
|
||||||
localStorage.setItem('player_navigator', this.router.url);
|
localStorage.setItem('player_navigator', this.router.url);
|
||||||
if (file.sub_id) {
|
if (file.sub_id) {
|
||||||
const sub = this.postsService.getSubscriptionByID(file.sub_id)
|
const sub = this.postsService.getSubscriptionByID(file.sub_id);
|
||||||
if (sub.streamingOnly) {
|
if (sub.streamingOnly) {
|
||||||
this.router.navigate(['/player', {name: file.id,
|
this.router.navigate(['/player', {name: file.id,
|
||||||
url: file.requested_formats ? file.requested_formats[0].url : file.url}]);
|
url: file.requested_formats ? file.requested_formats[0].url : file.url}]);
|
||||||
@@ -177,7 +181,6 @@ export class RecentVideosComponent implements OnInit {
|
|||||||
const type = file.isAudio ? 'audio' : 'video';
|
const type = file.isAudio ? 'audio' : 'video';
|
||||||
const ext = type === 'audio' ? '.mp3' : '.mp4'
|
const ext = type === 'audio' ? '.mp3' : '.mp4'
|
||||||
const sub = this.postsService.getSubscriptionByID(file.sub_id);
|
const sub = this.postsService.getSubscriptionByID(file.sub_id);
|
||||||
console.log(sub.isPlaylist)
|
|
||||||
this.postsService.downloadFileFromServer(file.id, type, null, null, sub.name, sub.isPlaylist,
|
this.postsService.downloadFileFromServer(file.id, type, null, null, sub.name, sub.isPlaylist,
|
||||||
this.postsService.user ? this.postsService.user.uid : null, null).subscribe(res => {
|
this.postsService.user ? this.postsService.user.uid : null, null).subscribe(res => {
|
||||||
const blob: Blob = res;
|
const blob: Blob = res;
|
||||||
|
|||||||
Reference in New Issue
Block a user