Files
YouTube-Manager/Manager.App/Services/LibraryService.cs
2025-08-18 01:56:41 +02:00

34 lines
1.3 KiB
C#

using DotBased.Monads;
using Manager.App.Models.Library;
using Manager.App.Models.Settings;
using Manager.Data.Contexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
namespace Manager.App.Services;
public class LibraryService : ILibraryService
{
private readonly ILogger<LibraryService> _logger;
private readonly LibrarySettings _librarySettings;
private readonly IDbContextFactory<LibraryDbContext> _dbContextFactory;
private readonly DirectoryInfo _libraryDirectory;
private const string SubDirMedia = "Media";
private const string SubDirChannels = "Channels";
public LibraryService(ILogger<LibraryService> logger, IOptions<LibrarySettings> librarySettings, IDbContextFactory<LibraryDbContext> contextFactory)
{
_logger = logger;
_librarySettings = librarySettings.Value;
_dbContextFactory = contextFactory;
_libraryDirectory = Directory.CreateDirectory(Path.Combine(_librarySettings.Path, SubDirMedia));
_libraryDirectory = Directory.CreateDirectory(Path.Combine(_librarySettings.Path, SubDirChannels));
}
public async Task<Result<LibraryInformation>> GetLibraryInfoAsync()
{
await using var context = await _dbContextFactory.CreateDbContextAsync();
//TODO: Get library info
return ResultError.Fail("Not implemented!");
}
}