mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Started to add the specify Sonarr root folders.
This commit is contained in:
parent
ee66cd66e9
commit
1c6e75a413
16 changed files with 316 additions and 59 deletions
|
@ -47,5 +47,6 @@ namespace Ombi.Core
|
|||
public const string WatcherQueued = nameof(WatcherQueued);
|
||||
public const string GetPlexRequestSettings = nameof(GetPlexRequestSettings);
|
||||
public const string LastestProductVersion = nameof(LastestProductVersion);
|
||||
public const string SonarrRootFolders = nameof(SonarrRootFolders);
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ namespace Ombi.Core.SettingModels
|
|||
public string QualityProfile { get; set; }
|
||||
public bool SeasonFolders { get; set; }
|
||||
public string RootPath { get; set; }
|
||||
|
||||
public string RootFolder { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -51,7 +51,7 @@ namespace Ombi.Core
|
|||
|
||||
public async Task<SonarrAddSeries> SendToSonarr(SonarrSettings sonarrSettings, RequestedModel model)
|
||||
{
|
||||
return await SendToSonarr(sonarrSettings, model, string.Empty);
|
||||
return await SendToSonarr(sonarrSettings, model, string.Empty, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -61,7 +61,7 @@ namespace Ombi.Core
|
|||
/// <param name="model"></param>
|
||||
/// <param name="qualityId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<SonarrAddSeries> SendToSonarr(SonarrSettings sonarrSettings, RequestedModel model, string qualityId)
|
||||
public async Task<SonarrAddSeries> SendToSonarr(SonarrSettings sonarrSettings, RequestedModel model, string qualityId, string rootFolderId)
|
||||
{
|
||||
var qualityProfile = 0;
|
||||
var episodeRequest = model.Episodes.Any();
|
||||
|
@ -82,6 +82,17 @@ namespace Ombi.Core
|
|||
var latest = model.SeasonsRequested?.Equals("Latest", StringComparison.CurrentCultureIgnoreCase);
|
||||
var specificSeasonRequest = model.SeasonList?.Any();
|
||||
|
||||
var rootFolder = 0;
|
||||
if (!string.IsNullOrEmpty(rootFolderId))
|
||||
{
|
||||
int.TryParse(qualityId, out rootFolder);
|
||||
}
|
||||
|
||||
if (rootFolder <= 0)
|
||||
{
|
||||
int.TryParse(sonarrSettings.RootFolder, out rootFolder);
|
||||
}
|
||||
|
||||
if (episodeRequest)
|
||||
{
|
||||
// Does series exist?
|
||||
|
@ -96,7 +107,7 @@ namespace Ombi.Core
|
|||
|
||||
// Series doesn't exist, need to add it as unmonitored.
|
||||
var addResult = await Task.Run(() => SonarrApi.AddSeries(model.ProviderId, model.Title, qualityProfile,
|
||||
sonarrSettings.SeasonFolders, sonarrSettings.RootPath, 0, new int[0], sonarrSettings.ApiKey,
|
||||
sonarrSettings.SeasonFolders, sonarrSettings.RootPath, 0, rootFolder, new int[0], sonarrSettings.ApiKey,
|
||||
sonarrSettings.FullUri, false));
|
||||
|
||||
|
||||
|
@ -125,7 +136,7 @@ namespace Ombi.Core
|
|||
{
|
||||
// Set the series as monitored with a season count as 0 so it doesn't search for anything
|
||||
SonarrApi.AddSeriesNew(model.ProviderId, model.Title, qualityProfile,
|
||||
sonarrSettings.SeasonFolders, sonarrSettings.RootPath, new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13}, sonarrSettings.ApiKey,
|
||||
sonarrSettings.SeasonFolders, sonarrSettings.RootPath, rootFolder, new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13}, sonarrSettings.ApiKey,
|
||||
sonarrSettings.FullUri);
|
||||
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
|
|
|
@ -49,12 +49,12 @@ namespace Ombi.Core
|
|||
private ISickRageApi SickrageApi { get; }
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public async Task<SonarrAddSeries> SendToSonarr(SonarrSettings sonarrSettings, RequestedModel model)
|
||||
public async Task<SonarrAddSeries> SendToSonarr(SonarrSettings sonarrSettings, RequestedModel model, string rootFolderId = null)
|
||||
{
|
||||
return await SendToSonarr(sonarrSettings, model, string.Empty);
|
||||
return await SendToSonarr(sonarrSettings, model, string.Empty, rootFolderId);
|
||||
}
|
||||
|
||||
public async Task<SonarrAddSeries> SendToSonarr(SonarrSettings sonarrSettings, RequestedModel model, string qualityId)
|
||||
public async Task<SonarrAddSeries> SendToSonarr(SonarrSettings sonarrSettings, RequestedModel model, string qualityId, string rootFolderId)
|
||||
{
|
||||
var qualityProfile = 0;
|
||||
var episodeRequest = model.Episodes.Any();
|
||||
|
@ -67,6 +67,17 @@ namespace Ombi.Core
|
|||
{
|
||||
int.TryParse(sonarrSettings.QualityProfile, out qualityProfile);
|
||||
}
|
||||
var rootFolder = 0;
|
||||
if (!string.IsNullOrEmpty(rootFolderId))
|
||||
{
|
||||
int.TryParse(qualityId, out rootFolder);
|
||||
}
|
||||
|
||||
if (rootFolder <= 0)
|
||||
{
|
||||
int.TryParse(sonarrSettings.RootFolder, out rootFolder);
|
||||
}
|
||||
|
||||
|
||||
var series = await GetSonarrSeries(sonarrSettings, model.ProviderId);
|
||||
|
||||
|
@ -84,7 +95,7 @@ namespace Ombi.Core
|
|||
|
||||
// Series doesn't exist, need to add it as unmonitored.
|
||||
var addResult = await Task.Run(() => SonarrApi.AddSeries(model.ProviderId, model.Title, qualityProfile,
|
||||
sonarrSettings.SeasonFolders, sonarrSettings.RootPath, 0, new int[0], sonarrSettings.ApiKey,
|
||||
sonarrSettings.SeasonFolders, sonarrSettings.RootPath, rootFolder, 0, new int[0], sonarrSettings.ApiKey,
|
||||
sonarrSettings.FullUri, false));
|
||||
|
||||
|
||||
|
@ -156,7 +167,7 @@ namespace Ombi.Core
|
|||
|
||||
|
||||
var result = SonarrApi.AddSeries(model.ProviderId, model.Title, qualityProfile,
|
||||
sonarrSettings.SeasonFolders, sonarrSettings.RootPath, model.SeasonCount, model.SeasonList, sonarrSettings.ApiKey,
|
||||
sonarrSettings.SeasonFolders, sonarrSettings.RootPath, rootFolder, model.SeasonCount, model.SeasonList, sonarrSettings.ApiKey,
|
||||
sonarrSettings.FullUri, true, true);
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue