fix download folder selection dropdown. closes #678

This commit is contained in:
Alex Shnitman 2025-06-05 18:45:36 +03:00
parent b7ef408d5d
commit f494c4f6be
4 changed files with 35 additions and 12 deletions

View File

@ -224,7 +224,7 @@ def get_custom_dirs():
return re.search(config.CUSTOM_DIRS_EXCLUDE_REGEX, d) is None return re.search(config.CUSTOM_DIRS_EXCLUDE_REGEX, d) is None
# Recursively lists all subdirectories of DOWNLOAD_DIR # Recursively lists all subdirectories of DOWNLOAD_DIR
dirs = list(filter(include_dir, map(convert, path.glob('**')))) dirs = list(filter(include_dir, map(convert, path.glob('**/'))))
return dirs return dirs

View File

@ -136,6 +136,11 @@
bindLabel="folder" bindLabel="folder"
[(ngModel)]="folder" [(ngModel)]="folder"
[disabled]="addInProgress || downloads.loading" [disabled]="addInProgress || downloads.loading"
[virtualScroll]="true"
[clearable]="true"
[loading]="downloads.loading"
[searchable]="true"
[closeOnSelect]="true"
ngbTooltip="Choose where to save downloads. Type to create a new folder."> ngbTooltip="Choose where to save downloads. Type to create a new folder.">
</ng-select> </ng-select>
</div> </div>

View File

@ -111,3 +111,18 @@ td
.spinner-border .spinner-border
margin-right: 0.5rem margin-right: 0.5rem
::ng-deep .ng-select
flex: 1
.ng-select-container
min-height: 38px
.ng-value
white-space: nowrap
overflow: visible
.ng-dropdown-panel
.ng-dropdown-panel-items
max-height: 300px
.ng-option
white-space: nowrap
overflow: visible
text-overflow: ellipsis

View File

@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
import { faTrashAlt, faCheckCircle, faTimesCircle, IconDefinition } from '@fortawesome/free-regular-svg-icons'; import { faTrashAlt, faCheckCircle, faTimesCircle, IconDefinition } from '@fortawesome/free-regular-svg-icons';
import { faRedoAlt, faSun, faMoon, faCircleHalfStroke, faCheck, faExternalLinkAlt, faDownload, faFileImport, faFileExport, faCopy } from '@fortawesome/free-solid-svg-icons'; import { faRedoAlt, faSun, faMoon, faCircleHalfStroke, faCheck, faExternalLinkAlt, faDownload, faFileImport, faFileExport, faCopy } from '@fortawesome/free-solid-svg-icons';
import { CookieService } from 'ngx-cookie-service'; import { CookieService } from 'ngx-cookie-service';
import { map, Observable, of } from 'rxjs'; import { map, Observable, of, distinctUntilChanged } from 'rxjs';
import { Download, DownloadsService, Status } from './downloads.service'; import { Download, DownloadsService, Status } from './downloads.service';
import { MasterCheckboxComponent } from './master-checkbox.component'; import { MasterCheckboxComponent } from './master-checkbox.component';
@ -135,16 +135,19 @@ export class AppComponent implements AfterViewInit {
} }
getMatchingCustomDir() : Observable<string[]> { getMatchingCustomDir() : Observable<string[]> {
return this.downloads.customDirsChanged.asObservable().pipe(map((output) => { return this.downloads.customDirsChanged.asObservable().pipe(
// Keep logic consistent with app/ytdl.py map((output) => {
if (this.isAudioType()) { // Keep logic consistent with app/ytdl.py
console.debug("Showing audio-specific download directories"); if (this.isAudioType()) {
return output["audio_download_dir"]; console.debug("Showing audio-specific download directories");
} else { return output["audio_download_dir"];
console.debug("Showing default download directories"); } else {
return output["download_dir"]; console.debug("Showing default download directories");
} return output["download_dir"];
})); }
}),
distinctUntilChanged((prev, curr) => JSON.stringify(prev) === JSON.stringify(curr))
);
} }
getConfiguration() { getConfiguration() {