Prepare Linux deployment with yt-dlp and persistent downloads

This commit is contained in:
Michal Vrba
2026-10-19 17:23:30 +02:00
parent 471010c536
commit a26c584462
15 changed files with 331 additions and 139 deletions
@@ -7,13 +7,11 @@ namespace TuneRipper.Api.Controllers;
[Route("api/[controller]")]
public class DownloadController : ControllerBase
{
private readonly IWebHostEnvironment _environment;
private readonly ILogger<DownloadController> _logger;
private readonly ISessionService _sessionService;
public DownloadController(IWebHostEnvironment environment, ILogger<DownloadController> logger, ISessionService sessionService)
public DownloadController(ILogger<DownloadController> logger, ISessionService sessionService)
{
_environment = environment;
_logger = logger;
_sessionService = sessionService;
}
@@ -203,7 +201,7 @@ public class DownloadController : ControllerBase
try
{
// Check in the legacy downloads directory first
var downloadsDir = Path.Combine(_environment.WebRootPath, "downloads");
var downloadsDir = _sessionService.GetDownloadsRootPath();
if (Directory.Exists(downloadsDir))
{
@@ -389,7 +387,7 @@ public class DownloadController : ControllerBase
try
{
var downloadsDir = Path.Combine(_environment.WebRootPath, "downloads");
var downloadsDir = _sessionService.GetDownloadsRootPath();
if (!Directory.Exists(downloadsDir))
{
@@ -529,7 +527,7 @@ public class DownloadController : ControllerBase
try
{
var downloadsDir = Path.Combine(_environment.WebRootPath, "downloads");
var downloadsDir = _sessionService.GetDownloadsRootPath();
var deletedCount = 0;
if (!Directory.Exists(downloadsDir))
@@ -602,4 +600,4 @@ public class DownloadController : ControllerBase
}
return $"{len:0.##} {sizes[order]}";
}
}
}