mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Use dto instead of db object when returning trickplay
This commit is contained in:
parent
0fc8ed6aeb
commit
afa2103d42
@ -1065,7 +1065,12 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
|
|
||||||
if (options.ContainsField(ItemFields.Trickplay))
|
if (options.ContainsField(ItemFields.Trickplay))
|
||||||
{
|
{
|
||||||
dto.Trickplay = _trickplayManager.GetTrickplayManifest(item).GetAwaiter().GetResult();
|
var trickplay = _trickplayManager.GetTrickplayManifest(item).GetAwaiter().GetResult();
|
||||||
|
dto.Trickplay = trickplay.ToDictionary(
|
||||||
|
mediaStream => mediaStream.Key,
|
||||||
|
mediaStream => mediaStream.Value.ToDictionary(
|
||||||
|
width => width.Key,
|
||||||
|
width => new TrickplayInfoDto(width.Value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.ExtraType = video.ExtraType;
|
dto.ExtraType = video.ExtraType;
|
||||||
|
@ -569,7 +569,7 @@ namespace MediaBrowser.Model.Dto
|
|||||||
/// Gets or sets the trickplay manifest.
|
/// Gets or sets the trickplay manifest.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The trickplay manifest.</value>
|
/// <value>The trickplay manifest.</value>
|
||||||
public Dictionary<string, Dictionary<int, TrickplayInfo>> Trickplay { get; set; }
|
public Dictionary<string, Dictionary<int, TrickplayInfoDto>> Trickplay { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the type of the location.
|
/// Gets or sets the type of the location.
|
||||||
|
62
MediaBrowser.Model/Dto/TrickplayInfoDto.cs
Normal file
62
MediaBrowser.Model/Dto/TrickplayInfoDto.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using Jellyfin.Database.Implementations.Entities;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.Dto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The trickplay api model.
|
||||||
|
/// </summary>
|
||||||
|
public record TrickplayInfoDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TrickplayInfoDto"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info">The trickplay info.</param>
|
||||||
|
public TrickplayInfoDto(TrickplayInfo info)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(info);
|
||||||
|
|
||||||
|
Width = info.Width;
|
||||||
|
Height = info.Height;
|
||||||
|
TileWidth = info.TileWidth;
|
||||||
|
TileHeight = info.TileHeight;
|
||||||
|
ThumbnailCount = info.ThumbnailCount;
|
||||||
|
Interval = info.Interval;
|
||||||
|
Bandwidth = info.Bandwidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the width of an individual thumbnail.
|
||||||
|
/// </summary>
|
||||||
|
public int Width { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the height of an individual thumbnail.
|
||||||
|
/// </summary>
|
||||||
|
public int Height { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the amount of thumbnails per row.
|
||||||
|
/// </summary>
|
||||||
|
public int TileWidth { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the amount of thumbnails per column.
|
||||||
|
/// </summary>
|
||||||
|
public int TileHeight { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total amount of non-black thumbnails.
|
||||||
|
/// </summary>
|
||||||
|
public int ThumbnailCount { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the interval in milliseconds between each trickplay thumbnail.
|
||||||
|
/// </summary>
|
||||||
|
public int Interval { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the peak bandwidth usage in bits per second.
|
||||||
|
/// </summary>
|
||||||
|
public int Bandwidth { get; init; }
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user