fix(wizard): 🐛 Fixed the issue where the Application Url wasn't validated in the wizard

#4417
This commit is contained in:
tidusjar 2022-01-14 10:49:52 +00:00
commit 33b8d1111a
3 changed files with 43 additions and 22 deletions

View file

@ -310,15 +310,17 @@ namespace Ombi.Core.Senders
private async Task SendToSonarr(ChildRequests model, SonarrSeries result, SonarrSettings s)
{
// Check to ensure we have the all the seasons, ensure the Sonarr metadata has grabbed all the data
Season existingSeason = null;
foreach (var season in model.SeasonRequests)
{
var attempt = 0;
var existingSeason = result.seasons.FirstOrDefault(x => x.seasonNumber == season.SeasonNumber);
existingSeason = result.seasons.FirstOrDefault(x => x.seasonNumber == season.SeasonNumber);
while (existingSeason == null && attempt < 5)
{
attempt++;
Logger.LogInformation("There was no season numer {0} in Sonarr for title {1}. Will try again as the metadata did not get created", season.SeasonNumber, model.ParentRequest.Title);
result = await SonarrApi.GetSeriesById(result.id, s.ApiKey, s.FullUri);
existingSeason = result.seasons.FirstOrDefault(x => x.seasonNumber == season.SeasonNumber);
await Task.Delay(500);
}
}
@ -348,7 +350,7 @@ namespace Ombi.Core.Senders
foreach (var ep in season.Episodes)
{
var sonarrEp = sonarrEpList.FirstOrDefault(x =>
x.episodeNumber == ep.EpisodeNumber && x.seasonNumber == req.SeasonNumber);
x.episodeNumber == ep.EpisodeNumber && x.seasonNumber == season.SeasonNumber);
if (sonarrEp != null && !sonarrEp.monitored)
{
sonarrEp.monitored = true;
@ -366,9 +368,7 @@ namespace Ombi.Core.Senders
//// NOTE, not sure if needed since ombi ui displays future episodes anyway...
//ourEpisodes.AddRange(unairedEpisodes);
//var distinctEpisodes = ourEpisodes.Distinct().ToList();
//var missingEpisodes = Enumerable.Range(distinctEpisodes.Min(), distinctEpisodes.Count).Except(distinctEpisodes);
//var missingEpisodes = Enumerable.Range(distinctEpisodes.Min(), distinctEpisodes.Count).Except(distinctEpisodes);
if (sonarrEpCount == ourRequestCount /*|| !missingEpisodes.Any()*/)