diff --git a/Ombi.Core.Migration/Migrations/Version2210.cs b/Ombi.Core.Migration/Migrations/Version2210.cs index 258e4da46..94592174a 100644 --- a/Ombi.Core.Migration/Migrations/Version2210.cs +++ b/Ombi.Core.Migration/Migrations/Version2210.cs @@ -53,7 +53,7 @@ namespace Ombi.Core.Migration.Migrations EmbyEpisodes = embyEp; } - public int Version => 22000; + public int Version => 22100; private IRepository Log { get; } private IRepository PlexContent { get; } private IRepository PlexEpisodes { get; } diff --git a/Ombi.Services/Jobs/PlexContentCacher.cs b/Ombi.Services/Jobs/PlexContentCacher.cs index 5b6dc55d4..d4f872fc2 100644 --- a/Ombi.Services/Jobs/PlexContentCacher.cs +++ b/Ombi.Services/Jobs/PlexContentCacher.cs @@ -276,7 +276,8 @@ namespace Ombi.Services.Jobs Title = m.Title, Type = Store.Models.Plex.PlexMediaType.Movie, Url = m.Url, - ItemId = m.ItemId + ItemId = m.ItemId, + AddedAt = DateTime.UtcNow, }); } } @@ -318,7 +319,8 @@ namespace Ombi.Services.Jobs Type = Store.Models.Plex.PlexMediaType.Show, Url = t.Url, Seasons = ByteConverterHelper.ReturnBytes(t.Seasons), - ItemId = t.ItemId + ItemId = t.ItemId, + AddedAt = DateTime.UtcNow, }); } } @@ -360,7 +362,8 @@ namespace Ombi.Services.Jobs Title = a.Title, Type = Store.Models.Plex.PlexMediaType.Artist, Url = a.Url, - ItemId = "album" + ItemId = "album", + AddedAt = DateTime.UtcNow, }); } } diff --git a/Ombi.Services/Jobs/RecentlyAddedNewsletter/EmbyRecentlyAddedNewsletter.cs b/Ombi.Services/Jobs/RecentlyAddedNewsletter/EmbyRecentlyAddedNewsletter.cs index c4506e843..158d77f0d 100644 --- a/Ombi.Services/Jobs/RecentlyAddedNewsletter/EmbyRecentlyAddedNewsletter.cs +++ b/Ombi.Services/Jobs/RecentlyAddedNewsletter/EmbyRecentlyAddedNewsletter.cs @@ -120,7 +120,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter var filteredSeries = series.Where(m => recentlyAdded.All(x => x.ProviderId != m.EmbyId)).ToList(); var info = new List(); - foreach (var m in filteredMovies) + foreach (var m in filteredMovies.OrderByDescending(x => x.AddedAt)) { var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception thrown when processing an emby movie for the newsletter, Retrying {0}", timespan)); @@ -210,7 +210,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter } else { - foreach (var t in filteredSeries) + foreach (var t in filteredSeries.OrderByDescending(x => x.AddedAt)) { diff --git a/Ombi.Services/Jobs/RecentlyAddedNewsletter/PlexRecentlyAddedNewsletter.cs b/Ombi.Services/Jobs/RecentlyAddedNewsletter/PlexRecentlyAddedNewsletter.cs index 6eda44bec..ca88b4c2b 100644 --- a/Ombi.Services/Jobs/RecentlyAddedNewsletter/PlexRecentlyAddedNewsletter.cs +++ b/Ombi.Services/Jobs/RecentlyAddedNewsletter/PlexRecentlyAddedNewsletter.cs @@ -127,7 +127,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter // if this is a test make sure we show something filteredMovies = movie.Take(5).ToList(); } - foreach (var m in filteredMovies) + foreach (var m in filteredMovies.OrderByDescending(x => x.AddedAt)) { var i = Api.GetMetadata(plexSettings.PlexAuthToken, plexSettings.FullUri, m.ItemId); if (i.Video == null) @@ -194,7 +194,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter // if this is a test make sure we show something filteredSeries = series.Take(5).ToList(); } - foreach (var t in filteredSeries) + foreach (var t in filteredSeries.OrderByDescending(x => x.AddedAt)) { var i = Api.GetMetadata(plexSettings.PlexAuthToken, plexSettings.FullUri, t.ItemId); if (i.Directory == null)