new Artist entity

This commit is contained in:
Luke Pulverenti
2013-04-22 00:38:03 -04:00
parent 1a153cbd39
commit 374b7f2f03
51 changed files with 1583 additions and 586 deletions

View File

@@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <returns>System.String.</returns>
public override string GetUserDataKey()
{
return Name;
return "Artist-" + Name;
}
}
}

View File

@@ -113,5 +113,15 @@ namespace MediaBrowser.Controller.Entities.Audio
return (ProductionYear != null ? ProductionYear.Value.ToString("000-") : "")
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
}
/// <summary>
/// Determines whether the specified name has artist.
/// </summary>
/// <param name="name">The name.</param>
/// <returns><c>true</c> if the specified name has artist; otherwise, <c>false</c>.</returns>
public bool HasArtist(string name)
{
return Artists.Contains(name, StringComparer.OrdinalIgnoreCase) || string.Equals(AlbumArtist, name, StringComparison.OrdinalIgnoreCase);
}
}
}

View File

@@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary>
/// The unknwon artist
/// </summary>
private static readonly MusicArtist UnknwonArtist = new MusicArtist {Name = "<Unknown>"};
private static readonly MusicArtist UnknwonArtist = new MusicArtist { Name = "<Unknown>" };
/// <summary>
/// Override this to return the folder that should be used to construct a container

View File

@@ -1,6 +1,4 @@

using System.Collections.Generic;
namespace MediaBrowser.Controller.Entities.Audio
{
/// <summary>
@@ -8,12 +6,6 @@ namespace MediaBrowser.Controller.Entities.Audio
/// </summary>
public class MusicArtist : Folder
{
public Dictionary<string, string> AlbumCovers { get; set; }
public override void ClearMetaValues()
{
AlbumCovers = null;
base.ClearMetaValues();
}
}
}

View File

@@ -23,6 +23,14 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public abstract class BaseItem : IHasProviderIds
{
protected BaseItem()
{
Genres = new List<string>();
TrailerUrls = new List<string>();
Studios = new List<string>();
People = new List<PersonInfo>();
}
/// <summary>
/// The trailer folder name
/// </summary>
@@ -925,16 +933,10 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Determines if the item is considered new based on user settings
/// </summary>
/// <param name="user">The user.</param>
/// <returns><c>true</c> if [is recently added] [the specified user]; otherwise, <c>false</c>.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
public bool IsRecentlyAdded(User user)
public bool IsRecentlyAdded()
{
if (user == null)
{
throw new ArgumentNullException();
}
return (DateTime.UtcNow - DateCreated).TotalDays < ConfigurationManager.Configuration.RecentItemDays;
}

View File

@@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>System.String.</returns>
public override string GetUserDataKey()
{
return Name;
return "Genre-" + Name;
}
}
}

View File

@@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>System.String.</returns>
public override string GetUserDataKey()
{
return Name;
return "Person-" + Name;
}
}

View File

@@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>System.String.</returns>
public override string GetUserDataKey()
{
return Name;
return "Studio-" + Name;
}
}
}

View File

@@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>System.String.</returns>
public override string GetUserDataKey()
{
return Name;
return "Year-" + Name;
}
}
}