add more logging (#1224)

* more logging

* update dependencies
This commit is contained in:
Jason Dove
2023-04-01 12:24:15 -05:00
committed by GitHub
parent 307940d732
commit e93d678b97
16 changed files with 73 additions and 42 deletions
@@ -1,17 +1,24 @@
using Dapper;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Errors;
using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.Core.Metadata;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Infrastructure.Data.Repositories;
public class OtherVideoRepository : IOtherVideoRepository
{
private readonly IDbContextFactory<TvContext> _dbContextFactory;
private readonly ILogger<OtherVideoRepository> _logger;
public OtherVideoRepository(IDbContextFactory<TvContext> dbContextFactory) => _dbContextFactory = dbContextFactory;
public OtherVideoRepository(IDbContextFactory<TvContext> dbContextFactory, ILogger<OtherVideoRepository> logger)
{
_dbContextFactory = dbContextFactory;
_logger = logger;
}
public async Task<Either<BaseError, MediaItemScanResult<OtherVideo>>> GetOrAdd(
LibraryPath libraryPath,
@@ -177,13 +184,18 @@ public class OtherVideoRepository : IOtherVideoRepository
.ToListAsync();
}
private static async Task<Either<BaseError, MediaItemScanResult<OtherVideo>>> AddOtherVideo(
private async Task<Either<BaseError, MediaItemScanResult<OtherVideo>>> AddOtherVideo(
TvContext dbContext,
int libraryPathId,
string path)
{
try
{
if (await MediaItemRepository.MediaFileAlreadyExists(path, libraryPathId, dbContext, _logger))
{
return new MediaFileAlreadyExists();
}
var otherVideo = new OtherVideo
{
LibraryPathId = libraryPathId,