Merge pull request #1351 from tidusjar/dev

More fixes for the newsletter. This is final.
pull/1362/head
Jamie 8 years ago committed by GitHub
commit e33b54b8e7

@ -53,7 +53,7 @@ namespace Ombi.Core.Migration.Migrations
EmbyEpisodes = embyEp; EmbyEpisodes = embyEp;
} }
public int Version => 22000; public int Version => 22100;
private IRepository<RecentlyAddedLog> Log { get; } private IRepository<RecentlyAddedLog> Log { get; }
private IRepository<PlexContent> PlexContent { get; } private IRepository<PlexContent> PlexContent { get; }
private IRepository<PlexEpisodes> PlexEpisodes { get; } private IRepository<PlexEpisodes> PlexEpisodes { get; }

@ -276,7 +276,8 @@ namespace Ombi.Services.Jobs
Title = m.Title, Title = m.Title,
Type = Store.Models.Plex.PlexMediaType.Movie, Type = Store.Models.Plex.PlexMediaType.Movie,
Url = m.Url, 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, Type = Store.Models.Plex.PlexMediaType.Show,
Url = t.Url, Url = t.Url,
Seasons = ByteConverterHelper.ReturnBytes(t.Seasons), 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, Title = a.Title,
Type = Store.Models.Plex.PlexMediaType.Artist, Type = Store.Models.Plex.PlexMediaType.Artist,
Url = a.Url, Url = a.Url,
ItemId = "album" ItemId = "album",
AddedAt = DateTime.UtcNow,
}); });
} }
} }

@ -120,7 +120,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
var filteredSeries = series.Where(m => recentlyAdded.All(x => x.ProviderId != m.EmbyId)).ToList(); var filteredSeries = series.Where(m => recentlyAdded.All(x => x.ProviderId != m.EmbyId)).ToList();
var info = new List<EmbyRecentlyAddedModel>(); var info = new List<EmbyRecentlyAddedModel>();
foreach (var m in filteredMovies) foreach (var m in filteredMovies.OrderByDescending(x => x.AddedAt))
{ {
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) =>
Log.Error(exception, "Exception thrown when processing an emby movie for the newsletter, Retrying {0}", 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 else
{ {
foreach (var t in filteredSeries) foreach (var t in filteredSeries.OrderByDescending(x => x.AddedAt))
{ {

@ -127,7 +127,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
// if this is a test make sure we show something // if this is a test make sure we show something
filteredMovies = movie.Take(5).ToList(); 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); var i = Api.GetMetadata(plexSettings.PlexAuthToken, plexSettings.FullUri, m.ItemId);
if (i.Video == null) if (i.Video == null)
@ -194,7 +194,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
// if this is a test make sure we show something // if this is a test make sure we show something
filteredSeries = series.Take(5).ToList(); 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); var i = Api.GetMetadata(plexSettings.PlexAuthToken, plexSettings.FullUri, t.ItemId);
if (i.Directory == null) if (i.Directory == null)

Loading…
Cancel
Save