update metadata parsing

This commit is contained in:
Luke Pulverenti
2015-08-02 13:31:08 -04:00
parent edecae6ed5
commit 6d13cec38e
31 changed files with 101 additions and 110 deletions

View File

@@ -312,7 +312,6 @@
<Compile Include="Providers\ItemInfo.cs" />
<Compile Include="Providers\LiveTvProgramLookupInfo.cs" />
<Compile Include="Providers\LocalImageInfo.cs" />
<Compile Include="Providers\LocalMetadataResult.cs" />
<Compile Include="Providers\MetadataRefreshMode.cs" />
<Compile Include="Providers\MetadataResult.cs" />
<Compile Include="Providers\MovieInfo.cs" />

View File

@@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Providers
/// <param name="directoryService">The directory service.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{MetadataResult{`0}}.</returns>
Task<LocalMetadataResult<TItemType>> GetMetadata(ItemInfo info,
Task<MetadataResult<TItemType>> GetMetadata(ItemInfo info,
IDirectoryService directoryService,
CancellationToken cancellationToken);
}

View File

@@ -1,18 +0,0 @@
using MediaBrowser.Controller.Entities;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Providers
{
public class LocalMetadataResult<T> : MetadataResult<T>
where T : IHasMetadata
{
public List<LocalImageInfo> Images { get; set; }
public List<UserItemData> UserDataLIst { get; set; }
public LocalMetadataResult()
{
Images = new List<LocalImageInfo>();
UserDataLIst = new List<UserItemData>();
}
}
}

View File

@@ -1,10 +1,20 @@
using MediaBrowser.Controller.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Providers
{
public class MetadataResult<T>
{
public List<LocalImageInfo> Images { get; set; }
public List<UserItemData> UserDataList { get; set; }
public MetadataResult()
{
Images = new List<LocalImageInfo>();
}
public List<PersonInfo> People { get; set; }
public bool HasMetadata { get; set; }
@@ -31,5 +41,27 @@ namespace MediaBrowser.Controller.Providers
}
People.Clear();
}
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;
}
}
}