using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Entities
{
public interface IHasImages : IHasProviderIds
{
///
/// Gets the name.
///
/// The name.
string Name { get; set; }
///
/// Gets the path.
///
/// The path.
string Path { get; set; }
///
/// Gets the identifier.
///
/// The identifier.
Guid Id { get; }
///
/// Gets the type of the location.
///
/// The type of the location.
LocationType LocationType { get; }
///
/// Gets the images.
///
/// Type of the image.
/// IEnumerable{ItemImageInfo}.
IEnumerable GetImages(ImageType imageType);
///
/// Gets the image path.
///
/// Type of the image.
/// Index of the image.
/// System.String.
string GetImagePath(ImageType imageType, int imageIndex);
///
/// Gets the image information.
///
/// Type of the image.
/// Index of the image.
/// ItemImageInfo.
ItemImageInfo GetImageInfo(ImageType imageType, int imageIndex);
///
/// Sets the image.
///
/// The type.
/// The index.
/// The file.
void SetImagePath(ImageType type, int index, FileSystemInfo file);
///
/// 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);
///
/// Allowses the multiple images.
///
/// The type.
/// true if XXXX, false otherwise.
bool AllowsMultipleImages(ImageType type);
///
/// 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; }
///
/// Gets the preferred metadata language.
///
/// System.String.
string GetPreferredMetadataLanguage();
///
/// Validates the images and returns true or false indicating if any were removed.
///
bool ValidateImages(IDirectoryService directoryService);
///
/// Gets a value indicating whether this instance is owned item.
///
/// true if this instance is owned item; otherwise, false.
bool IsOwnedItem { get; }
///
/// Gets the containing folder path.
///
/// The containing folder path.
string ContainingFolderPath { get; }
///
/// Adds the images.
///
/// Type of the image.
/// The images.
/// true if XXXX, false otherwise.
bool AddImages(ImageType imageType, IEnumerable images);
///
/// Determines whether [is save local metadata enabled].
///
/// true if [is save local metadata enabled]; otherwise, false.
bool IsSaveLocalMetadataEnabled();
///
/// Gets a value indicating whether [supports local metadata].
///
/// true if [supports local metadata]; otherwise, false.
bool SupportsLocalMetadata { get; }
///
/// Gets a value indicating whether this instance is in mixed folder.
///
/// true if this instance is in mixed folder; otherwise, false.
bool IsInMixedFolder { get; }
///
/// Gets a value indicating whether this instance is locked.
///
/// true if this instance is locked; otherwise, false.
bool IsLocked { get; }
}
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 file.
public static void SetImagePath(this IHasImages item, ImageType imageType, FileSystemInfo file)
{
item.SetImagePath(imageType, 0, file);
}
///
/// Sets the image path.
///
/// The item.
/// Type of the image.
/// The file.
public static void SetImagePath(this IHasImages item, ImageType imageType, string file)
{
item.SetImagePath(imageType, new FileInfo(file));
}
}
}