mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Added some logging to sonarr !cosmetic
This commit is contained in:
parent
8d5dfe9424
commit
d67e9ed0f8
1 changed files with 6 additions and 5 deletions
|
@ -53,22 +53,23 @@ namespace Ombi.Schedule.Jobs.Sonarr
|
|||
var entites = ids.Select(id => new SonarrCache { TvDbId = id }).ToList();
|
||||
|
||||
await _ctx.SonarrCache.AddRangeAsync(entites);
|
||||
|
||||
var episodesToAdd = new List<SonarrEpisodeCache>();
|
||||
|
||||
await _ctx.Database.ExecuteSqlCommandAsync("DELETE FROM SonarrEpisodeCache");
|
||||
foreach (var s in sonarrSeries)
|
||||
{
|
||||
_log.LogDebug("Syncing series: {0}", s.title);
|
||||
var episodes = await _api.GetEpisodes(s.id, settings.ApiKey, settings.FullUri);
|
||||
var monitoredEpisodes = episodes.Where(x => x.monitored || x.hasFile);
|
||||
episodesToAdd.AddRange(monitoredEpisodes.Select(episode => new SonarrEpisodeCache
|
||||
_log.LogDebug("We have the episodes, adding to db transaction");
|
||||
await _ctx.SonarrEpisodeCache.AddRangeAsync(monitoredEpisodes.Select(episode => new SonarrEpisodeCache
|
||||
{
|
||||
EpisodeNumber = episode.episodeNumber,
|
||||
SeasonNumber = episode.seasonNumber,
|
||||
TvDbId = s.tvdbId
|
||||
}));
|
||||
}
|
||||
|
||||
await _ctx.SonarrEpisodeCache.AddRangeAsync(episodesToAdd);
|
||||
|
||||
_log.LogDebug("Commiting the transaction");
|
||||
await _ctx.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue