mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Fixed sonarr not monitoring the latest season #1534
This commit is contained in:
parent
00b1873dac
commit
168c51c293
4 changed files with 67 additions and 2 deletions
|
@ -20,5 +20,6 @@ namespace Ombi.Api.Sonarr
|
||||||
Task<bool> SeasonSearch(int seriesId, int seasonNumber, string apiKey, string baseUrl);
|
Task<bool> SeasonSearch(int seriesId, int seasonNumber, string apiKey, string baseUrl);
|
||||||
Task<bool> SeriesSearch(int seriesId, string apiKey, string baseUrl);
|
Task<bool> SeriesSearch(int seriesId, string apiKey, string baseUrl);
|
||||||
Task<SystemStatus> SystemStatus(string apiKey, string baseUrl);
|
Task<SystemStatus> SystemStatus(string apiKey, string baseUrl);
|
||||||
|
Task<bool> SeasonPass(string apiKey, string baseUrl, SonarrSeries series);
|
||||||
}
|
}
|
||||||
}
|
}
|
41
src/Ombi.Api.Sonarr/Models/SeasonPass.cs
Normal file
41
src/Ombi.Api.Sonarr/Models/SeasonPass.cs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2017 Jamie Rees
|
||||||
|
// File: SeasonPass.cs
|
||||||
|
// Created By: Jamie Rees
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
// a copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
// permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
// the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be
|
||||||
|
// included in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
// ************************************************************************/
|
||||||
|
#endregion
|
||||||
|
namespace Ombi.Api.Sonarr.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class SeasonPass
|
||||||
|
{
|
||||||
|
public SonarrSeries[] series { get; set; }
|
||||||
|
public Monitoringoptions monitoringOptions { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Monitoringoptions
|
||||||
|
{
|
||||||
|
public bool ignoreEpisodesWithFiles { get; set; }
|
||||||
|
public bool ignoreEpisodesWithoutFiles { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Net.Http;
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -199,5 +200,27 @@ namespace Ombi.Api.Sonarr
|
||||||
|
|
||||||
return await Api.Request<SystemStatus>(request);
|
return await Api.Request<SystemStatus>(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> SeasonPass(string apiKey, string baseUrl, SonarrSeries series)
|
||||||
|
{
|
||||||
|
var seasonPass = new SeasonPass
|
||||||
|
{
|
||||||
|
series = new []
|
||||||
|
{
|
||||||
|
series
|
||||||
|
},
|
||||||
|
monitoringOptions = new Monitoringoptions
|
||||||
|
{
|
||||||
|
ignoreEpisodesWithFiles = false,
|
||||||
|
ignoreEpisodesWithoutFiles = false,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var request = new Request("/api/seasonpass", baseUrl, HttpMethod.Post);
|
||||||
|
request.AddHeader("X-Api-Key", apiKey);
|
||||||
|
request.AddJsonBody(seasonPass);
|
||||||
|
|
||||||
|
var content = await Api.RequestContent(request);
|
||||||
|
return content.Equals("ok", StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ namespace Ombi.Core.Senders
|
||||||
}
|
}
|
||||||
if (seriesChanges)
|
if (seriesChanges)
|
||||||
{
|
{
|
||||||
await SonarrApi.UpdateSeries(result, s.ApiKey, s.FullUri);
|
await SonarrApi.SeasonPass(s.ApiKey, s.FullUri, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue