mirror of
https://github.com/chrisbenincasa/tunarr.git
synced 2026-04-18 09:03:35 -04:00
fix: properly use path filter in local other video scanner
This commit is contained in:
@@ -119,17 +119,15 @@ export class LocalOtherVideoScanner extends FileSystemScanner {
|
||||
break;
|
||||
}
|
||||
|
||||
this.logger.debug('Scanning directory: %s', folder);
|
||||
|
||||
if (
|
||||
isNonEmptyString(context.pathFilter) &&
|
||||
!basename(folder)
|
||||
.toLowerCase()
|
||||
.startsWith(context.pathFilter.toLowerCase())
|
||||
!context.pathFilter.toLowerCase().startsWith(folder.toLowerCase())
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.logger.debug('Scanning directory: %s', folder);
|
||||
|
||||
const result = await Result.attemptAsync(() =>
|
||||
this.scanFolder(folder, context),
|
||||
);
|
||||
@@ -202,6 +200,13 @@ export class LocalOtherVideoScanner extends FileSystemScanner {
|
||||
private async scanFolder(fullPath: string, context: LocalScanContext) {
|
||||
const parent = dirname(fullPath);
|
||||
|
||||
if (
|
||||
isNonEmptyString(context.pathFilter) &&
|
||||
!context.pathFilter.toLowerCase().startsWith(fullPath.toLowerCase())
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the existing parent folder if it exists
|
||||
const parentFolder = await this.localMediaDB.findFolder(
|
||||
context.library,
|
||||
@@ -307,9 +312,15 @@ export class LocalOtherVideoScanner extends FileSystemScanner {
|
||||
return;
|
||||
}
|
||||
|
||||
await wait();
|
||||
|
||||
const fullFilePath = path.join(file.parentPath, file.name);
|
||||
if (
|
||||
isNonEmptyString(context.pathFilter) &&
|
||||
!context.pathFilter.toLowerCase().startsWith(fullFilePath.toLowerCase())
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
await wait();
|
||||
|
||||
const mediaItem = (await this.getMediaItem(fullFilePath)).getOrThrow();
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ export class SearchParser {
|
||||
];
|
||||
|
||||
const r = this.preprocessSearchFilterInner(filter, mutators);
|
||||
console.log(filter, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user