2020-08-22 12:56:24 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2019-02-28 15:22:57 -07:00
|
|
|
using System.Globalization;
|
2019-01-13 12:25:32 -07:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2021-02-27 14:46:03 -07:00
|
|
|
using MediaBrowser.Model.Entities;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
{
|
|
|
|
public class MetadataResult<T>
|
|
|
|
{
|
|
|
|
public MetadataResult()
|
|
|
|
{
|
|
|
|
Images = new List<LocalImageInfo>();
|
2021-02-27 14:46:03 -07:00
|
|
|
RemoteImages = new List<(string url, ImageType type)>();
|
2018-12-27 16:27:57 -07:00
|
|
|
ResultLanguage = "en";
|
|
|
|
}
|
|
|
|
|
2021-02-27 14:46:03 -07:00
|
|
|
public List<LocalImageInfo> Images { get; set; }
|
|
|
|
|
|
|
|
public List<(string url, ImageType type)> RemoteImages { get; set; }
|
|
|
|
|
|
|
|
public List<UserItemData> UserDataList { get; set; }
|
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public List<PersonInfo> People { get; set; }
|
|
|
|
|
|
|
|
public bool HasMetadata { get; set; }
|
2020-03-09 07:05:03 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public T Item { get; set; }
|
2020-03-09 07:05:03 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public string ResultLanguage { get; set; }
|
2020-03-09 07:05:03 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public string Provider { get; set; }
|
2020-03-09 07:05:03 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public bool QueriedById { get; set; }
|
2020-03-09 07:05:03 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public void AddPerson(PersonInfo p)
|
|
|
|
{
|
|
|
|
if (People == null)
|
|
|
|
{
|
|
|
|
People = new List<PersonInfo>();
|
|
|
|
}
|
|
|
|
|
|
|
|
PeopleHelper.AddPerson(People, p);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-15 15:37:52 -07:00
|
|
|
/// Not only does this clear, but initializes the list so that services can differentiate between a null list and zero people.
|
2018-12-27 16:27:57 -07:00
|
|
|
/// </summary>
|
|
|
|
public void ResetPeople()
|
|
|
|
{
|
|
|
|
if (People == null)
|
|
|
|
{
|
|
|
|
People = new List<PersonInfo>();
|
|
|
|
}
|
2020-06-15 14:43:52 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
People.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
public UserItemData GetOrAddUserData(string userId)
|
|
|
|
{
|
|
|
|
if (UserDataList == null)
|
|
|
|
{
|
|
|
|
UserDataList = new List<UserItemData>();
|
|
|
|
}
|
|
|
|
|
|
|
|
UserItemData userData = null;
|
|
|
|
|
|
|
|
foreach (var i in UserDataList)
|
|
|
|
{
|
2019-02-28 15:22:57 -07:00
|
|
|
if (string.Equals(userId, i.UserId.ToString("N", CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase))
|
2018-12-27 16:27:57 -07:00
|
|
|
{
|
|
|
|
userData = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userData == null)
|
|
|
|
{
|
|
|
|
userData = new UserItemData()
|
|
|
|
{
|
|
|
|
UserId = new Guid(userId)
|
|
|
|
};
|
|
|
|
|
|
|
|
UserDataList.Add(userData);
|
|
|
|
}
|
|
|
|
|
|
|
|
return userData;
|
|
|
|
}
|
|
|
|
}
|
2018-12-27 14:43:48 -07:00
|
|
|
}
|