Compare commits
2 Commits
d501015b82
...
0ab0a029c4
Author | SHA1 | Date | |
---|---|---|---|
|
0ab0a029c4 | ||
|
2f018d131e |
@@ -7,7 +7,7 @@ public partial class ApplicationLayout
|
||||
[CascadingParameter]
|
||||
public BaseLayout? BaseLayout { get; set; }
|
||||
public bool DrawerOpen { get; set; } = true;
|
||||
public string AppText { get; set; } = "YouTube Import";
|
||||
public string AppText { get; set; } = "YouTube Manager";
|
||||
|
||||
private void ToggleDrawerOpen()
|
||||
{
|
||||
|
@@ -24,7 +24,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Library size:</td>
|
||||
<td>@Suffix.BytesToSizeSuffix(_libraryInformation.TotalSizeBytes)</td>
|
||||
<td>@($"{Suffix.BytesToSizeSuffix(_libraryInformation.TotalSizeBytes)} ({_libraryInformation.TotalSizeBytes} bytes)")</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@@ -2,6 +2,7 @@ using DotBased.Monads;
|
||||
using Manager.App.Models.Library;
|
||||
using Manager.App.Models.Settings;
|
||||
using Manager.Data.Contexts;
|
||||
using Manager.Data.Entities.LibraryContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
@@ -45,13 +46,21 @@ public class LibraryService : ILibraryService
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e is OperationCanceledException)
|
||||
{
|
||||
return ResultError.Fail("Library service operation cancelled");
|
||||
}
|
||||
return HandleException(e);
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogError(e, "Failed to get library information");
|
||||
return ResultError.Fail("Failed to get library information");
|
||||
public async Task<Result<List<ClientAccountEntity>>> GetAccountsAsync(int total = 20, int offset = 0, CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
await using var context = await _dbContextFactory.CreateDbContextAsync(cancellationToken);
|
||||
var orderedAccounts = context.Accounts.OrderBy(x => x.Id).Skip(offset).Take(total);
|
||||
return orderedAccounts.ToList();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return HandleException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +68,7 @@ public class LibraryService : ILibraryService
|
||||
{
|
||||
try
|
||||
{
|
||||
var size = dir.EnumerateFiles("", SearchOption.AllDirectories).Select(f => f.Length).Sum();
|
||||
var size = dir.EnumerateFiles("*", SearchOption.AllDirectories).Select(f => f.Length).Sum();
|
||||
return size;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -68,4 +77,15 @@ public class LibraryService : ILibraryService
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private ResultError HandleException(Exception exception)
|
||||
{
|
||||
if (exception is OperationCanceledException)
|
||||
{
|
||||
return ResultError.Fail("Library service operation cancelled");
|
||||
}
|
||||
|
||||
_logger.LogError(exception, "Failed to get library information");
|
||||
return ResultError.Fail("Failed to get library information");
|
||||
}
|
||||
}
|
15
Manager.App/Services/System/ClientManager.cs
Normal file
15
Manager.App/Services/System/ClientManager.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Manager.YouTube;
|
||||
|
||||
namespace Manager.App.Services.System;
|
||||
|
||||
public class ClientManager : BackgroundService
|
||||
{
|
||||
private readonly List<YouTubeClient> _clients = [];
|
||||
|
||||
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user