Set initial display media type at resolve time
This commit is contained in:
parent
7d0a478183
commit
8726b9ca95
|
@ -101,17 +101,5 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
{
|
||||
return string.Equals(Artist, name, StringComparison.OrdinalIgnoreCase) || string.Equals(AlbumArtist, name, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public override string DisplayMediaType
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Song";
|
||||
}
|
||||
set
|
||||
{
|
||||
base.DisplayMediaType = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,22 +164,6 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the display type of the media.
|
||||
/// </summary>
|
||||
/// <value>The display type of the media.</value>
|
||||
public override string DisplayMediaType
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Album";
|
||||
}
|
||||
set
|
||||
{
|
||||
base.DisplayMediaType = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the music brainz release group id.
|
||||
/// </summary>
|
||||
|
|
|
@ -6,20 +6,6 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
/// </summary>
|
||||
public class MusicAlbumDisc : Folder
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the display type of the media.
|
||||
/// </summary>
|
||||
/// <value>The display type of the media.</value>
|
||||
public override string DisplayMediaType
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Disc";
|
||||
}
|
||||
set
|
||||
{
|
||||
base.DisplayMediaType = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public virtual Guid Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using MediaBrowser.Common.Extensions;
|
||||
using System;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
@ -10,27 +8,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// </summary>
|
||||
public abstract class BasePluginFolder : Folder, ICollectionFolder, IByReferenceItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public override Guid Id
|
||||
{
|
||||
get
|
||||
{
|
||||
// This doesn't get populated through the normal resolving process
|
||||
if (base.Id == Guid.Empty)
|
||||
{
|
||||
base.Id = (Path ?? Name).GetMBId(GetType());
|
||||
}
|
||||
return base.Id;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Id = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the location.
|
||||
/// </summary>
|
||||
|
@ -42,22 +19,5 @@ namespace MediaBrowser.Controller.Entities
|
|||
return LocationType.Virtual;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// We don't resolve normally so need to fill this in
|
||||
/// </summary>
|
||||
public override string DisplayMediaType
|
||||
{
|
||||
get
|
||||
{
|
||||
return "CollectionFolder"; // Plug-in folders are collection folders
|
||||
}
|
||||
set
|
||||
{
|
||||
base.DisplayMediaType = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,22 +74,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure this has a value
|
||||
/// </summary>
|
||||
/// <value>The display type of the media.</value>
|
||||
public override string DisplayMediaType
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.DisplayMediaType ?? GetType().Name;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.DisplayMediaType = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The _root folder
|
||||
/// </summary>
|
||||
|
|
|
@ -569,7 +569,19 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
// Add in the plug-in folders
|
||||
foreach (var child in PluginFolderCreators)
|
||||
{
|
||||
rootFolder.AddVirtualChild(child.GetFolder());
|
||||
var folder = child.GetFolder();
|
||||
|
||||
if (string.IsNullOrEmpty(folder.DisplayMediaType))
|
||||
{
|
||||
folder.DisplayMediaType = "CollectionFolder";
|
||||
}
|
||||
|
||||
if (folder.Id == Guid.Empty)
|
||||
{
|
||||
folder.Id = (folder.Path ?? folder.Name ?? folder.GetType().Name).GetMBId(folder.GetType());
|
||||
}
|
||||
|
||||
rootFolder.AddVirtualChild(folder);
|
||||
}
|
||||
|
||||
return rootFolder;
|
||||
|
|
|
@ -30,7 +30,10 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
|||
{
|
||||
if (EntityResolutionHelper.IsAudioFile(args.Path))
|
||||
{
|
||||
return new Controller.Entities.Audio.Audio();
|
||||
return new Controller.Entities.Audio.Audio
|
||||
{
|
||||
DisplayMediaType = "Song"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,11 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
|||
{
|
||||
if (!args.IsDirectory) return null;
|
||||
|
||||
return args.Parent is MusicAlbum ? new MusicAlbumDisc() : null;
|
||||
return args.Parent is MusicAlbum ? new MusicAlbumDisc
|
||||
{
|
||||
DisplayMediaType = "Disc"
|
||||
|
||||
} : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,11 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
|||
if (args.Parent.IsRoot) return null;
|
||||
if (args.Parent is MusicAlbum) return null;
|
||||
|
||||
return IsMusicAlbum(args) ? new MusicAlbum() : null;
|
||||
return IsMusicAlbum(args) ? new MusicAlbum
|
||||
{
|
||||
DisplayMediaType = "Album"
|
||||
|
||||
} : null;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user