|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
|
|
|
using Ombi.Api.Radarr;
|
|
|
|
|
using Ombi.Api.Radarr.Models;
|
|
|
|
|
using Ombi.Attributes;
|
|
|
|
@ -24,6 +23,7 @@ namespace Ombi.Controllers.External
|
|
|
|
|
RadarrApi = radarr;
|
|
|
|
|
RadarrSettings = settings;
|
|
|
|
|
Cache = mem;
|
|
|
|
|
RadarrSettings.ClearCache();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IRadarrApi RadarrApi { get; }
|
|
|
|
@ -60,8 +60,6 @@ namespace Ombi.Controllers.External
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("Profiles")]
|
|
|
|
|
public async Task<IEnumerable<RadarrProfile>> GetProfiles()
|
|
|
|
|
{
|
|
|
|
|
return await Cache.GetOrAdd(CacheKeys.RadarrQualityProfiles, async () =>
|
|
|
|
|
{
|
|
|
|
|
var settings = await RadarrSettings.GetSettingsAsync();
|
|
|
|
|
if (settings.Enabled)
|
|
|
|
@ -69,7 +67,6 @@ namespace Ombi.Controllers.External
|
|
|
|
|
return await RadarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}, DateTime.Now.AddHours(1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -79,8 +76,6 @@ namespace Ombi.Controllers.External
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("RootFolders")]
|
|
|
|
|
public async Task<IEnumerable<RadarrRootFolder>> GetRootFolders()
|
|
|
|
|
{
|
|
|
|
|
return await Cache.GetOrAdd(CacheKeys.RadarrRootProfiles, async () =>
|
|
|
|
|
{
|
|
|
|
|
var settings = await RadarrSettings.GetSettingsAsync();
|
|
|
|
|
if (settings.Enabled)
|
|
|
|
@ -88,7 +83,6 @@ namespace Ombi.Controllers.External
|
|
|
|
|
return await RadarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}, DateTime.Now.AddHours(1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|