mirror of https://github.com/ErsatzTV/ErsatzTV.git
11 changed files with 73 additions and 2 deletions
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
namespace ErsatzTV.Scanner.Application.FFmpeg; |
||||
|
||||
public record RefreshFFmpegCapabilities : IRequest; |
||||
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
using ErsatzTV.Core; |
||||
using ErsatzTV.Core.Domain; |
||||
using ErsatzTV.Core.Interfaces.Metadata; |
||||
using ErsatzTV.FFmpeg.Capabilities; |
||||
using ErsatzTV.Infrastructure.Data; |
||||
using ErsatzTV.Infrastructure.Extensions; |
||||
using Microsoft.EntityFrameworkCore; |
||||
|
||||
namespace ErsatzTV.Scanner.Application.FFmpeg; |
||||
|
||||
public class RefreshFFmpegCapabilitiesHandler( |
||||
IDbContextFactory<TvContext> dbContextFactory, |
||||
IHardwareCapabilitiesFactory hardwareCapabilitiesFactory, |
||||
ILocalStatisticsProvider localStatisticsProvider) |
||||
: IRequestHandler<RefreshFFmpegCapabilities> |
||||
{ |
||||
public async Task Handle(RefreshFFmpegCapabilities request, CancellationToken cancellationToken) |
||||
{ |
||||
hardwareCapabilitiesFactory.ClearCache(); |
||||
|
||||
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken); |
||||
|
||||
Option<string> maybeFFmpegPath = await dbContext.ConfigElements |
||||
.GetValue<string>(ConfigElementKey.FFmpegPath, cancellationToken) |
||||
.FilterT(File.Exists); |
||||
|
||||
foreach (string ffmpegPath in maybeFFmpegPath) |
||||
{ |
||||
_ = await hardwareCapabilitiesFactory.GetFFmpegCapabilities(ffmpegPath); |
||||
|
||||
Option<string> maybeFFprobePath = await dbContext.ConfigElements |
||||
.GetValue<string>(ConfigElementKey.FFprobePath, cancellationToken) |
||||
.FilterT(File.Exists); |
||||
|
||||
foreach (string ffprobePath in maybeFFprobePath) |
||||
{ |
||||
Either<BaseError, MediaVersion> result = await localStatisticsProvider.GetStatistics( |
||||
ffprobePath, |
||||
Path.Combine(FileSystemLayout.ResourcesCacheFolder, "test.avs")); |
||||
|
||||
hardwareCapabilitiesFactory.SetAviSynthInstalled(result.IsRight); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,5 +1,6 @@
@@ -1,5 +1,6 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> |
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=application_005Cemby_005Ccommands/@EntryIndexedValue">True</s:Boolean> |
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=application_005Cffmpeg_005Ccommands/@EntryIndexedValue">True</s:Boolean> |
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=application_005Cjellyfin_005Ccommands/@EntryIndexedValue">True</s:Boolean> |
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=application_005Cmediasources_005Ccommands/@EntryIndexedValue">True</s:Boolean> |
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=application_005Cplex_005Ccommands/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
||||
Loading…
Reference in new issue