mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-29 05:03:20 +03:00
Optimized get/set subscription process
This commit is contained in:
@@ -61,9 +61,13 @@ export class EditSubscriptionDialogComponent implements OnInit {
|
|||||||
];
|
];
|
||||||
|
|
||||||
constructor(@Inject(MAT_DIALOG_DATA) public data: any, private dialog: MatDialog, private postsService: PostsService) {
|
constructor(@Inject(MAT_DIALOG_DATA) public data: any, private dialog: MatDialog, private postsService: PostsService) {
|
||||||
this.sub = this.data.sub;
|
this.sub = JSON.parse(JSON.stringify(this.data.sub));
|
||||||
this.new_sub = JSON.parse(JSON.stringify(this.sub));
|
this.new_sub = JSON.parse(JSON.stringify(this.sub));
|
||||||
|
|
||||||
|
// ignore videos to keep requests small
|
||||||
|
delete this.sub['videos'];
|
||||||
|
delete this.new_sub['videos'];
|
||||||
|
|
||||||
this.audioOnlyMode = this.sub.type === 'audio';
|
this.audioOnlyMode = this.sub.type === 'audio';
|
||||||
this.download_all = !this.sub.timerange;
|
this.download_all = !this.sub.timerange;
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export class SubscriptionComponent implements OnInit, OnDestroy {
|
|||||||
if (init) {
|
if (init) {
|
||||||
this.getConfig();
|
this.getConfig();
|
||||||
this.getSubscription();
|
this.getSubscription();
|
||||||
this.sub_interval = setInterval(() => this.getSubscription(), 1000);
|
this.sub_interval = setInterval(() => this.getSubscription(true), 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -79,8 +79,14 @@ export class SubscriptionComponent implements OnInit, OnDestroy {
|
|||||||
this.router.navigate(['/subscriptions']);
|
this.router.navigate(['/subscriptions']);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSubscription() {
|
getSubscription(low_cost = false) {
|
||||||
this.postsService.getSubscription(this.id).subscribe(res => {
|
this.postsService.getSubscription(this.id).subscribe(res => {
|
||||||
|
if (low_cost && res['subscription'].videos.length === this.subscription?.videos.length) {
|
||||||
|
if (res['subscription']['downloading'] !== this.subscription['downloading']) {
|
||||||
|
this.subscription['downloading'] = res['subscription']['downloading'];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.subscription = res['subscription'];
|
this.subscription = res['subscription'];
|
||||||
this.files = res['files'];
|
this.files = res['files'];
|
||||||
if (this.search_mode) {
|
if (this.search_mode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user