changed images dictionary to be enum based
This commit is contained in:
parent
7a5a1511cc
commit
68d0181216
|
@ -299,14 +299,11 @@ namespace MediaBrowser.Controller.Dto
|
||||||
|
|
||||||
foreach (var image in item.Images)
|
foreach (var image in item.Images)
|
||||||
{
|
{
|
||||||
ImageType type;
|
var type = image.Key;
|
||||||
|
|
||||||
if (Enum.TryParse(image.Key, true, out type))
|
|
||||||
{
|
|
||||||
dto.ImageTags[type] = Kernel.Instance.ImageManager.GetImageCacheTag(item, type, image.Value);
|
dto.ImageTags[type] = Kernel.Instance.ImageManager.GetImageCacheTag(item, type, image.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
dto.Id = GetClientItemId(item);
|
dto.Id = GetClientItemId(item);
|
||||||
dto.IndexNumber = item.IndexNumber;
|
dto.IndexNumber = item.IndexNumber;
|
||||||
|
|
|
@ -111,14 +111,14 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
/// Gets or sets the images.
|
/// Gets or sets the images.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The images.</value>
|
/// <value>The images.</value>
|
||||||
public override Dictionary<string, string> Images
|
public override Dictionary<ImageType, string> Images
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var images = base.Images;
|
var images = base.Images;
|
||||||
string primaryImagePath;
|
string primaryImagePath;
|
||||||
|
|
||||||
if (images == null || !images.TryGetValue(ImageType.Primary.ToString(), out primaryImagePath))
|
if (images == null || !images.TryGetValue(ImageType.Primary, out primaryImagePath))
|
||||||
{
|
{
|
||||||
var image = Children.Select(c => c.PrimaryImagePath).FirstOrDefault(c => !string.IsNullOrEmpty(c));
|
var image = Children.Select(c => c.PrimaryImagePath).FirstOrDefault(c => !string.IsNullOrEmpty(c));
|
||||||
|
|
||||||
|
@ -126,9 +126,9 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
{
|
{
|
||||||
if (images == null)
|
if (images == null)
|
||||||
{
|
{
|
||||||
images = new Dictionary<string, string>();
|
images = new Dictionary<ImageType, string>();
|
||||||
}
|
}
|
||||||
images[ImageType.Primary.ToString()] = image;
|
images[ImageType.Primary] = image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Gets or sets the images.
|
/// Gets or sets the images.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The images.</value>
|
/// <value>The images.</value>
|
||||||
public virtual Dictionary<string, string> Images { get; set; }
|
public virtual Dictionary<ImageType, string> Images { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the date created.
|
/// Gets or sets the date created.
|
||||||
|
@ -650,7 +650,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _local trailers
|
/// The _local trailers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<Video> _localTrailers;
|
private List<Trailer> _localTrailers;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _local trailers initialized
|
/// The _local trailers initialized
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -664,7 +664,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The local trailers.</value>
|
/// <value>The local trailers.</value>
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public List<Video> LocalTrailers
|
public List<Trailer> LocalTrailers
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -708,7 +708,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Loads local trailers from the file system
|
/// Loads local trailers from the file system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>List{Video}.</returns>
|
/// <returns>List{Video}.</returns>
|
||||||
private List<Video> LoadLocalTrailers()
|
private List<Trailer> LoadLocalTrailers()
|
||||||
{
|
{
|
||||||
ItemResolveArgs resolveArgs;
|
ItemResolveArgs resolveArgs;
|
||||||
|
|
||||||
|
@ -719,12 +719,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||||
return new List<Video>();
|
return new List<Trailer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resolveArgs.IsDirectory)
|
if (!resolveArgs.IsDirectory)
|
||||||
{
|
{
|
||||||
return new List<Video>();
|
return new List<Trailer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var folder = resolveArgs.GetFileSystemEntryByName(TrailerFolderName);
|
var folder = resolveArgs.GetFileSystemEntryByName(TrailerFolderName);
|
||||||
|
@ -732,7 +732,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
// Path doesn't exist. No biggie
|
// Path doesn't exist. No biggie
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
{
|
{
|
||||||
return new List<Video>();
|
return new List<Trailer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<WIN32_FIND_DATA> files;
|
IEnumerable<WIN32_FIND_DATA> files;
|
||||||
|
@ -744,13 +744,13 @@ namespace MediaBrowser.Controller.Entities
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error loading trailers for {0}", ex, Name);
|
Logger.ErrorException("Error loading trailers for {0}", ex, Name);
|
||||||
return new List<Video>();
|
return new List<Trailer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return LibraryManager.ResolvePaths<Video>(files, null).Select(video =>
|
return LibraryManager.ResolvePaths<Trailer>(files, null).Select(video =>
|
||||||
{
|
{
|
||||||
// Try to retrieve it from the db. If we don't find it, use the resolved version
|
// Try to retrieve it from the db. If we don't find it, use the resolved version
|
||||||
var dbItem = LibraryManager.RetrieveItem(video.Id) as Video;
|
var dbItem = LibraryManager.RetrieveItem(video.Id) as Trailer;
|
||||||
|
|
||||||
if (dbItem != null)
|
if (dbItem != null)
|
||||||
{
|
{
|
||||||
|
@ -1376,7 +1376,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
|
|
||||||
string val;
|
string val;
|
||||||
Images.TryGetValue(type.ToString(), out val);
|
Images.TryGetValue(type, out val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1417,7 +1417,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
throw new ArgumentException("Screenshots should be accessed using Item.Screenshots");
|
throw new ArgumentException("Screenshots should be accessed using Item.Screenshots");
|
||||||
}
|
}
|
||||||
|
|
||||||
var typeKey = type.ToString();
|
var typeKey = type;
|
||||||
|
|
||||||
// If it's null remove the key from the dictionary
|
// If it's null remove the key from the dictionary
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
|
@ -1435,7 +1435,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
// Ensure it exists
|
// Ensure it exists
|
||||||
if (Images == null)
|
if (Images == null)
|
||||||
{
|
{
|
||||||
Images = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
Images = new Dictionary<ImageType, string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Images[typeKey] = path;
|
Images[typeKey] = path;
|
||||||
|
|
|
@ -24,11 +24,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The true task result
|
|
||||||
/// </summary>
|
|
||||||
protected static readonly Task<bool> TrueTaskResult = Task.FromResult(true);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Supportses the specified item.
|
/// Supportses the specified item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -50,11 +50,6 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The true task result
|
|
||||||
/// </summary>
|
|
||||||
protected static readonly Task<bool> TrueTaskResult = Task.FromResult(true);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
|
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user