1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-01 00:12:30 +01:00
Sonarr/NzbDrone.Api/Frontend/MediaCoverMapper.cs

25 lines
739 B
C#
Raw Normal View History

using System.IO;
using NzbDrone.Common;
namespace NzbDrone.Api.Frontend
{
public class MediaCoverMapper : IMapHttpRequestsToDisk
{
private readonly IEnvironmentProvider _environmentProvider;
public MediaCoverMapper(IEnvironmentProvider environmentProvider)
{
_environmentProvider = environmentProvider;
}
public string Map(string resourceUrl)
{
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
path = path.Trim(Path.DirectorySeparatorChar).ToLower();
return Path.Combine(_environmentProvider.GetAppDataPath(), path);
}
public RequestType IHandle { get { return RequestType.MediaCovers; } }
}
}