mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
Fixed the outstanding issue on #1995
This commit is contained in:
parent
b015b101ed
commit
a7bc93889b
6 changed files with 29 additions and 10 deletions
|
@ -135,14 +135,13 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
if (existingKey != null)
|
if (existingKey != null)
|
||||||
{
|
{
|
||||||
// The rating key is all good!
|
// The rating key is all good!
|
||||||
existingContent = existingKey;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This means the rating key has changed somehow.
|
// This means the rating key has changed somehow.
|
||||||
// We need to reset the correct keys
|
// Should probably delete this and get the new one
|
||||||
var oldKey = existingContent.Key;
|
var oldKey = existingContent.Key;
|
||||||
existingContent.Key = show.ratingKey;
|
Repo.DeleteWithoutSave(existingContent);
|
||||||
|
|
||||||
// Because we have changed the rating key, we need to change all children too
|
// Because we have changed the rating key, we need to change all children too
|
||||||
var episodeToChange = Repo.GetAllEpisodes().Where(x => x.GrandparentKey == oldKey);
|
var episodeToChange = Repo.GetAllEpisodes().Where(x => x.GrandparentKey == oldKey);
|
||||||
|
@ -150,10 +149,11 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
{
|
{
|
||||||
foreach (var e in episodeToChange)
|
foreach (var e in episodeToChange)
|
||||||
{
|
{
|
||||||
e.GrandparentKey = existingContent.Key;
|
Repo.DeleteWithoutSave(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await Repo.SaveChangesAsync();
|
await Repo.SaveChangesAsync();
|
||||||
|
existingContent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,5 +19,8 @@ namespace Ombi.Store.Repository
|
||||||
Task AddRange(IEnumerable<PlexEpisode> content);
|
Task AddRange(IEnumerable<PlexEpisode> content);
|
||||||
IEnumerable<PlexServerContent> GetWhereContentByCustom(Expression<Func<PlexServerContent, bool>> predicate);
|
IEnumerable<PlexServerContent> GetWhereContentByCustom(Expression<Func<PlexServerContent, bool>> predicate);
|
||||||
Task<PlexServerContent> GetFirstContentByCustom(Expression<Func<PlexServerContent, bool>> predicate);
|
Task<PlexServerContent> GetFirstContentByCustom(Expression<Func<PlexServerContent, bool>> predicate);
|
||||||
|
Task DeleteEpisode(PlexEpisode content);
|
||||||
|
void DeleteWithoutSave(PlexServerContent content);
|
||||||
|
void DeleteWithoutSave(PlexEpisode content);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -103,12 +103,29 @@ namespace Ombi.Store.Repository
|
||||||
return Db.PlexEpisode.Include(x => x.Series).AsQueryable();
|
return Db.PlexEpisode.Include(x => x.Series).AsQueryable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteWithoutSave(PlexServerContent content)
|
||||||
|
{
|
||||||
|
Db.PlexServerContent.Remove(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteWithoutSave(PlexEpisode content)
|
||||||
|
{
|
||||||
|
Db.PlexEpisode.Remove(content);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<PlexEpisode> Add(PlexEpisode content)
|
public async Task<PlexEpisode> Add(PlexEpisode content)
|
||||||
{
|
{
|
||||||
await Db.PlexEpisode.AddAsync(content);
|
await Db.PlexEpisode.AddAsync(content);
|
||||||
await Db.SaveChangesAsync();
|
await Db.SaveChangesAsync();
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task DeleteEpisode(PlexEpisode content)
|
||||||
|
{
|
||||||
|
Db.PlexEpisode.Remove(content);
|
||||||
|
await Db.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<PlexEpisode> GetEpisodeByKey(int key)
|
public async Task<PlexEpisode> GetEpisodeByKey(int key)
|
||||||
{
|
{
|
||||||
return await Db.PlexEpisode.FirstOrDefaultAsync(x => x.Key == key);
|
return await Db.PlexEpisode.FirstOrDefaultAsync(x => x.Key == key);
|
||||||
|
|
|
@ -57,7 +57,6 @@ namespace Ombi
|
||||||
config = new LoggerConfiguration()
|
config = new LoggerConfiguration()
|
||||||
.MinimumLevel.Debug()
|
.MinimumLevel.Debug()
|
||||||
.WriteTo.RollingFile(Path.Combine(env.ContentRootPath, "Logs", "log-{Date}.txt"))
|
.WriteTo.RollingFile(Path.Combine(env.ContentRootPath, "Logs", "log-{Date}.txt"))
|
||||||
.WriteTo.SQLite("Ombi.db", "Logs", LogEventLevel.Debug)
|
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -65,7 +64,6 @@ namespace Ombi
|
||||||
config = new LoggerConfiguration()
|
config = new LoggerConfiguration()
|
||||||
.MinimumLevel.Debug()
|
.MinimumLevel.Debug()
|
||||||
.WriteTo.RollingFile(Path.Combine(StoragePath.StoragePath, "Logs", "log-{Date}.txt"))
|
.WriteTo.RollingFile(Path.Combine(StoragePath.StoragePath, "Logs", "log-{Date}.txt"))
|
||||||
.WriteTo.SQLite(Path.Combine(StoragePath.StoragePath, "Ombi.db"), "Logs", LogEventLevel.Debug)
|
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
}
|
}
|
||||||
Log.Logger = config;
|
Log.Logger = config;
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": false,
|
"IncludeScopes": false,
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Debug",
|
"Default": "Trace",
|
||||||
"System": "Information",
|
"System": "Trace",
|
||||||
"Microsoft": "Information"
|
"Microsoft": "Warning"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Debug",
|
"Default": "Debug",
|
||||||
"System": "Debug",
|
"System": "Debug",
|
||||||
"Microsoft": "None"
|
"Microsoft": "None",
|
||||||
|
"Hangfire": "None"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ApplicationSettings": {
|
"ApplicationSettings": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue