add GuestStar distinction

pull/702/head
Luke Pulverenti 12 years ago
parent 0ae93163bd
commit 7f1fdbf223

@ -38,8 +38,8 @@ namespace MediaBrowser.Api.UserLibrary
/// If the Person filter is used, this can also be used to restrict to a specific person type
/// </summary>
/// <value>The type of the person.</value>
[ApiMember(Name = "PersonType", Description = "Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string PersonType { get; set; }
[ApiMember(Name = "PersonTypes", Description = "Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType. Allows multiple, comma-delimited", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string PersonTypes { get; set; }
/// <summary>
/// Search characters used to find items
@ -448,11 +448,21 @@ namespace MediaBrowser.Api.UserLibrary
// Apply person filter
if (!string.IsNullOrEmpty(personName))
{
var personType = request.PersonType;
var personTypes = request.PersonTypes;
items = !string.IsNullOrEmpty(personType)
? items.Where(item => item.People != null && item.People.Any(p => p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(personType, StringComparison.OrdinalIgnoreCase)))
: items.Where(item => item.People != null && item.People.Any(p => p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase)));
if (string.IsNullOrEmpty(personTypes))
{
items = items.Where(item => item.People != null && item.People.Any(p => string.Equals(p.Name, personName, StringComparison.OrdinalIgnoreCase)));
}
else
{
var types = personTypes.Split(',');
items = items.Where(item =>
item.People != null &&
item.People.Any(p =>
p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && types.Contains(p.Type, StringComparer.OrdinalIgnoreCase)));
}
}
return items;

@ -89,7 +89,6 @@ namespace MediaBrowser.Api.UserLibrary
{
var people = itemsList.SelectMany(i => i.People.OrderBy(p => p.Type));
return personTypes.Length == 0 ?
people :

@ -32,7 +32,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public virtual string Name { get; set; }
public string Name { get; set; }
/// <summary>
/// Gets or sets the id.
@ -477,7 +477,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value>The end date.</value>
public DateTime? EndDate { get; set; }
/// <summary>
/// Gets or sets the display type of the media.
/// </summary>
@ -569,7 +569,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value>The production locations.</value>
public List<string> ProductionLocations { get; set; }
/// <summary>
/// Gets or sets the community rating.
/// </summary>

@ -127,7 +127,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>IEnumerable{BaseItem}.</returns>
protected IEnumerable<BaseItem> GetIndexByPerformer(User user)
{
return GetIndexByPerson(user, new List<string> { PersonType.Actor, PersonType.MusicArtist }, LocalizedStrings.Instance.GetString("PerformerDispPref"));
return GetIndexByPerson(user, new List<string> { PersonType.Actor, PersonType.MusicArtist, PersonType.GuestStar }, LocalizedStrings.Instance.GetString("PerformerDispPref"));
}
/// <summary>

@ -242,7 +242,6 @@ namespace MediaBrowser.Controller.Providers
}
case "Actors":
case "GuestStars":
{
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Actor }))
{
@ -255,6 +254,19 @@ namespace MediaBrowser.Controller.Providers
break;
}
case "GuestStars":
{
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.GuestStar }))
{
if (string.IsNullOrWhiteSpace(p.Name))
{
continue;
}
item.AddPerson(p);
}
break;
}
case "Trailer":
{
var val = reader.ReadElementContentAsString();

@ -63,7 +63,20 @@ namespace MediaBrowser.Controller.Providers
{
// If the IBN location exists return the last modified date of any file in it
var location = GetLocation(item);
return Directory.Exists(location) ? FileSystem.GetFiles(location).Select(f => f.CreationTimeUtc > f.LastWriteTimeUtc ? f.CreationTimeUtc : f.LastWriteTimeUtc).Max() : DateTime.MinValue;
if (!Directory.Exists(location))
{
return DateTime.MinValue;
}
var files = FileSystem.GetFiles(location).ToList();
if (files.Count == 0)
{
return DateTime.MinValue;
}
return files.Select(f => f.CreationTimeUtc > f.LastWriteTimeUtc ? f.CreationTimeUtc : f.LastWriteTimeUtc).Max();
}
/// <summary>

@ -263,21 +263,21 @@ namespace MediaBrowser.Controller.Providers.TV
var actors = doc.SafeGetString("//GuestStars");
if (actors != null)
{
episode.AddPeople(actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = "Actor", Name = str }));
episode.AddPeople(actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.GuestStar, Name = str }));
}
var directors = doc.SafeGetString("//Director");
if (directors != null)
{
episode.AddPeople(directors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = "Director", Name = str }));
episode.AddPeople(directors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Director, Name = str }));
}
var writers = doc.SafeGetString("//Writer");
if (writers != null)
{
episode.AddPeople(writers.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = "Writer", Name = str }));
episode.AddPeople(writers.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Writer, Name = str }));
}
if (ConfigurationManager.Configuration.SaveLocalMeta)

@ -322,7 +322,7 @@ namespace MediaBrowser.Controller.Providers.TV
personNode.AppendChild(doc.ImportNode(subNode, true));
//need to add the type
var typeNode = doc.CreateNode(XmlNodeType.Element, "Type", null);
typeNode.InnerText = "Actor";
typeNode.InnerText = PersonType.Actor;
personNode.AppendChild(typeNode);
actorsNode.AppendChild(personNode);
}

@ -26,5 +26,9 @@ namespace MediaBrowser.Model.Entities
/// The music artist
/// </summary>
public const string MusicArtist = "MusicArtist";
/// <summary>
/// The guest star
/// </summary>
public const string GuestStar = "GuestStar";
}
}

@ -120,7 +120,7 @@ namespace MediaBrowser.Model.Querying
/// If the Person filter is used, this can also be used to restrict to a specific person type
/// </summary>
/// <value>The type of the person.</value>
public string PersonType { get; set; }
public string[] PersonTypes { get; set; }
/// <summary>
/// Search characters used to find items

@ -696,7 +696,7 @@ namespace MediaBrowser.Server.Implementations.Library
var tasks = new List<Task>();
var includedPersonTypes = new[] { PersonType.Actor, PersonType.Director };
var includedPersonTypes = new[] { PersonType.Actor, PersonType.Director, PersonType.GuestStar };
var people = RootFolder.RecursiveChildren
.Where(c => c.People != null)

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.73</version>
<version>3.0.75</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.73" />
<dependency id="MediaBrowser.Common" version="3.0.74" />
<dependency id="NLog" version="2.0.0.2000" />
<dependency id="ServiceStack.Text" version="3.9.38" />
<dependency id="protobuf-net" version="2.0.0.621" />

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.73</version>
<version>3.0.75</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.73</version>
<version>3.0.75</version>
<title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.73" />
<dependency id="MediaBrowser.Common" version="3.0.75" />
</dependencies>
</metadata>
<files>

Loading…
Cancel
Save