Implement user soft-delete and improve search ranking

Adds soft-delete support for local users, including backend, API, and UI changes to allow admins to delete local users while preserving their requests. Updates user queries to exclude deleted users and allows username reuse for deleted accounts. Refines search and ranking logic for torrents: uses title-only queries for broader results, increases max results to 100, applies a minimum score threshold (30/100), and logs detailed ranking breakdowns. Updates the ranking algorithm to prioritize title/author match, adjusts scoring weights, and improves BookDate compatibility with Audiobookshelf by disabling rating-based features when unsupported. Enhances file copy operations for large files, improves metadata tagging, and updates documentation to reflect new search and ranking strategies.
This commit is contained in:
kikootwo
2025-12-23 17:34:29 -05:00
parent bb42281dac
commit f043688a71
18 changed files with 630 additions and 176 deletions
+8 -8
View File
@@ -202,10 +202,10 @@ export class FileOrganizer {
// Copy file (do NOT delete original - needed for seeding)
try {
// Read source file (either tagged version or original)
const fileData = await fs.readFile(sourcePath);
// Write to target with explicit permissions
await fs.writeFile(targetFilePath, fileData, { mode: 0o644 });
// Copy file using streaming (handles large files >2GB)
await fs.copyFile(sourcePath, targetFilePath);
// Set explicit permissions after copy
await fs.chmod(targetFilePath, 0o644);
result.audioFiles.push(targetFilePath);
result.filesMovedCount++;
@@ -237,8 +237,8 @@ export class FileOrganizer {
try {
// Copy cover art (do NOT delete original)
const coverData = await fs.readFile(sourcePath);
await fs.writeFile(targetCoverPath, coverData, { mode: 0o644 });
await fs.copyFile(sourcePath, targetCoverPath);
await fs.chmod(targetCoverPath, 0o644);
result.coverArtFile = targetCoverPath;
result.filesMovedCount++;
await logger?.info(`Copied cover art`);
@@ -406,8 +406,8 @@ export class FileOrganizer {
const cachedPath = path.join('/app/cache/thumbnails', filename);
// Copy from local cache instead of downloading
const coverData = await fs.readFile(cachedPath);
await fs.writeFile(targetPath, coverData, { mode: 0o644 });
await fs.copyFile(cachedPath, targetPath);
await fs.chmod(targetPath, 0o644);
console.log(`[FileOrganizer] Copied cover art from cache: ${filename}`);
} else {
// Download from external URL (e.g., Audible CDN)