1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-28 10:51:48 +00:00
Radarr/NzbDrone.Api/Frontend/MediaCoverMapper.cs

28 lines
788 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);
}
2013-05-18 01:18:02 +00:00
public bool CanHandle(string resourceUrl)
{
return resourceUrl.StartsWith("/mediacover");
}
}
}