mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-04 06:04:25 -04:00
update dto dictionary building
This commit is contained in:
parent
8474f9c4fa
commit
365a992736
@ -466,12 +466,29 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
public Guid ParentId { get; set; }
|
public Guid ParentId { get; set; }
|
||||||
|
|
||||||
|
private Folder _parent;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the parent.
|
/// Gets or sets the parent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The parent.</value>
|
/// <value>The parent.</value>
|
||||||
[IgnoreDataMember]
|
public Folder Parent
|
||||||
public Folder Parent { get; set; }
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_parent != null)
|
||||||
|
{
|
||||||
|
return _parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ParentId != Guid.Empty)
|
||||||
|
{
|
||||||
|
return LibraryManager.GetItemById(ParentId) as Folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
set { _parent = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public void SetParent(Folder parent)
|
public void SetParent(Folder parent)
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
using MediaBrowser.Controller.LiveTv;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Channels;
|
using MediaBrowser.Model.Channels;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
@ -34,6 +35,13 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Supports images for tv movies
|
||||||
|
var tvProgram = item as LiveTvProgram;
|
||||||
|
if (tvProgram != null && tvProgram.IsMovie)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return item is Movie || item is MusicVideo;
|
return item is Movie || item is MusicVideo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
public IEnumerable<BaseItemDto> GetBaseItemDtos(IEnumerable<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null)
|
public IEnumerable<BaseItemDto> GetBaseItemDtos(IEnumerable<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null)
|
||||||
{
|
{
|
||||||
var syncJobItems = GetSyncedItemProgress(options);
|
var syncJobItems = GetSyncedItemProgress(options);
|
||||||
var syncDictionary = syncJobItems.ToDictionary(i => i.ItemId);
|
var syncDictionary = GetSyncedItemProgressDictionary(syncJobItems);
|
||||||
|
|
||||||
var list = new List<BaseItemDto>();
|
var list = new List<BaseItemDto>();
|
||||||
|
|
||||||
@ -120,11 +120,23 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dictionary<string, SyncedItemProgress> GetSyncedItemProgressDictionary(IEnumerable<SyncedItemProgress> items)
|
||||||
|
{
|
||||||
|
var dict = new Dictionary<string, SyncedItemProgress>();
|
||||||
|
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
dict[item.ItemId] = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
|
public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
|
||||||
{
|
{
|
||||||
var syncProgress = GetSyncedItemProgress(options);
|
var syncProgress = GetSyncedItemProgress(options);
|
||||||
|
|
||||||
var dto = GetBaseItemDtoInternal(item, options, syncProgress.ToDictionary(i => i.ItemId), user, owner);
|
var dto = GetBaseItemDtoInternal(item, options, GetSyncedItemProgressDictionary(syncProgress), user, owner);
|
||||||
|
|
||||||
var byName = item as IItemByName;
|
var byName = item as IItemByName;
|
||||||
|
|
||||||
@ -382,7 +394,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
{
|
{
|
||||||
var syncProgress = GetSyncedItemProgress(options);
|
var syncProgress = GetSyncedItemProgress(options);
|
||||||
|
|
||||||
var dto = GetBaseItemDtoInternal(item, options, syncProgress.ToDictionary(i => i.ItemId), user);
|
var dto = GetBaseItemDtoInternal(item, options, GetSyncedItemProgressDictionary(syncProgress), user);
|
||||||
|
|
||||||
if (options.Fields.Contains(ItemFields.ItemCounts))
|
if (options.Fields.Contains(ItemFields.ItemCounts))
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
//[assembly: AssemblyVersion("3.0.*")]
|
[assembly: AssemblyVersion("3.0.*")]
|
||||||
[assembly: AssemblyVersion("3.0.5667.6")]
|
//[assembly: AssemblyVersion("3.0.5667.6")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user