jellyfin-server/MediaBrowser.Controller/Entities/IHasTrailers.cs

39 lines
1.1 KiB
C#
Raw Normal View History

#nullable disable
#pragma warning disable CS1591
2018-12-27 23:27:57 +00:00
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
2018-12-27 23:27:57 +00:00
namespace MediaBrowser.Controller.Entities
{
public interface IHasTrailers : IHasProviderIds
{
/// <summary>
/// Gets or sets the remote trailers.
/// </summary>
/// <value>The remote trailers.</value>
IReadOnlyList<MediaUrl> RemoteTrailers { get; set; }
2018-12-27 23:27:57 +00:00
/// <summary>
2021-12-07 14:18:17 +00:00
/// Gets the local trailers.
2018-12-27 23:27:57 +00:00
/// </summary>
2021-12-07 14:18:17 +00:00
/// <value>The local trailers.</value>
IReadOnlyList<BaseItem> LocalTrailers { get; }
2018-12-27 23:27:57 +00:00
}
/// <summary>
/// Class providing extension methods for working with <see cref="IHasTrailers" />.
/// </summary>
2018-12-27 23:27:57 +00:00
public static class HasTrailerExtensions
{
/// <summary>
/// Gets the trailer count.
/// </summary>
/// <param name="item">Media item.</param>
/// <returns><see cref="IReadOnlyList{Guid}" />.</returns>
public static int GetTrailerCount(this IHasTrailers item)
2021-12-07 14:18:17 +00:00
=> item.LocalTrailers.Count + item.RemoteTrailers.Count;
2018-12-27 23:27:57 +00:00
}
}