refactor: unified download folder structure

- Changed from separate paths to unified structure under downloads/
- Structure: downloads/{permanent,cache,kept}/
- Removed Library:KeptPath config, now uses downloads/kept/
- Updated AdminController and JellyfinController to use new paths
- Web UI will now correctly show kept tracks in Active Playlists tab
- Matches user's actual folder structure on server
This commit is contained in:
2026-02-08 01:25:24 -05:00
parent 8dbf37f6a3
commit b0e07404c9
3 changed files with 7 additions and 8 deletions

View File

@@ -1411,7 +1411,7 @@ public class AdminController : ControllerBase
downloadPath = _subsonicSettings.StorageMode == StorageMode.Cache downloadPath = _subsonicSettings.StorageMode == StorageMode.Cache
? Path.Combine("cache", "Music") ? Path.Combine("cache", "Music")
: (_configuration["Library:DownloadPath"] ?? "./downloads"), : (_configuration["Library:DownloadPath"] ?? "./downloads"),
keptPath = _configuration["Library:KeptPath"] ?? "/app/kept", keptPath = Path.Combine(_configuration["Library:DownloadPath"] ?? "./downloads", "kept"),
storageMode = _subsonicSettings.StorageMode.ToString(), storageMode = _subsonicSettings.StorageMode.ToString(),
cacheDurationHours = _subsonicSettings.CacheDurationHours, cacheDurationHours = _subsonicSettings.CacheDurationHours,
downloadMode = _subsonicSettings.DownloadMode.ToString() downloadMode = _subsonicSettings.DownloadMode.ToString()
@@ -3306,7 +3306,7 @@ public class LinkPlaylistRequest
{ {
try try
{ {
var keptPath = _configuration["Library:KeptPath"] ?? "/app/kept"; var keptPath = Path.Combine(_configuration["Library:DownloadPath"] ?? "./downloads", "kept");
_logger.LogInformation("📂 Checking kept folder: {Path}", keptPath); _logger.LogInformation("📂 Checking kept folder: {Path}", keptPath);
_logger.LogInformation("📂 Directory exists: {Exists}", Directory.Exists(keptPath)); _logger.LogInformation("📂 Directory exists: {Exists}", Directory.Exists(keptPath));
@@ -3389,7 +3389,7 @@ public class LinkPlaylistRequest
return BadRequest(new { error = "Path is required" }); return BadRequest(new { error = "Path is required" });
} }
var keptPath = _configuration["Library:KeptPath"] ?? "/app/kept"; var keptPath = Path.Combine(_configuration["Library:DownloadPath"] ?? "./downloads", "kept");
var fullPath = Path.Combine(keptPath, path); var fullPath = Path.Combine(keptPath, path);
_logger.LogInformation("🗑️ Delete request for: {Path}", fullPath); _logger.LogInformation("🗑️ Delete request for: {Path}", fullPath);
@@ -3453,7 +3453,7 @@ public class LinkPlaylistRequest
return BadRequest(new { error = "Path is required" }); return BadRequest(new { error = "Path is required" });
} }
var keptPath = _configuration["Library:KeptPath"] ?? "/app/kept"; var keptPath = Path.Combine(_configuration["Library:DownloadPath"] ?? "./downloads", "kept");
var fullPath = Path.Combine(keptPath, path); var fullPath = Path.Combine(keptPath, path);
// Security: Ensure the path is within the kept directory // Security: Ensure the path is within the kept directory

View File

@@ -3916,7 +3916,7 @@ public class JellyfinController : ControllerBase
} }
// Build kept folder path: Artist/Album/ // Build kept folder path: Artist/Album/
var keptBasePath = _configuration["Library:KeptPath"] ?? "/app/kept"; var keptBasePath = Path.Combine(_configuration["Library:DownloadPath"] ?? "./downloads", "kept");
var keptArtistPath = Path.Combine(keptBasePath, PathHelper.SanitizeFileName(song.Artist)); var keptArtistPath = Path.Combine(keptBasePath, PathHelper.SanitizeFileName(song.Artist));
var keptAlbumPath = Path.Combine(keptArtistPath, PathHelper.SanitizeFileName(song.Album)); var keptAlbumPath = Path.Combine(keptArtistPath, PathHelper.SanitizeFileName(song.Album));
@@ -4212,7 +4212,7 @@ public class JellyfinController : ControllerBase
var song = await _metadataService.GetSongAsync(provider!, externalId!); var song = await _metadataService.GetSongAsync(provider!, externalId!);
if (song == null) return; if (song == null) return;
var keptBasePath = _configuration["Library:KeptPath"] ?? "/app/kept"; var keptBasePath = Path.Combine(_configuration["Library:DownloadPath"] ?? "./downloads", "kept");
var keptArtistPath = Path.Combine(keptBasePath, PathHelper.SanitizeFileName(song.Artist)); var keptArtistPath = Path.Combine(keptBasePath, PathHelper.SanitizeFileName(song.Artist));
var keptAlbumPath = Path.Combine(keptArtistPath, PathHelper.SanitizeFileName(song.Album)); var keptAlbumPath = Path.Combine(keptArtistPath, PathHelper.SanitizeFileName(song.Album));

View File

@@ -32,8 +32,7 @@
"EnableExternalPlaylists": true "EnableExternalPlaylists": true
}, },
"Library": { "Library": {
"DownloadPath": "./downloads", "DownloadPath": "./downloads"
"KeptPath": "/app/kept"
}, },
"Qobuz": { "Qobuz": {
"UserAuthToken": "your-qobuz-token", "UserAuthToken": "your-qobuz-token",