using MediaBrowser.Model.Entities;
using System;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Entities
{
public interface IHasImages
{
///
/// Gets the name.
///
/// The name.
string Name { get; }
///
/// Gets the path.
///
/// The path.
string Path { get; set; }
///
/// Gets the identifier.
///
/// The identifier.
Guid Id { get; }
///
/// Gets the image path.
///
/// Type of the image.
/// Index of the image.
/// System.String.
string GetImagePath(ImageType imageType, int imageIndex);
///
/// Gets the image date modified.
///
/// The image path.
/// DateTime.
DateTime GetImageDateModified(string imagePath);
///
/// Sets the image.
///
/// The type.
/// The index.
/// The path.
void SetImagePath(ImageType type, int index, string path);
///
/// Determines whether the specified type has image.
///
/// The type.
/// Index of the image.
/// true if the specified type has image; otherwise, false.
bool HasImage(ImageType type, int imageIndex);
///
/// Swaps the images.
///
/// The type.
/// The index1.
/// The index2.
/// Task.
Task SwapImages(ImageType type, int index1, int index2);
///
/// Gets the display type of the media.
///
/// The display type of the media.
string DisplayMediaType { get; set; }
///
/// Gets or sets the primary image path.
///
/// The primary image path.
string PrimaryImagePath { get; set; }
///
/// Gets the preferred metadata language.
///
/// System.String.
string GetPreferredMetadataLanguage();
}
public static class HasImagesExtensions
{
///
/// Gets the image path.
///
/// The item.
/// Type of the image.
/// System.String.
public static string GetImagePath(this IHasImages item, ImageType imageType)
{
return item.GetImagePath(imageType, 0);
}
public static bool HasImage(this IHasImages item, ImageType imageType)
{
return item.HasImage(imageType, 0);
}
///
/// Sets the image path.
///
/// The item.
/// Type of the image.
/// The path.
public static void SetImagePath(this IHasImages item, ImageType imageType, string path)
{
item.SetImagePath(imageType, 0, path);
}
}
}