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

29 lines
775 B
C#
Raw Normal View History

using System.IO;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Api.Frontend
{
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);
}
2013-05-18 03:18:02 +02:00
public bool CanHandle(string resourceUrl)
{
return resourceUrl.StartsWith("/MediaCover");
2013-05-18 03:18:02 +02:00
}
}
}