1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2025-01-03 22:04:43 +00:00
Radarr/NzbDrone.Api/Frontend/Mappers/MediaCoverMapper.cs
Keivan Beigi 24ba4390a1 moved static resource to basic nancy module.
cache and gzip piplelines are missing
2013-08-19 19:31:26 -07:00

29 lines
No EOL
783 B
C#

using System.IO;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Api.Frontend.Mappers
{
public class MediaCoverMapper : IMapHttpRequestsToDisk
{
private readonly IAppFolderInfo _appFolderInfo;
public MediaCoverMapper(IAppFolderInfo appFolderInfo)
{
_appFolderInfo = appFolderInfo;
}
public string Map(string resourceUrl)
{
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
path = path.Trim(Path.DirectorySeparatorChar);
return Path.Combine(_appFolderInfo.GetAppDataPath(), path);
}
public bool CanHandle(string resourceUrl)
{
return resourceUrl.StartsWith("/MediaCover");
}
}
}