using MediaBrowser.Controller.Entities; using System; using System.Collections.Generic; using System.Linq; namespace MediaBrowser.Controller.Providers { public class MetadataResult { public List Images { get; set; } public List UserDataList { get; set; } public MetadataResult() { Images = new List(); ResultLanguage = "en"; } public List People { get; set; } public bool HasMetadata { get; set; } public T Item { get; set; } public string ResultLanguage { get; set; } public void AddPerson(PersonInfo p) { if (People == null) { People = new List(); } PeopleHelper.AddPerson(People, p); } /// /// Not only does this clear, but initializes the list so that services can differentiate between a null list and zero people /// public void ResetPeople() { if (People == null) { People = new List(); } People.Clear(); } public UserItemData GetOrAddUserData(string userId) { if (UserDataList == null) { UserDataList = new List(); } 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; } } }