You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
783 B
29 lines
783 B
12 years ago
|
using System.IO;
|
||
|
using NzbDrone.Common;
|
||
12 years ago
|
using NzbDrone.Common.EnvironmentInfo;
|
||
12 years ago
|
|
||
11 years ago
|
namespace NzbDrone.Api.Frontend.Mappers
|
||
12 years ago
|
{
|
||
|
public class MediaCoverMapper : IMapHttpRequestsToDisk
|
||
|
{
|
||
12 years ago
|
private readonly IAppFolderInfo _appFolderInfo;
|
||
12 years ago
|
|
||
12 years ago
|
public MediaCoverMapper(IAppFolderInfo appFolderInfo)
|
||
12 years ago
|
{
|
||
12 years ago
|
_appFolderInfo = appFolderInfo;
|
||
12 years ago
|
}
|
||
|
|
||
|
public string Map(string resourceUrl)
|
||
|
{
|
||
|
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
|
||
11 years ago
|
path = path.Trim(Path.DirectorySeparatorChar);
|
||
12 years ago
|
|
||
12 years ago
|
return Path.Combine(_appFolderInfo.GetAppDataPath(), path);
|
||
12 years ago
|
}
|
||
|
|
||
12 years ago
|
public bool CanHandle(string resourceUrl)
|
||
|
{
|
||
11 years ago
|
return resourceUrl.StartsWith("/MediaCover");
|
||
12 years ago
|
}
|
||
12 years ago
|
}
|
||
|
}
|