mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-05 07:18:47 +01:00
fixes #791 - Support server-side playlists
This commit is contained in:
@@ -11,6 +11,7 @@ using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Sync;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
@@ -179,6 +180,11 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
}
|
||||
|
||||
if (item is Playlist)
|
||||
{
|
||||
AttachLinkedChildImages(dto, (Folder)item, user);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
@@ -819,7 +825,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
dto.DisplayOrder = hasDisplayOrder.DisplayOrder;
|
||||
}
|
||||
|
||||
var collectionFolder = item as CollectionFolder;
|
||||
var collectionFolder = item as ICollectionFolder;
|
||||
if (collectionFolder != null)
|
||||
{
|
||||
dto.CollectionType = collectionFolder.CollectionType;
|
||||
@@ -1211,6 +1217,45 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
}
|
||||
|
||||
private void AttachLinkedChildImages(BaseItemDto dto, Folder folder, User user)
|
||||
{
|
||||
List<BaseItem> linkedChildren = null;
|
||||
|
||||
if (dto.BackdropImageTags.Count == 0)
|
||||
{
|
||||
if (linkedChildren == null)
|
||||
{
|
||||
linkedChildren = user == null
|
||||
? folder.GetRecursiveChildren().ToList()
|
||||
: folder.GetRecursiveChildren(user, true).ToList();
|
||||
}
|
||||
var parentWithBackdrop = linkedChildren.FirstOrDefault(i => i.GetImages(ImageType.Backdrop).Any());
|
||||
|
||||
if (parentWithBackdrop != null)
|
||||
{
|
||||
dto.ParentBackdropItemId = GetDtoId(parentWithBackdrop);
|
||||
dto.ParentBackdropImageTags = GetBackdropImageTags(parentWithBackdrop);
|
||||
}
|
||||
}
|
||||
|
||||
if (!dto.ImageTags.ContainsKey(ImageType.Primary))
|
||||
{
|
||||
if (linkedChildren == null)
|
||||
{
|
||||
linkedChildren = user == null
|
||||
? folder.GetRecursiveChildren().ToList()
|
||||
: folder.GetRecursiveChildren(user, true).ToList();
|
||||
}
|
||||
var parentWithImage = linkedChildren.FirstOrDefault(i => i.GetImages(ImageType.Primary).Any());
|
||||
|
||||
if (parentWithImage != null)
|
||||
{
|
||||
dto.ParentPrimaryImageItemId = GetDtoId(parentWithImage);
|
||||
dto.ParentPrimaryImageTag = GetImageCacheTag(parentWithImage, ImageType.Primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetMappedPath(IHasMetadata item)
|
||||
{
|
||||
var path = item.Path;
|
||||
|
||||
Reference in New Issue
Block a user