mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-30 16:40:55 +03:00
Added the ability to download (export) archives from subscriptions
This commit is contained in:
@@ -21,5 +21,7 @@
|
||||
|
||||
<mat-dialog-actions>
|
||||
<button mat-button mat-dialog-close>Close</button>
|
||||
<button mat-stroked-button (click)="downloadArchive()" color="accent">Export Archive</button>
|
||||
<span class="spacer"></span>
|
||||
<button mat-button (click)="unsubscribe()" color="warn">Unsubscribe</button>
|
||||
</mat-dialog-actions>
|
||||
@@ -4,4 +4,6 @@
|
||||
|
||||
.info-item-value {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
.spacer {flex: 1 1 auto;}
|
||||
|
||||
@@ -29,4 +29,11 @@ export class SubscriptionInfoDialogComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
downloadArchive() {
|
||||
this.postsService.downloadArchive(this.sub).subscribe(res => {
|
||||
const blob: Blob = res;
|
||||
saveAs(blob, 'archive.txt');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -120,6 +120,10 @@ export class PostsService {
|
||||
{responseType: 'blob'});
|
||||
}
|
||||
|
||||
downloadArchive(sub) {
|
||||
return this.http.post(this.path + 'downloadArchive', {sub: sub}, {responseType: 'blob'});
|
||||
}
|
||||
|
||||
getFileInfo(fileNames, type, urlMode) {
|
||||
return this.http.post(this.path + 'getVideoInfos', {fileNames: fileNames, type: type, urlMode: urlMode});
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<button [matMenuTriggerFor]="action_menu" class="menuButton" mat-icon-button><mat-icon>more_vert</mat-icon></button>
|
||||
<mat-menu #action_menu="matMenu">
|
||||
<button (click)="deleteAndRedownload()" mat-menu-item><mat-icon>restore</mat-icon>Delete and redownload</button>
|
||||
<button (click)="deleteForever()" mat-menu-item><mat-icon>delete_forever</mat-icon>Delete forever</button>
|
||||
<button (click)="deleteForever()" mat-menu-item *ngIf="sub.archive && use_youtubedl_archive"><mat-icon>delete_forever</mat-icon>Delete forever</button>
|
||||
</mat-menu>
|
||||
<mat-card (click)="goToFile(file.name)" matRipple class="example-card mat-elevation-z6">
|
||||
<div style="padding:5px">
|
||||
|
||||
@@ -20,6 +20,7 @@ export class SubscriptionFileCardComponent implements OnInit {
|
||||
|
||||
@Input() file;
|
||||
@Input() sub;
|
||||
@Input() use_youtubedl_archive = false;
|
||||
|
||||
@Output() goToFileEmit = new EventEmitter<any>();
|
||||
@Output() reloadSubscription = new EventEmitter<boolean>();
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div *ngFor="let file of files" class="col mb-4 sub-file-col">
|
||||
<app-subscription-file-card (reloadSubscription)="getSubscription()" (goToFileEmit)="goToFile($event)" [file]="file" [sub]="subscription"></app-subscription-file-card>
|
||||
<app-subscription-file-card (reloadSubscription)="getSubscription()" (goToFileEmit)="goToFile($event)" [file]="file" [sub]="subscription" [use_youtubedl_archive]="use_youtubedl_archive"></app-subscription-file-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,7 @@ export class SubscriptionComponent implements OnInit {
|
||||
id = null;
|
||||
subscription = null;
|
||||
files: any[] = null;
|
||||
use_youtubedl_archive = false;
|
||||
|
||||
constructor(private postsService: PostsService, private route: ActivatedRoute, private router: Router) { }
|
||||
|
||||
@@ -20,6 +21,7 @@ export class SubscriptionComponent implements OnInit {
|
||||
this.id = this.route.snapshot.paramMap.get('id');
|
||||
|
||||
this.getSubscription();
|
||||
this.getConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +32,17 @@ export class SubscriptionComponent implements OnInit {
|
||||
getSubscription() {
|
||||
this.postsService.getSubscription(this.id).subscribe(res => {
|
||||
this.subscription = res['subscription'];
|
||||
console.log(res['files']);
|
||||
this.files = res['files'];
|
||||
});
|
||||
}
|
||||
|
||||
getConfig() {
|
||||
this.postsService.loadNavItems().subscribe(res => {
|
||||
const result = !this.postsService.debugMode ? res['config_file'] : res;
|
||||
this.use_youtubedl_archive = result['YoutubeDLMaterial']['Subscriptions']['subscriptions_use_youtubedl_archive'];
|
||||
});
|
||||
}
|
||||
|
||||
goToFile(name) {
|
||||
localStorage.setItem('player_navigator', this.router.url);
|
||||
this.router.navigate(['/player', {fileNames: name, type: 'subscription', subscriptionName: this.subscription.name,
|
||||
|
||||
Reference in New Issue
Block a user