add ArtistItems to api output

This commit is contained in:
Luke Pulverenti
2015-03-13 13:25:28 -04:00
parent a92723fde3
commit 96ec4cef77
21 changed files with 117 additions and 121 deletions

View File

@@ -171,16 +171,6 @@ namespace MediaBrowser.Controller.Entities.Audio
+ (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 AllArtists.Contains(name, StringComparer.OrdinalIgnoreCase);
}
/// <summary>
/// Gets the user data key.
/// </summary>

View File

@@ -1,4 +1,6 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Entities.Audio
{
@@ -9,10 +11,20 @@ namespace MediaBrowser.Controller.Entities.Audio
public interface IHasArtist
{
bool HasArtist(string name);
List<string> AllArtists { get; }
List<string> Artists { get; }
List<string> Artists { get; set; }
}
public static class HasArtistExtensions
{
public static bool HasArtist(this IHasArtist hasArtist, string artist)
{
return hasArtist.Artists.Contains(artist, StringComparer.OrdinalIgnoreCase);
}
public static bool HasAnyArtist(this IHasArtist hasArtist, string artist)
{
return hasArtist.AllArtists.Contains(artist, StringComparer.OrdinalIgnoreCase);
}
}
}

View File

@@ -120,16 +120,6 @@ namespace MediaBrowser.Controller.Entities.Audio
get { return Parent as MusicArtist ?? UnknwonArtist; }
}
/// <summary>
/// Determines whether the specified artist has artist.
/// </summary>
/// <param name="artist">The artist.</param>
/// <returns><c>true</c> if the specified artist has artist; otherwise, <c>false</c>.</returns>
public bool HasArtist(string artist)
{
return AllArtists.Contains(artist, StringComparer.OrdinalIgnoreCase);
}
public List<string> Artists { get; set; }
/// <summary>

View File

@@ -213,7 +213,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return i =>
{
var hasArtist = i as IHasArtist;
return hasArtist != null && hasArtist.HasArtist(Name);
return hasArtist != null && hasArtist.HasAnyArtist(Name);
};
}
}

View File

@@ -47,16 +47,6 @@ namespace MediaBrowser.Controller.Entities
}
}
/// <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 AllArtists.Contains(name, StringComparer.OrdinalIgnoreCase);
}
/// <summary>
/// Gets the user data key.
/// </summary>