aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Images
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/Images')
-rw-r--r--MediaBrowser.Api/Images/ImageByNameService.cs20
-rw-r--r--MediaBrowser.Api/Images/ImageService.cs7
-rw-r--r--MediaBrowser.Api/Images/RemoteImageService.cs12
3 files changed, 19 insertions, 20 deletions
diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs
index 61efae46d4..fdf5842772 100644
--- a/MediaBrowser.Api/Images/ImageByNameService.cs
+++ b/MediaBrowser.Api/Images/ImageByNameService.cs
@@ -158,7 +158,7 @@ namespace MediaBrowser.Api.Images
private string GetThemeName(string path, string rootImagePath)
{
- var parentName = _fileSystem.GetDirectoryName(path);
+ var parentName = Path.GetDirectoryName(path);
if (string.Equals(parentName, rootImagePath, StringComparison.OrdinalIgnoreCase))
{
@@ -185,7 +185,7 @@ namespace MediaBrowser.Api.Images
var paths = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(_appPaths.GeneralPath, request.Name, filename + i)).ToList();
- var path = paths.FirstOrDefault(_fileSystem.FileExists) ?? paths.FirstOrDefault();
+ var path = paths.FirstOrDefault(File.Exists) ?? paths.FirstOrDefault();
return _resultFactory.GetStaticFileResult(Request, path);
}
@@ -199,11 +199,11 @@ namespace MediaBrowser.Api.Images
{
var themeFolder = Path.Combine(_appPaths.RatingsPath, request.Theme);
- if (_fileSystem.DirectoryExists(themeFolder))
+ if (Directory.Exists(themeFolder))
{
var path = BaseItem.SupportedImageExtensions
.Select(i => Path.Combine(themeFolder, request.Name + i))
- .FirstOrDefault(_fileSystem.FileExists);
+ .FirstOrDefault(File.Exists);
if (!string.IsNullOrEmpty(path))
{
@@ -213,14 +213,14 @@ namespace MediaBrowser.Api.Images
var allFolder = Path.Combine(_appPaths.RatingsPath, "all");
- if (_fileSystem.DirectoryExists(allFolder))
+ if (Directory.Exists(allFolder))
{
// Avoid implicitly captured closure
var currentRequest = request;
var path = BaseItem.SupportedImageExtensions
.Select(i => Path.Combine(allFolder, currentRequest.Name + i))
- .FirstOrDefault(_fileSystem.FileExists);
+ .FirstOrDefault(File.Exists);
if (!string.IsNullOrEmpty(path))
{
@@ -240,10 +240,10 @@ namespace MediaBrowser.Api.Images
{
var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme);
- if (_fileSystem.DirectoryExists(themeFolder))
+ if (Directory.Exists(themeFolder))
{
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, request.Name + i))
- .FirstOrDefault(_fileSystem.FileExists);
+ .FirstOrDefault(File.Exists);
if (!string.IsNullOrEmpty(path))
{
@@ -253,13 +253,13 @@ namespace MediaBrowser.Api.Images
var allFolder = Path.Combine(_appPaths.MediaInfoImagesPath, "all");
- if (_fileSystem.DirectoryExists(allFolder))
+ if (Directory.Exists(allFolder))
{
// Avoid implicitly captured closure
var currentRequest = request;
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i))
- .FirstOrDefault(_fileSystem.FileExists);
+ .FirstOrDefault(File.Exists);
if (!string.IsNullOrEmpty(path))
{
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index 26ac8d40e3..149e54f016 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -328,10 +328,9 @@ namespace MediaBrowser.Api.Images
var fileInfo = _fileSystem.GetFileInfo(info.Path);
length = fileInfo.Length;
- var size = _imageProcessor.GetImageSize(item, info, true);
-
- width = Convert.ToInt32(size.Width);
- height = Convert.ToInt32(size.Height);
+ ImageDimensions size = _imageProcessor.GetImageSize(item, info, true);
+ width = size.Width;
+ height = size.Height;
if (width <= 0 || height <= 0)
{
diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.cs
index 24c8ed8353..24d4751c59 100644
--- a/MediaBrowser.Api/Images/RemoteImageService.cs
+++ b/MediaBrowser.Api/Images/RemoteImageService.cs
@@ -220,9 +220,9 @@ namespace MediaBrowser.Api.Images
try
{
- contentPath = _fileSystem.ReadAllText(pointerCachePath);
+ contentPath = File.ReadAllText(pointerCachePath);
- if (_fileSystem.FileExists(contentPath))
+ if (File.Exists(contentPath))
{
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
}
@@ -239,7 +239,7 @@ namespace MediaBrowser.Api.Images
await DownloadImage(request.ImageUrl, urlHash, pointerCachePath).ConfigureAwait(false);
// Read the pointer file again
- contentPath = _fileSystem.ReadAllText(pointerCachePath);
+ contentPath = File.ReadAllText(pointerCachePath);
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
}
@@ -264,7 +264,7 @@ namespace MediaBrowser.Api.Images
var fullCachePath = GetFullCachePath(urlHash + "." + ext);
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fullCachePath));
+ Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
using (var stream = result.Content)
{
using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
@@ -273,8 +273,8 @@ namespace MediaBrowser.Api.Images
}
}
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(pointerCachePath));
- _fileSystem.WriteAllText(pointerCachePath, fullCachePath);
+ Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
+ File.WriteAllText(pointerCachePath, fullCachePath);
}
}