mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
Fixed #3421
This commit is contained in:
parent
0cec163324
commit
77f8d76590
2 changed files with 15 additions and 13 deletions
|
@ -1,7 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Api.Emby;
|
using Ombi.Api.Emby;
|
||||||
using Ombi.Api.TheMovieDb;
|
using Ombi.Api.TheMovieDb;
|
||||||
|
@ -83,13 +85,13 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
private async Task StartPlex()
|
private async Task StartPlex()
|
||||||
{
|
{
|
||||||
// Ensure we check that we have not linked this item to a request
|
// Ensure we check that we have not linked this item to a request
|
||||||
var allMovies = _plexRepo.GetAll().Where(x =>
|
var allMovies = await _plexRepo.GetAll().Where(x =>
|
||||||
x.Type == PlexMediaTypeEntity.Movie && x.RequestId == null && (x.TheMovieDbId == null || x.ImdbId == null));
|
x.Type == PlexMediaTypeEntity.Movie && x.RequestId == null && (x.TheMovieDbId == null || x.ImdbId == null)).ToListAsync();
|
||||||
await StartPlexMovies(allMovies);
|
await StartPlexMovies(allMovies);
|
||||||
|
|
||||||
// Now Tv
|
// Now Tv
|
||||||
var allTv = _plexRepo.GetAll().Where(x =>
|
var allTv = await _plexRepo.GetAll().Where(x =>
|
||||||
x.Type == PlexMediaTypeEntity.Show && x.RequestId == null && (x.TheMovieDbId == null || x.ImdbId == null || x.TvDbId == null));
|
x.Type == PlexMediaTypeEntity.Show && x.RequestId == null && (x.TheMovieDbId == null || x.ImdbId == null || x.TvDbId == null)).ToListAsync();
|
||||||
await StartPlexTv(allTv);
|
await StartPlexTv(allTv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
await StartEmbyTv();
|
await StartEmbyTv();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task StartPlexTv(IQueryable<PlexServerContent> allTv)
|
private async Task StartPlexTv(List<PlexServerContent> allTv)
|
||||||
{
|
{
|
||||||
foreach (var show in allTv)
|
foreach (var show in allTv)
|
||||||
{
|
{
|
||||||
|
@ -138,8 +140,8 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
|
|
||||||
private async Task StartEmbyTv()
|
private async Task StartEmbyTv()
|
||||||
{
|
{
|
||||||
var allTv = _embyRepo.GetAll().Where(x =>
|
var allTv = await _embyRepo.GetAll().Where(x =>
|
||||||
x.Type == EmbyMediaType.Series && (!x.TheMovieDbId.HasValue() || !x.ImdbId.HasValue() || !x.TvDbId.HasValue()));
|
x.Type == EmbyMediaType.Series && (!x.TheMovieDbId.HasValue() || !x.ImdbId.HasValue() || !x.TvDbId.HasValue())).ToListAsync();
|
||||||
|
|
||||||
foreach (var show in allTv)
|
foreach (var show in allTv)
|
||||||
{
|
{
|
||||||
|
@ -171,7 +173,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task StartPlexMovies(IQueryable<PlexServerContent> allMovies)
|
private async Task StartPlexMovies(List<PlexServerContent> allMovies)
|
||||||
{
|
{
|
||||||
foreach (var movie in allMovies)
|
foreach (var movie in allMovies)
|
||||||
{
|
{
|
||||||
|
@ -203,8 +205,8 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
|
|
||||||
private async Task StartEmbyMovies(EmbySettings settings)
|
private async Task StartEmbyMovies(EmbySettings settings)
|
||||||
{
|
{
|
||||||
var allMovies = _embyRepo.GetAll().Where(x =>
|
var allMovies = await _embyRepo.GetAll().Where(x =>
|
||||||
x.Type == EmbyMediaType.Movie && (!x.TheMovieDbId.HasValue() || !x.ImdbId.HasValue()));
|
x.Type == EmbyMediaType.Movie && (!x.TheMovieDbId.HasValue() || !x.ImdbId.HasValue())).ToListAsync();
|
||||||
foreach (var movie in allMovies)
|
foreach (var movie in allMovies)
|
||||||
{
|
{
|
||||||
movie.ImdbId.HasValue();
|
movie.ImdbId.HasValue();
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace Ombi.Store.Repository
|
||||||
|
|
||||||
public async Task ExecuteSql(string sql)
|
public async Task ExecuteSql(string sql)
|
||||||
{
|
{
|
||||||
await _ctx.Database.ExecuteSqlCommandAsync(sql);
|
await _ctx.Database.ExecuteSqlRawAsync(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<int> InternalSaveChanges()
|
protected async Task<int> InternalSaveChanges()
|
||||||
|
@ -96,10 +96,10 @@ namespace Ombi.Store.Repository
|
||||||
|
|
||||||
var result = await policy.ExecuteAndCaptureAsync(async () =>
|
var result = await policy.ExecuteAndCaptureAsync(async () =>
|
||||||
{
|
{
|
||||||
using (var tran = await _ctx.Database.BeginTransactionAsync())
|
//using (var tran = await _ctx.Database.BeginTransactionAsync())
|
||||||
{
|
{
|
||||||
var r = await _ctx.SaveChangesAsync();
|
var r = await _ctx.SaveChangesAsync();
|
||||||
tran.Commit();
|
//tran.Commit();
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue