[REFACTOR]
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
<MudNavMenu>
|
||||
<MudNavLink Href="/" Icon="@Icons.Material.Filled.Home" Match="NavLinkMatch.All">Home</MudNavLink>
|
||||
<MudNavGroup Title="Library" Expanded Icon="@Icons.Custom.Brands.YouTube" IconColor="Color.Error">
|
||||
<MudNavLink Href="/Search" Icon="@Icons.Material.Filled.Search" Match="NavLinkMatch.All" Disabled>Search</MudNavLink>
|
||||
<MudNavLink Href="/Accounts" Icon="@Icons.Material.Filled.AccountBox" Match="NavLinkMatch.All">Accounts</MudNavLink>
|
||||
<MudNavLink Href="/Channels" Icon="@Icons.Material.Filled.AccountCircle" Match="NavLinkMatch.All">Channels</MudNavLink>
|
||||
<MudNavLink Href="/Playlists" Icon="@Icons.Material.Filled.ViewList" Match="NavLinkMatch.All">Playlists</MudNavLink>
|
||||
<MudNavLink Href="/Playlists" Icon="@Icons.Material.Filled.ViewList" Match="NavLinkMatch.All" Disabled>Playlists</MudNavLink>
|
||||
<MudNavLink Href="/Library" Icon="@Icons.Material.Filled.Info" Match="NavLinkMatch.All" IconColor="Color.Info">Info</MudNavLink>
|
||||
</MudNavGroup>
|
||||
<MudNavGroup Title="Application" Expanded Icon="@Icons.Material.Filled.SettingsSystemDaydream" IconColor="Color.Primary">
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 readonly CacheService _cacheService;
|
||||
@@ -24,13 +23,13 @@ public class LibraryService : ILibraryService
|
||||
public LibraryService(ILogger<LibraryService> logger, IOptions<LibrarySettings> librarySettings, IDbContextFactory<LibraryDbContext> contextFactory, CacheService cacheService)
|
||||
{
|
||||
_logger = logger;
|
||||
_librarySettings = librarySettings.Value;
|
||||
var librarySettings1 = librarySettings.Value;
|
||||
_dbContextFactory = contextFactory;
|
||||
_cacheService = cacheService;
|
||||
_libraryDirectory = Directory.CreateDirectory(_librarySettings.Path);
|
||||
_libraryDirectory = Directory.CreateDirectory(librarySettings1.Path);
|
||||
logger.LogDebug("Library directory: {LibraryWorkingDir}", _libraryDirectory.FullName);
|
||||
Directory.CreateDirectory(Path.Combine(_librarySettings.Path, LibraryConstants.Directories.SubDirMedia));
|
||||
Directory.CreateDirectory(Path.Combine(_librarySettings.Path, LibraryConstants.Directories.SubDirChannels));
|
||||
Directory.CreateDirectory(Path.Combine(librarySettings1.Path, LibraryConstants.Directories.SubDirMedia));
|
||||
Directory.CreateDirectory(Path.Combine(librarySettings1.Path, LibraryConstants.Directories.SubDirChannels));
|
||||
}
|
||||
|
||||
private async Task AddWebImagesAsync(LibraryDbContext context, List<WebImage> images, string foreignKey, string libSubDir, string fileType, string subDir)
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace Manager.YouTube.Util.Cipher;
|
||||
public partial class CipherDecoder
|
||||
{
|
||||
public required string Version { get; init; }
|
||||
public required string OriginalRelativeUrl { get; init; }
|
||||
public readonly IReadOnlySet<ICipherOperation> Operations;
|
||||
|
||||
private CipherDecoder(IEnumerable<ICipherOperation> operations)
|
||||
@@ -25,7 +24,6 @@ public partial class CipherDecoder
|
||||
var operations = await GetCipherOperations(relativeUrl, client);
|
||||
var decoder = new CipherDecoder(operations)
|
||||
{
|
||||
OriginalRelativeUrl = relativeUrl,
|
||||
Version = version
|
||||
};
|
||||
return decoder;
|
||||
|
||||
@@ -9,7 +9,7 @@ public static class CipherManager
|
||||
private static readonly CipherDecoderCollection LoadedCiphers = [];
|
||||
private static readonly ILogger Logger = LogService.RegisterLogger(typeof(CipherManager));
|
||||
|
||||
public static async Task<Result<CipherDecoder>> GetDecoderAsync(ClientState clientState)
|
||||
public static async Task<Result<CipherDecoder>> GetDecoderAsync(ClientState clientState, YouTubeClient? client = null)
|
||||
{
|
||||
var relativePlayerJsUrl = clientState.PlayerJsUrl;
|
||||
if (string.IsNullOrEmpty(relativePlayerJsUrl))
|
||||
@@ -26,7 +26,7 @@ public static class CipherManager
|
||||
|
||||
try
|
||||
{
|
||||
var decoder = await CipherDecoder.CreateAsync(relativePlayerJsUrl, version);
|
||||
var decoder = await CipherDecoder.CreateAsync(relativePlayerJsUrl, version, client);
|
||||
LoadedCiphers.Add(decoder);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -396,7 +396,7 @@ public sealed class YouTubeClient : IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
var decipherDecoderResult = await CipherManager.GetDecoderAsync(state);
|
||||
var decipherDecoderResult = await CipherManager.GetDecoderAsync(state, this);
|
||||
if (!decipherDecoderResult.IsSuccess)
|
||||
{
|
||||
_logger.Warning(decipherDecoderResult.Error?.Description ?? "Failed to get the cipher decoder!");
|
||||
|
||||
Reference in New Issue
Block a user