2015-03-13 12:37:19 -07:00
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using MediaBrowser.Model.Drawing;
|
2015-10-16 10:06:31 -07:00
|
|
|
using MediaBrowser.Model.MediaInfo;
|
2015-03-13 12:37:19 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
{
|
|
|
|
public class DynamicImageResponse
|
|
|
|
{
|
|
|
|
public string Path { get; set; }
|
2015-10-16 10:06:31 -07:00
|
|
|
public MediaProtocol Protocol { get; set; }
|
2015-03-13 12:37:19 -07:00
|
|
|
public Stream Stream { get; set; }
|
|
|
|
public ImageFormat Format { get; set; }
|
|
|
|
public bool HasImage { get; set; }
|
|
|
|
public string InternalCacheKey { get; set; }
|
|
|
|
|
|
|
|
public void SetFormatFromMimeType(string mimeType)
|
|
|
|
{
|
|
|
|
if (mimeType.EndsWith("gif", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
Format = ImageFormat.Gif;
|
|
|
|
}
|
|
|
|
else if (mimeType.EndsWith("bmp", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
Format = ImageFormat.Bmp;
|
|
|
|
}
|
|
|
|
else if (mimeType.EndsWith("png", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
Format = ImageFormat.Png;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Format = ImageFormat.Jpg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|