mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
Merge pull request #1651 from sl1288/master
Fix local trailers playback
This commit is contained in:
commit
24775f4988
@ -1079,7 +1079,7 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
allExtras = item.GetExtras().ToArray();
|
allExtras = item.GetExtras().ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.LocalTrailerCount = allExtras.Count(i => i.ExtraType.HasValue && i.ExtraType.Value == ExtraType.Trailer);
|
dto.LocalTrailerCount = allExtras.Count(i => i.ExtraType.HasValue && i.ExtraType.Value == ExtraType.Trailer) + item.GetTrailers().Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add EpisodeInfo
|
// Add EpisodeInfo
|
||||||
|
@ -366,11 +366,13 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
|
|
||||||
var dtoOptions = GetDtoOptions(_authContext, request);
|
var dtoOptions = GetDtoOptions(_authContext, request);
|
||||||
|
|
||||||
var dtos = item.GetExtras(new[] { ExtraType.Trailer })
|
var dtosExtras = item.GetExtras(new[] { ExtraType.Trailer })
|
||||||
.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item))
|
.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item));
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
return ToOptimizedResult(dtos);
|
var dtosTrailers = item.GetTrailers()
|
||||||
|
.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item));
|
||||||
|
|
||||||
|
return ToOptimizedResult(dtosExtras.Concat(dtosTrailers).ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2883,6 +2883,14 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return ExtraIds.Select(LibraryManager.GetItemById).Where(i => i != null && extraTypes.Contains(i.ExtraType.Value)).OrderBy(i => i.SortName);
|
return ExtraIds.Select(LibraryManager.GetItemById).Where(i => i != null && extraTypes.Contains(i.ExtraType.Value)).OrderBy(i => i.SortName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<BaseItem> GetTrailers()
|
||||||
|
{
|
||||||
|
if (this is IHasTrailers)
|
||||||
|
return ((IHasTrailers)this).LocalTrailerIds.Select(LibraryManager.GetItemById).Where(i => i != null).OrderBy(i => i.SortName);
|
||||||
|
else
|
||||||
|
return Array.Empty<BaseItem>();
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<BaseItem> GetDisplayExtras()
|
public IEnumerable<BaseItem> GetDisplayExtras()
|
||||||
{
|
{
|
||||||
return GetExtras(DisplayExtraTypes);
|
return GetExtras(DisplayExtraTypes);
|
||||||
|
Loading…
Reference in New Issue
Block a user