diff --git a/backend/categories.js b/backend/categories.js index 2236d9f..9b599cc 100644 --- a/backend/categories.js +++ b/backend/categories.js @@ -66,6 +66,7 @@ async function getCategoriesAsPlaylists(files = null) { category['thumbnailPath'] = files_that_match[0].thumbnailPath; category['duration'] = files_that_match.reduce((a, b) => a + utils.durationStringToNumber(b.duration), 0); category['id'] = category['uid']; + category['auto'] = true; categories_as_playlists.push(category); } } diff --git a/backend/downloader.js b/backend/downloader.js index 3bcf1c5..aef46f1 100644 --- a/backend/downloader.js +++ b/backend/downloader.js @@ -207,6 +207,8 @@ async function collectInfo(download_uid) { info = await exports.getVideoInfoByURL(url, args, download_uid); } + download['category'] = category; + // setup info required to calculate download progress const expected_file_size = utils.getExpectedFileSize(info); diff --git a/src/api-types/models/Playlist.ts b/src/api-types/models/Playlist.ts index 27a6bcf..3c8512f 100644 --- a/src/api-types/models/Playlist.ts +++ b/src/api-types/models/Playlist.ts @@ -13,4 +13,5 @@ export type Playlist = { registered: number; duration: number; user_uid?: string; + auto?: boolean; }; \ No newline at end of file diff --git a/src/app/components/downloads/downloads.component.ts b/src/app/components/downloads/downloads.component.ts index 8dc57c7..81cdd8c 100644 --- a/src/app/components/downloads/downloads.component.ts +++ b/src/app/components/downloads/downloads.component.ts @@ -122,26 +122,6 @@ export class DownloadsComponent implements OnInit, OnDestroy { }); } - clearFinishedDownloads(): void { - const dialogRef = this.dialog.open(ConfirmDialogComponent, { - data: { - dialogTitle: $localize`Clear finished downloads`, - dialogText: $localize`Would you like to clear your finished downloads?`, - submitText: $localize`Clear`, - warnSubmitColor: true - } - }); - dialogRef.afterClosed().subscribe(confirmed => { - if (confirmed) { - this.postsService.clearDownloads(true, false, false).subscribe(res => { - if (!res['success']) { - this.postsService.openSnackBar('Failed to clear finished downloads!'); - } - }); - } - }); - } - clearDownloadsByType(): void { const clearEmitter = new EventEmitter(); const dialogRef = this.dialog.open(ConfirmDialogComponent, { diff --git a/src/app/components/unified-file-card/unified-file-card.component.ts b/src/app/components/unified-file-card/unified-file-card.component.ts index 9b0e424..8c0295b 100644 --- a/src/app/components/unified-file-card/unified-file-card.component.ts +++ b/src/app/components/unified-file-card/unified-file-card.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { VideoInfoDialogComponent } from 'app/dialogs/video-info-dialog/video-info-dialog.component'; -import { DomSanitizer } from '@angular/platform-browser'; import { MatMenuTrigger } from '@angular/material/menu'; import { registerLocaleData } from '@angular/common'; import localeGB from '@angular/common/locales/en-GB'; @@ -10,6 +9,7 @@ import localeES from '@angular/common/locales/es'; import localeDE from '@angular/common/locales/de'; import localeZH from '@angular/common/locales/zh'; import localeNB from '@angular/common/locales/nb'; +import { DatabaseFile, Playlist } from 'api-types'; registerLocaleData(localeGB); registerLocaleData(localeFR); @@ -41,7 +41,7 @@ export class UnifiedFileCardComponent implements OnInit { // input/output @Input() loading = true; @Input() theme = null; - @Input() file_obj = null; + @Input() file_obj: DatabaseFile | Playlist = null; @Input() card_size = 'medium'; @Input() use_youtubedl_archive = false; @Input() is_playlist = false; @@ -51,7 +51,7 @@ export class UnifiedFileCardComponent implements OnInit { @Input() jwtString = null; @Input() availablePlaylists = null; @Output() goToFile = new EventEmitter(); - @Output() goToSubscription = new EventEmitter(); + @Output() goToSubscription = new EventEmitter(); @Output() deleteFile = new EventEmitter(); @Output() addFileToPlaylist = new EventEmitter(); @Output() editPlaylist = new EventEmitter(); @@ -67,7 +67,7 @@ export class UnifiedFileCardComponent implements OnInit { big: 250x200 */ - constructor(private dialog: MatDialog, private sanitizer: DomSanitizer) { } + constructor(private dialog: MatDialog) { } ngOnInit(): void { if (!this.loading) { @@ -76,10 +76,6 @@ export class UnifiedFileCardComponent implements OnInit { if (this.file_obj && this.file_obj.thumbnailPath) { this.thumbnailBlobURL = `${this.baseStreamPath}thumbnail/${encodeURIComponent(this.file_obj.thumbnailPath)}?jwt=${this.jwtString}`; - /*const mime = getMimeByFilename(this.file_obj.thumbnailPath); - const blob = new Blob([new Uint8Array(this.file_obj.thumbnailBlob.data)], {type: mime}); - const bloburl = URL.createObjectURL(blob); - this.thumbnailBlobURL = this.sanitizer.bypassSecurityTrustUrl(bloburl);*/ } if (this.file_obj) this.streamURL = this.generateStreamURL(); @@ -181,16 +177,3 @@ function fancyTimeFormat(time) { ret += '' + secs; return ret; } - -function getMimeByFilename(name) { - switch (name.substring(name.length-4, name.length)) { - case '.jpg': - return 'image/jpeg'; - case '.png': - return 'image/png'; - case 'webp': - return 'image/webp'; - default: - return null; - } -} \ No newline at end of file