mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-26 03:57:12 +00:00
Upgraded Protobuf, and added api support for it
This commit is contained in:
parent
de74609784
commit
cb7f04e4d3
@@ -1,13 +1,23 @@
|
||||
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.DTO
|
||||
{
|
||||
[ProtoContract]
|
||||
public class AudioInfo
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public int BitRate { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public int Channels { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public string Artist { get; set; }
|
||||
|
||||
[ProtoMember(4)]
|
||||
public string Album { get; set; }
|
||||
|
||||
[ProtoMember(5)]
|
||||
public string AlbumArtist { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.DTO
|
||||
{
|
||||
@@ -8,89 +9,151 @@ namespace MediaBrowser.Model.DTO
|
||||
/// This is strictly used as a data transfer object from the api layer.
|
||||
/// This holds information about a BaseItem in a format that is convenient for the client.
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public class DTOBaseItem : IHasProviderIds
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public DateTime DateCreated { get; set; }
|
||||
|
||||
[ProtoMember(4)]
|
||||
public string SortName { get; set; }
|
||||
|
||||
[ProtoMember(5)]
|
||||
public DateTime? PremiereDate { get; set; }
|
||||
|
||||
[ProtoMember(6)]
|
||||
public string Path { get; set; }
|
||||
|
||||
[ProtoMember(7)]
|
||||
public string OfficialRating { get; set; }
|
||||
|
||||
[ProtoMember(8)]
|
||||
public string Overview { get; set; }
|
||||
public IEnumerable<string> Taglines { get; set; }
|
||||
|
||||
public IEnumerable<string> Genres { get; set; }
|
||||
[ProtoMember(9)]
|
||||
public IList<string> Taglines { get; set; }
|
||||
|
||||
[ProtoMember(10)]
|
||||
public IList<string> Genres { get; set; }
|
||||
|
||||
[ProtoMember(11)]
|
||||
public string DisplayMediaType { get; set; }
|
||||
|
||||
[ProtoMember(12)]
|
||||
public float? UserRating { get; set; }
|
||||
|
||||
[ProtoMember(13)]
|
||||
public long? RunTimeTicks { get; set; }
|
||||
|
||||
[ProtoMember(14)]
|
||||
public string AspectRatio { get; set; }
|
||||
|
||||
[ProtoMember(15)]
|
||||
public int? ProductionYear { get; set; }
|
||||
|
||||
[ProtoMember(16)]
|
||||
public int? IndexNumber { get; set; }
|
||||
|
||||
[ProtoMember(17)]
|
||||
public int? ParentIndexNumber { get; set; }
|
||||
|
||||
[ProtoMember(18)]
|
||||
public string TrailerUrl { get; set; }
|
||||
|
||||
[ProtoMember(19)]
|
||||
public Dictionary<string, string> ProviderIds { get; set; }
|
||||
|
||||
[ProtoMember(20)]
|
||||
public bool HasBanner { get; set; }
|
||||
|
||||
[ProtoMember(21)]
|
||||
public bool HasArt { get; set; }
|
||||
|
||||
[ProtoMember(22)]
|
||||
public bool HasLogo { get; set; }
|
||||
|
||||
[ProtoMember(23)]
|
||||
public bool HasThumb { get; set; }
|
||||
|
||||
[ProtoMember(24)]
|
||||
public bool HasPrimaryImage { get; set; }
|
||||
|
||||
[ProtoMember(25)]
|
||||
public string Language { get; set; }
|
||||
|
||||
|
||||
[ProtoMember(26)]
|
||||
public int BackdropCount { get; set; }
|
||||
|
||||
public IEnumerable<DTOBaseItem> Children { get; set; }
|
||||
[ProtoMember(27)]
|
||||
public DTOBaseItem[] Children { get; set; }
|
||||
|
||||
[ProtoMember(28)]
|
||||
public bool IsFolder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the item is a Folder this will determine if it's the Root or not
|
||||
/// </summary>
|
||||
[ProtoMember(29)]
|
||||
public bool? IsRoot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the item is a Folder this will determine if it's a VF or not
|
||||
/// </summary>
|
||||
[ProtoMember(30)]
|
||||
public bool? IsVirtualFolder { get; set; }
|
||||
|
||||
|
||||
[ProtoMember(31)]
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
[ProtoMember(32)]
|
||||
public string Type { get; set; }
|
||||
|
||||
public IEnumerable<BaseItemPerson> People { get; set; }
|
||||
public IEnumerable<BaseItemStudio> Studios { get; set; }
|
||||
[ProtoMember(33)]
|
||||
public BaseItemPerson[] People { get; set; }
|
||||
|
||||
[ProtoMember(34)]
|
||||
public BaseItemStudio[] Studios { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the item does not have a logo, this will hold the Id of the Parent that has one.
|
||||
/// </summary>
|
||||
[ProtoMember(35)]
|
||||
public Guid? ParentLogoItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the item does not have any backdrops, this will hold the Id of the Parent that has one.
|
||||
/// </summary>
|
||||
[ProtoMember(36)]
|
||||
public Guid? ParentBackdropItemId { get; set; }
|
||||
|
||||
[ProtoMember(37)]
|
||||
public int? ParentBackdropCount { get; set; }
|
||||
|
||||
public IEnumerable<DTOBaseItem> LocalTrailers { get; set; }
|
||||
[ProtoMember(38)]
|
||||
public DTOBaseItem[] LocalTrailers { get; set; }
|
||||
|
||||
[ProtoMember(39)]
|
||||
public int LocalTrailerCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User data for this item based on the user it's being requested for
|
||||
/// </summary>
|
||||
[ProtoMember(40)]
|
||||
public UserItemData UserData { get; set; }
|
||||
|
||||
[ProtoMember(41)]
|
||||
public ItemSpecialCounts SpecialCounts { get; set; }
|
||||
|
||||
[ProtoMember(42)]
|
||||
public AudioInfo AudioInfo { get; set; }
|
||||
|
||||
[ProtoMember(43)]
|
||||
public VideoInfo VideoInfo { get; set; }
|
||||
|
||||
public bool IsType(Type type)
|
||||
@@ -103,6 +166,7 @@ namespace MediaBrowser.Model.DTO
|
||||
return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
[ProtoMember(44)]
|
||||
public bool IsNew { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
18
MediaBrowser.Model/DTO/DTOUser.cs
Normal file
18
MediaBrowser.Model/DTO/DTOUser.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.DTO
|
||||
{
|
||||
[ProtoContract]
|
||||
public class DTOUser
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public bool HasImage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,65 @@
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.DTO
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a stub class used by the api to get IBN types along with their item counts
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public class IBNItem
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the person, genre, etc
|
||||
/// </summary>
|
||||
[ProtoMember(1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The id of the person, genre, etc
|
||||
/// </summary>
|
||||
[ProtoMember(2)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public bool HasImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of items that have the genre, year, studio, etc
|
||||
/// </summary>
|
||||
[ProtoMember(4)]
|
||||
public int BaseItemCount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used by the api to get information about a Person within a BaseItem
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public class BaseItemPerson
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public string Overview { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public string Type { get; set; }
|
||||
|
||||
[ProtoMember(4)]
|
||||
public bool HasImage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used by the api to get information about a studio within a BaseItem
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public class BaseItemStudio
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public bool HasImage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,30 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.DTO
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a serializable stub class that is used by the api to provide information about installed plugins.
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public class PluginInfo
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public string Path { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
[ProtoMember(4)]
|
||||
public bool DownloadToUI { get; set; }
|
||||
|
||||
[ProtoMember(5)]
|
||||
public DateTime ConfigurationDateLastModified { get; set; }
|
||||
|
||||
[ProtoMember(6)]
|
||||
public Version Version { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.DTO
|
||||
{
|
||||
[ProtoContract]
|
||||
public class VideoInfo
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public string Codec { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public int Height { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public int Width { get; set; }
|
||||
|
||||
[ProtoMember(4)]
|
||||
public string ScanType { get; set; }
|
||||
|
||||
[ProtoMember(5)]
|
||||
public VideoType VideoType { get; set; }
|
||||
|
||||
[ProtoMember(6)]
|
||||
public IEnumerable<SubtitleStream> Subtitles { get; set; }
|
||||
|
||||
[ProtoMember(7)]
|
||||
public IEnumerable<AudioStream> AudioStreams { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Since it can be slow to collect this data, this class helps provide a way to calculate them all at once.
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public class ItemSpecialCounts
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public int RecentlyAddedItemCount { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public int RecentlyAddedUnPlayedItemCount { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public int InProgressItemCount { get; set; }
|
||||
|
||||
[ProtoMember(4)]
|
||||
public decimal PlayedPercentage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
[ProtoContract]
|
||||
public class UserItemData
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public UserItemRating Rating { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public long PlaybackPositionTicks { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public int PlayCount { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
@@ -17,20 +18,38 @@ namespace MediaBrowser.Model.Entities
|
||||
public string Codec { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public class AudioStream
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public string Codec { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public string Language { get; set; }
|
||||
|
||||
[ProtoMember(3)]
|
||||
public int BitRate { get; set; }
|
||||
|
||||
[ProtoMember(4)]
|
||||
public int Channels { get; set; }
|
||||
|
||||
[ProtoMember(5)]
|
||||
public int SampleRate { get; set; }
|
||||
|
||||
[ProtoMember(6)]
|
||||
public bool IsDefault { get; set; }
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public class SubtitleStream
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public string Language { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
[ProtoMember(2)]
|
||||
public bool IsForced { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="DTO\AudioInfo.cs" />
|
||||
<Compile Include="DTO\DTOBaseItem.cs" />
|
||||
<Compile Include="DTO\DTOUser.cs" />
|
||||
<Compile Include="DTO\VideoInfo.cs" />
|
||||
<Compile Include="Entities\Audio.cs" />
|
||||
<Compile Include="Entities\BaseEntity.cs" />
|
||||
@@ -56,6 +57,11 @@
|
||||
<Compile Include="Entities\User.cs" />
|
||||
<Compile Include="Entities\UserItemData.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="protobuf-net">
|
||||
<HintPath>..\packages\protobuf-net.2.0.0.580\lib\sl4\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
Reference in New Issue
Block a user