1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2025-03-06 19:49:02 +00:00
Sonarr/NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs

31 lines
1,006 B
C#
Raw Normal View History

2013-03-31 19:43:58 -07:00
using System.Collections.Generic;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Core.DataAugmentation.Scene
{
public interface ISceneMappingProxy
{
List<SceneMapping> Fetch();
}
public class SceneMappingProxy : ISceneMappingProxy
{
2013-04-10 16:41:45 -07:00
private readonly IHttpProvider _httpProvider;
2013-03-31 19:43:58 -07:00
private readonly IConfigService _configService;
2013-04-17 16:32:06 -07:00
private readonly IJsonSerializer _jsonSerializer;
2013-03-31 19:43:58 -07:00
2013-04-17 16:32:06 -07:00
public SceneMappingProxy(IHttpProvider httpProvider, IConfigService configService, IJsonSerializer jsonSerializer)
2013-03-31 19:43:58 -07:00
{
_httpProvider = httpProvider;
_configService = configService;
2013-04-17 16:32:06 -07:00
_jsonSerializer = jsonSerializer;
2013-03-31 19:43:58 -07:00
}
public List<SceneMapping> Fetch()
{
var mappingsJson = _httpProvider.DownloadString(_configService.ServiceRootUrl + "/SceneMapping/Active");
2013-04-17 16:32:06 -07:00
return _jsonSerializer.Deserialize<List<SceneMapping>>(mappingsJson);
2013-03-31 19:43:58 -07:00
}
}
}