2015-06-28 18:10:45 -07:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2015-08-02 10:31:08 -07:00
|
|
|
using System;
|
2015-06-28 18:10:45 -07:00
|
|
|
using System.Collections.Generic;
|
2015-08-02 10:31:08 -07:00
|
|
|
using System.Linq;
|
2015-06-28 18:10:45 -07:00
|
|
|
|
2015-03-13 12:37:19 -07:00
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
{
|
|
|
|
public class MetadataResult<T>
|
|
|
|
{
|
2015-08-02 10:31:08 -07:00
|
|
|
public List<LocalImageInfo> Images { get; set; }
|
|
|
|
public List<UserItemData> UserDataList { get; set; }
|
|
|
|
|
|
|
|
public MetadataResult()
|
|
|
|
{
|
|
|
|
Images = new List<LocalImageInfo>();
|
|
|
|
}
|
|
|
|
|
2015-06-28 18:10:45 -07:00
|
|
|
public List<PersonInfo> People { get; set; }
|
|
|
|
|
2015-03-13 12:37:19 -07:00
|
|
|
public bool HasMetadata { get; set; }
|
|
|
|
public T Item { get; set; }
|
2015-06-28 18:10:45 -07:00
|
|
|
|
2015-07-23 19:48:10 -07:00
|
|
|
public void AddPerson(PersonInfo p)
|
2015-06-28 18:10:45 -07:00
|
|
|
{
|
2015-07-23 19:48:10 -07:00
|
|
|
if (People == null)
|
|
|
|
{
|
|
|
|
People = new List<PersonInfo>();
|
|
|
|
}
|
|
|
|
|
|
|
|
PeopleHelper.AddPerson(People, p);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Not only does this clear, but initializes the list so that services can differentiate between a null list and zero people
|
|
|
|
/// </summary>
|
|
|
|
public void ResetPeople()
|
|
|
|
{
|
|
|
|
if (People == null)
|
|
|
|
{
|
|
|
|
People = new List<PersonInfo>();
|
|
|
|
}
|
|
|
|
People.Clear();
|
2015-06-28 18:10:45 -07:00
|
|
|
}
|
2015-08-02 10:31:08 -07:00
|
|
|
|
|
|
|
public UserItemData GetOrAddUserData(string userId)
|
|
|
|
{
|
|
|
|
if (UserDataList == null)
|
|
|
|
{
|
|
|
|
UserDataList = new List<UserItemData>();
|
|
|
|
}
|
|
|
|
|
|
|
|
var userData = UserDataList.FirstOrDefault(i => string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
if (userData == null)
|
|
|
|
{
|
|
|
|
userData = new UserItemData()
|
|
|
|
{
|
|
|
|
UserId = new Guid(userId)
|
|
|
|
};
|
|
|
|
|
|
|
|
UserDataList.Add(userData);
|
|
|
|
}
|
|
|
|
|
|
|
|
return userData;
|
|
|
|
}
|
2015-03-13 12:37:19 -07:00
|
|
|
}
|
|
|
|
}
|