From d39f6f7a177f58894214dc5e005d1b2bccbba154 Mon Sep 17 00:00:00 2001 From: Isaac Grynsztein Date: Sun, 15 Mar 2020 20:28:18 -0400 Subject: [PATCH] File cards modified to support blacklisting videos when using youtube-dl archive --- src/app/app.module.ts | 5 +---- src/app/file-card/file-card.component.html | 7 ++++++- src/app/file-card/file-card.component.ts | 5 +++-- src/app/main/main.component.html | 8 ++++---- src/app/main/main.component.ts | 6 ++++++ .../subscription-file-card.component.html | 2 +- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8be4234..e6b6152 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,7 +1,6 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule, LOCALE_ID } from '@angular/core'; import { registerLocaleData } from '@angular/common'; -import { LocaleService } from '@soluling/angular'; import { MatButtonModule } from '@angular/material/button'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; import { MatCardModule } from '@angular/material/card'; @@ -111,9 +110,7 @@ export function isVisible({ event, element, scrollContainer, offset }: IsVisible AppRoutingModule, ], providers: [ - PostsService, - LocaleService, - { provide: LOCALE_ID, deps: [LocaleService], useFactory: (service: LocaleService) => service.localeId }, + PostsService ], bootstrap: [AppComponent] }) diff --git a/src/app/file-card/file-card.component.html b/src/app/file-card/file-card.component.html index 39184ce..1c796c5 100644 --- a/src/app/file-card/file-card.component.html +++ b/src/app/file-card/file-card.component.html @@ -15,5 +15,10 @@ - + + + + + + diff --git a/src/app/file-card/file-card.component.ts b/src/app/file-card/file-card.component.ts index 7e39fc7..770976e 100644 --- a/src/app/file-card/file-card.component.ts +++ b/src/app/file-card/file-card.component.ts @@ -21,6 +21,7 @@ export class FileCardComponent implements OnInit { @Output() removeFile: EventEmitter = new EventEmitter(); @Input() isPlaylist = false; @Input() count = null; + @Input() use_youtubedl_archive = false; type; image_loaded = false; image_errored = false; @@ -40,9 +41,9 @@ export class FileCardComponent implements OnInit { this.type = this.isAudio ? 'audio' : 'video'; } - deleteFile() { + deleteFile(blacklistMode = false) { if (!this.isPlaylist) { - this.postsService.deleteFile(this.name, this.isAudio).subscribe(result => { + this.postsService.deleteFile(this.name, this.isAudio, blacklistMode).subscribe(result => { if (result === true) { this.openSnackBar('Delete success!', 'OK.'); this.removeFile.emit(this.name); diff --git a/src/app/main/main.component.html b/src/app/main/main.component.html index 110b1d0..dc11d79 100644 --- a/src/app/main/main.component.html +++ b/src/app/main/main.component.html @@ -204,7 +204,7 @@ + [length]="file.duration" [isAudio]="true" [use_youtubedl_archive]="use_youtubedl_archive"> @@ -215,7 +215,7 @@ + [length]="null" [isAudio]="true" [isPlaylist]="true" [count]="playlist.fileNames.length" [use_youtubedl_archive]="use_youtubedl_archive"> @@ -245,7 +245,7 @@ + [length]="file.duration" [isAudio]="false" [use_youtubedl_archive]="use_youtubedl_archive"> @@ -257,7 +257,7 @@ + [length]="null" [isAudio]="false" [isPlaylist]="true" [count]="playlist.fileNames.length" [use_youtubedl_archive]="use_youtubedl_archive"> diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index ba36282..975da5e 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -72,6 +72,7 @@ export class MainComponent implements OnInit { allowMultiDownloadMode = false; audioFolderPath; videoFolderPath; + use_youtubedl_archive = false; globalCustomArgs = null; allowAdvancedDownload = false; useDefaultDownloadingAgent = true; @@ -241,6 +242,7 @@ export class MainComponent implements OnInit { this.allowMultiDownloadMode = result['YoutubeDLMaterial']['Extra']['allow_multi_download_mode']; this.audioFolderPath = result['YoutubeDLMaterial']['Downloader']['path-audio']; this.videoFolderPath = result['YoutubeDLMaterial']['Downloader']['path-video']; + this.use_youtubedl_archive = result['YoutubeDLMaterial']['Downloader']['use_youtubedl_archive']; this.globalCustomArgs = result['YoutubeDLMaterial']['Downloader']['custom_args']; this.youtubeSearchEnabled = result['YoutubeDLMaterial']['API'] && result['YoutubeDLMaterial']['API']['use_youtube_API'] && result['YoutubeDLMaterial']['API']['youtube_API_key']; @@ -594,6 +596,8 @@ export class MainComponent implements OnInit { } }, error => { // can't access server this.downloadingfile = false; + this.current_download = null; + new_download['downloading'] = false; this.openSnackBar('Download failed!', 'OK.'); }); } else { @@ -626,6 +630,8 @@ export class MainComponent implements OnInit { } }, error => { // can't access server this.downloadingfile = false; + this.current_download = null; + new_download['downloading'] = false; this.openSnackBar('Download failed!', 'OK.'); }); } diff --git a/src/app/subscription/subscription-file-card/subscription-file-card.component.html b/src/app/subscription/subscription-file-card/subscription-file-card.component.html index 4537dd6..a2972a9 100644 --- a/src/app/subscription/subscription-file-card/subscription-file-card.component.html +++ b/src/app/subscription/subscription-file-card/subscription-file-card.component.html @@ -3,7 +3,7 @@ Length: {{formattedDuration}} - +