2015-06-29 01:10:45 +00:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2015-08-02 17:31:08 +00:00
|
|
|
using System;
|
2015-06-29 01:10:45 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
2015-03-13 19:37:19 +00:00
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
{
|
|
|
|
public class MetadataResult<T>
|
|
|
|
{
|
2015-08-02 17:31:08 +00:00
|
|
|
public List<LocalImageInfo> Images { get; set; }
|
|
|
|
public List<UserItemData> UserDataList { get; set; }
|
|
|
|
|
|
|
|
public MetadataResult()
|
|
|
|
{
|
|
|
|
Images = new List<LocalImageInfo>();
|
2016-05-14 01:55:46 +00:00
|
|
|
ResultLanguage = "en";
|
2015-08-02 17:31:08 +00:00
|
|
|
}
|
|
|
|
|
2015-06-29 01:10:45 +00:00
|
|
|
public List<PersonInfo> People { get; set; }
|
|
|
|
|
2015-03-13 19:37:19 +00:00
|
|
|
public bool HasMetadata { get; set; }
|
|
|
|
public T Item { get; set; }
|
2016-05-14 01:55:46 +00:00
|
|
|
public string ResultLanguage { get; set; }
|
2016-09-18 04:27:17 +00:00
|
|
|
public bool QueriedById { get; set; }
|
2015-07-24 02:48:10 +00:00
|
|
|
public void AddPerson(PersonInfo p)
|
2015-06-29 01:10:45 +00:00
|
|
|
{
|
2015-07-24 02:48:10 +00: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-29 01:10:45 +00:00
|
|
|
}
|
2015-08-02 17:31:08 +00:00
|
|
|
|
|
|
|
public UserItemData GetOrAddUserData(string userId)
|
|
|
|
{
|
|
|
|
if (UserDataList == null)
|
|
|
|
{
|
|
|
|
UserDataList = new List<UserItemData>();
|
|
|
|
}
|
|
|
|
|
2017-08-24 19:52:19 +00:00
|
|
|
UserItemData userData = null;
|
|
|
|
|
|
|
|
foreach (var i in UserDataList)
|
|
|
|
{
|
|
|
|
if (string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
userData = i;
|
|
|
|
}
|
|
|
|
}
|
2015-08-02 17:31:08 +00:00
|
|
|
|
|
|
|
if (userData == null)
|
|
|
|
{
|
|
|
|
userData = new UserItemData()
|
|
|
|
{
|
|
|
|
UserId = new Guid(userId)
|
|
|
|
};
|
|
|
|
|
|
|
|
UserDataList.Add(userData);
|
|
|
|
}
|
|
|
|
|
|
|
|
return userData;
|
|
|
|
}
|
2015-03-13 19:37:19 +00:00
|
|
|
}
|
|
|
|
}
|