repo creation with initial code after cloning public repo

This commit is contained in:
2026-02-19 07:36:25 -05:00
commit 460884fea3
2860 changed files with 650825 additions and 0 deletions
@@ -0,0 +1,34 @@
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Class ChapterInfo.
/// </summary>
public class ChapterInfo
{
/// <summary>
/// Gets or sets the start position ticks.
/// </summary>
/// <value>The start position ticks.</value>
public long StartPositionTicks { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string? Name { get; set; }
/// <summary>
/// Gets or sets the image path.
/// </summary>
/// <value>The image path.</value>
public string? ImagePath { get; set; }
public DateTime ImageDateModified { get; set; }
public string? ImageTag { get; set; }
}
}
@@ -0,0 +1,49 @@
#pragma warning disable SA1300 // Lowercase required for backwards compat.
namespace MediaBrowser.Model.Entities;
/// <summary>
/// The collection type options.
/// </summary>
public enum CollectionTypeOptions
{
/// <summary>
/// Movies.
/// </summary>
movies = 0,
/// <summary>
/// TV Shows.
/// </summary>
tvshows = 1,
/// <summary>
/// Music.
/// </summary>
music = 2,
/// <summary>
/// Music Videos.
/// </summary>
musicvideos = 3,
/// <summary>
/// Home Videos (and Photos).
/// </summary>
homevideos = 4,
/// <summary>
/// Box Sets.
/// </summary>
boxsets = 5,
/// <summary>
/// Books.
/// </summary>
books = 6,
/// <summary>
/// Mixed Movies and TV Shows.
/// </summary>
mixed = 7
}
@@ -0,0 +1,19 @@
#pragma warning disable SA1300 // Lowercase required for backwards compat.
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Enum containing deinterlace methods.
/// </summary>
public enum DeinterlaceMethod
{
/// <summary>
/// YADIF.
/// </summary>
yadif = 0,
/// <summary>
/// BWDIF.
/// </summary>
bwdif = 1
}
@@ -0,0 +1,35 @@
namespace MediaBrowser.Model.Entities;
/// <summary>
/// An enum representing an algorithm to downmix surround sound to stereo.
/// </summary>
public enum DownMixStereoAlgorithms
{
/// <summary>
/// No special algorithm.
/// </summary>
None = 0,
/// <summary>
/// Algorithm by Dave_750.
/// Sourced from https://superuser.com/questions/852400/properly-downmix-5-1-to-stereo-using-ffmpeg/1410620#1410620.
/// </summary>
Dave750 = 1,
/// <summary>
/// Nightmode Dialogue algorithm.
/// Sourced from https://superuser.com/questions/852400/properly-downmix-5-1-to-stereo-using-ffmpeg/1410620#1410620.
/// </summary>
NightmodeDialogue = 2,
/// <summary>
/// RFC7845 Section 5.1.1.5 defined algorithm.
/// </summary>
Rfc7845 = 3,
/// <summary>
/// AC-4 standard algorithm with its default gain values.
/// Defined in ETSI TS 103 190 Section 6.2.17.
/// </summary>
Ac4 = 4
}
@@ -0,0 +1,64 @@
#pragma warning disable SA1300 // Lowercase required for backwards compat.
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Enum containing encoder presets.
/// </summary>
public enum EncoderPreset
{
/// <summary>
/// Auto preset.
/// </summary>
auto = 0,
/// <summary>
/// Placebo preset.
/// </summary>
placebo = 1,
/// <summary>
/// Veryslow preset.
/// </summary>
veryslow = 2,
/// <summary>
/// Slower preset.
/// </summary>
slower = 3,
/// <summary>
/// Slow preset.
/// </summary>
slow = 4,
/// <summary>
/// Medium preset.
/// </summary>
medium = 5,
/// <summary>
/// Fast preset.
/// </summary>
fast = 6,
/// <summary>
/// Faster preset.
/// </summary>
faster = 7,
/// <summary>
/// Veryfast preset.
/// </summary>
veryfast = 8,
/// <summary>
/// Superfast preset.
/// </summary>
superfast = 9,
/// <summary>
/// Ultrafast preset.
/// </summary>
ultrafast = 10
}
+20
View File
@@ -0,0 +1,20 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Entities
{
public enum ExtraType
{
Unknown = 0,
Clip = 1,
Trailer = 2,
BehindTheScenes = 3,
DeletedScene = 4,
Interview = 5,
Scene = 6,
Sample = 7,
ThemeSong = 8,
ThemeVideo = 9,
Featurette = 10,
Short = 11
}
}
@@ -0,0 +1,49 @@
#pragma warning disable SA1300 // Lowercase required for backwards compat.
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Enum containing hardware acceleration types.
/// </summary>
public enum HardwareAccelerationType
{
/// <summary>
/// Software acceleration.
/// </summary>
none = 0,
/// <summary>
/// AMD AMF.
/// </summary>
amf = 1,
/// <summary>
/// Intel Quick Sync Video.
/// </summary>
qsv = 2,
/// <summary>
/// NVIDIA NVENC.
/// </summary>
nvenc = 3,
/// <summary>
/// Video4Linux2 V4L2M2M.
/// </summary>
v4l2m2m = 4,
/// <summary>
/// Video Acceleration API (VAAPI).
/// </summary>
vaapi = 5,
/// <summary>
/// Video ToolBox.
/// </summary>
videotoolbox = 6,
/// <summary>
/// Rockchip Media Process Platform (RKMPP).
/// </summary>
rkmpp = 7
}
@@ -0,0 +1,16 @@
using System.Collections.Generic;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repetition by using extension methods.
/// </summary>
public interface IHasProviderIds
{
/// <summary>
/// Gets or sets the provider ids.
/// </summary>
/// <value>The provider ids.</value>
Dictionary<string, string> ProviderIds { get; set; }
}
}
+14
View File
@@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Interface for access to shares.
/// </summary>
public interface IHasShares
{
/// <summary>
/// Gets or sets the shares.
/// </summary>
IReadOnlyList<PlaylistUserPermissions> Shares { get; set; }
}
+77
View File
@@ -0,0 +1,77 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum ImageType.
/// </summary>
public enum ImageType
{
/// <summary>
/// The primary.
/// </summary>
Primary = 0,
/// <summary>
/// The art.
/// </summary>
Art = 1,
/// <summary>
/// The backdrop.
/// </summary>
Backdrop = 2,
/// <summary>
/// The banner.
/// </summary>
Banner = 3,
/// <summary>
/// The logo.
/// </summary>
Logo = 4,
/// <summary>
/// The thumb.
/// </summary>
Thumb = 5,
/// <summary>
/// The disc.
/// </summary>
Disc = 6,
/// <summary>
/// The box.
/// </summary>
Box = 7,
/// <summary>
/// The screenshot.
/// </summary>
/// <remarks>
/// This enum value is obsolete.
/// XmlSerializer does not serialize/deserialize objects that are marked as [Obsolete].
/// </remarks>
Screenshot = 8,
/// <summary>
/// The menu.
/// </summary>
Menu = 9,
/// <summary>
/// The chapter image.
/// </summary>
Chapter = 10,
/// <summary>
/// The box rear.
/// </summary>
BoxRear = 11,
/// <summary>
/// The user profile image.
/// </summary>
Profile = 12
}
}
+18
View File
@@ -0,0 +1,18 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum IsoType.
/// </summary>
public enum IsoType
{
/// <summary>
/// The DVD.
/// </summary>
Dvd,
/// <summary>
/// The blu ray.
/// </summary>
BluRay
}
}
@@ -0,0 +1,59 @@
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Class LibraryUpdateInfo.
/// </summary>
public class LibraryUpdateInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class.
/// </summary>
public LibraryUpdateInfo()
{
FoldersAddedTo = Array.Empty<string>();
FoldersRemovedFrom = Array.Empty<string>();
ItemsAdded = Array.Empty<string>();
ItemsRemoved = Array.Empty<string>();
ItemsUpdated = Array.Empty<string>();
CollectionFolders = Array.Empty<string>();
}
/// <summary>
/// Gets or sets the folders added to.
/// </summary>
/// <value>The folders added to.</value>
public string[] FoldersAddedTo { get; set; }
/// <summary>
/// Gets or sets the folders removed from.
/// </summary>
/// <value>The folders removed from.</value>
public string[] FoldersRemovedFrom { get; set; }
/// <summary>
/// Gets or sets the items added.
/// </summary>
/// <value>The items added.</value>
public string[] ItemsAdded { get; set; }
/// <summary>
/// Gets or sets the items removed.
/// </summary>
/// <value>The items removed.</value>
public string[] ItemsRemoved { get; set; }
/// <summary>
/// Gets or sets the items updated.
/// </summary>
/// <value>The items updated.</value>
public string[] ItemsUpdated { get; set; }
public string[] CollectionFolders { get; set; }
public bool IsEmpty => FoldersAddedTo.Length == 0 && FoldersRemovedFrom.Length == 0 && ItemsAdded.Length == 0 && ItemsRemoved.Length == 0 && ItemsUpdated.Length == 0 && CollectionFolders.Length == 0;
}
}
@@ -0,0 +1,28 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum LocationType.
/// </summary>
public enum LocationType
{
/// <summary>
/// The file system.
/// </summary>
FileSystem = 0,
/// <summary>
/// The remote.
/// </summary>
Remote = 1,
/// <summary>
/// The virtual.
/// </summary>
Virtual = 2,
/// <summary>
/// The offline.
/// </summary>
Offline = 3
}
}
@@ -0,0 +1,49 @@
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Class MediaAttachment.
/// </summary>
public class MediaAttachment
{
/// <summary>
/// Gets or sets the codec.
/// </summary>
/// <value>The codec.</value>
public string? Codec { get; set; }
/// <summary>
/// Gets or sets the codec tag.
/// </summary>
/// <value>The codec tag.</value>
public string? CodecTag { get; set; }
/// <summary>
/// Gets or sets the comment.
/// </summary>
/// <value>The comment.</value>
public string? Comment { get; set; }
/// <summary>
/// Gets or sets the index.
/// </summary>
/// <value>The index.</value>
public int Index { get; set; }
/// <summary>
/// Gets or sets the filename.
/// </summary>
/// <value>The filename.</value>
public string? FileName { get; set; }
/// <summary>
/// Gets or sets the MIME type.
/// </summary>
/// <value>The MIME type.</value>
public string? MimeType { get; set; }
/// <summary>
/// Gets or sets the delivery URL.
/// </summary>
/// <value>The delivery URL.</value>
public string? DeliveryUrl { get; set; }
}
+840
View File
@@ -0,0 +1,840 @@
#nullable disable
#pragma warning disable CS1591
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Class MediaStream.
/// </summary>
public class MediaStream
{
private static readonly string[] _specialCodes =
{
// Uncoded languages.
"mis",
// Multiple languages.
"mul",
// Undetermined.
"und",
// No linguistic content; not applicable.
"zxx"
};
/// <summary>
/// Gets or sets the codec.
/// </summary>
/// <value>The codec.</value>
public string Codec { get; set; }
/// <summary>
/// Gets or sets the codec tag.
/// </summary>
/// <value>The codec tag.</value>
public string CodecTag { get; set; }
/// <summary>
/// Gets or sets the language.
/// </summary>
/// <value>The language.</value>
public string Language { get; set; }
/// <summary>
/// Gets or sets the color range.
/// </summary>
/// <value>The color range.</value>
public string ColorRange { get; set; }
/// <summary>
/// Gets or sets the color space.
/// </summary>
/// <value>The color space.</value>
public string ColorSpace { get; set; }
/// <summary>
/// Gets or sets the color transfer.
/// </summary>
/// <value>The color transfer.</value>
public string ColorTransfer { get; set; }
/// <summary>
/// Gets or sets the color primaries.
/// </summary>
/// <value>The color primaries.</value>
public string ColorPrimaries { get; set; }
/// <summary>
/// Gets or sets the Dolby Vision version major.
/// </summary>
/// <value>The Dolby Vision version major.</value>
public int? DvVersionMajor { get; set; }
/// <summary>
/// Gets or sets the Dolby Vision version minor.
/// </summary>
/// <value>The Dolby Vision version minor.</value>
public int? DvVersionMinor { get; set; }
/// <summary>
/// Gets or sets the Dolby Vision profile.
/// </summary>
/// <value>The Dolby Vision profile.</value>
public int? DvProfile { get; set; }
/// <summary>
/// Gets or sets the Dolby Vision level.
/// </summary>
/// <value>The Dolby Vision level.</value>
public int? DvLevel { get; set; }
/// <summary>
/// Gets or sets the Dolby Vision rpu present flag.
/// </summary>
/// <value>The Dolby Vision rpu present flag.</value>
public int? RpuPresentFlag { get; set; }
/// <summary>
/// Gets or sets the Dolby Vision el present flag.
/// </summary>
/// <value>The Dolby Vision el present flag.</value>
public int? ElPresentFlag { get; set; }
/// <summary>
/// Gets or sets the Dolby Vision bl present flag.
/// </summary>
/// <value>The Dolby Vision bl present flag.</value>
public int? BlPresentFlag { get; set; }
/// <summary>
/// Gets or sets the Dolby Vision bl signal compatibility id.
/// </summary>
/// <value>The Dolby Vision bl signal compatibility id.</value>
public int? DvBlSignalCompatibilityId { get; set; }
/// <summary>
/// Gets or sets the Rotation in degrees.
/// </summary>
/// <value>The video rotation.</value>
public int? Rotation { get; set; }
/// <summary>
/// Gets or sets the comment.
/// </summary>
/// <value>The comment.</value>
public string Comment { get; set; }
/// <summary>
/// Gets or sets the time base.
/// </summary>
/// <value>The time base.</value>
public string TimeBase { get; set; }
/// <summary>
/// Gets or sets the codec time base.
/// </summary>
/// <value>The codec time base.</value>
public string CodecTimeBase { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
public string Title { get; set; }
public bool? Hdr10PlusPresentFlag { get; set; }
/// <summary>
/// Gets the video range.
/// </summary>
/// <value>The video range.</value>
[DefaultValue(VideoRange.Unknown)]
public VideoRange VideoRange
{
get
{
var (videoRange, _) = GetVideoColorRange();
return videoRange;
}
}
/// <summary>
/// Gets the video range type.
/// </summary>
/// <value>The video range type.</value>
[DefaultValue(VideoRangeType.Unknown)]
public VideoRangeType VideoRangeType
{
get
{
var (_, videoRangeType) = GetVideoColorRange();
return videoRangeType;
}
}
/// <summary>
/// Gets the video dovi title.
/// </summary>
/// <value>The video dovi title.</value>
public string VideoDoViTitle
{
get
{
var dvProfile = DvProfile;
var rpuPresentFlag = RpuPresentFlag == 1;
var blPresentFlag = BlPresentFlag == 1;
var dvBlCompatId = DvBlSignalCompatibilityId;
if (rpuPresentFlag
&& blPresentFlag
&& (dvProfile == 4
|| dvProfile == 5
|| dvProfile == 7
|| dvProfile == 8
|| dvProfile == 9
|| dvProfile == 10))
{
var title = "Dolby Vision Profile " + dvProfile;
if (dvBlCompatId > 0)
{
title += "." + dvBlCompatId;
}
return dvBlCompatId switch
{
1 => title + " (HDR10)",
2 => title + " (SDR)",
4 => title + " (HLG)",
6 => title + " (HDR10)", // Technically means Blu-ray, but practically always HDR10
_ => title
};
}
return null;
}
}
/// <summary>
/// Gets the audio spatial format.
/// </summary>
/// <value>The audio spatial format.</value>
[DefaultValue(AudioSpatialFormat.None)]
public AudioSpatialFormat AudioSpatialFormat
{
get
{
if (Type != MediaStreamType.Audio || string.IsNullOrEmpty(Profile))
{
return AudioSpatialFormat.None;
}
return
Profile.Contains("Dolby Atmos", StringComparison.OrdinalIgnoreCase) ? AudioSpatialFormat.DolbyAtmos :
Profile.Contains("DTS:X", StringComparison.OrdinalIgnoreCase) ? AudioSpatialFormat.DTSX :
AudioSpatialFormat.None;
}
}
public string LocalizedUndefined { get; set; }
public string LocalizedDefault { get; set; }
public string LocalizedForced { get; set; }
public string LocalizedExternal { get; set; }
public string LocalizedHearingImpaired { get; set; }
public string LocalizedLanguage { get; set; }
public string DisplayTitle
{
get
{
switch (Type)
{
case MediaStreamType.Audio:
{
var attributes = new List<string>();
// Do not display the language code in display titles if unset or set to a special code. Show it in all other cases (possibly expanded).
if (!string.IsNullOrEmpty(Language) && !_specialCodes.Contains(Language, StringComparison.OrdinalIgnoreCase))
{
// Use pre-resolved localized language name, falling back to raw language code.
attributes.Add(StringHelper.FirstToUpper(LocalizedLanguage ?? Language));
}
if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
{
attributes.Add(Profile);
}
else if (!string.IsNullOrEmpty(Codec))
{
attributes.Add(AudioCodec.GetFriendlyName(Codec));
}
if (!string.IsNullOrEmpty(ChannelLayout))
{
attributes.Add(StringHelper.FirstToUpper(ChannelLayout));
}
else if (Channels.HasValue)
{
attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");
}
if (IsDefault)
{
attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);
}
if (IsExternal)
{
attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);
}
if (!string.IsNullOrEmpty(Title))
{
var result = new StringBuilder(Title);
foreach (var tag in attributes)
{
// Keep Tags that are not already in Title.
if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))
{
result.Append(" - ").Append(tag);
}
}
return result.ToString();
}
return string.Join(" - ", attributes);
}
case MediaStreamType.Video:
{
var attributes = new List<string>();
var resolutionText = GetResolutionText();
if (!string.IsNullOrEmpty(resolutionText))
{
attributes.Add(resolutionText);
}
if (!string.IsNullOrEmpty(Codec))
{
attributes.Add(Codec.ToUpperInvariant());
}
if (VideoDoViTitle is not null)
{
attributes.Add(VideoDoViTitle);
}
else if (VideoRange != VideoRange.Unknown)
{
attributes.Add(VideoRange.ToString());
}
if (!string.IsNullOrEmpty(Title))
{
var result = new StringBuilder(Title);
foreach (var tag in attributes)
{
// Keep Tags that are not already in Title.
if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))
{
result.Append(" - ").Append(tag);
}
}
return result.ToString();
}
return string.Join(' ', attributes);
}
case MediaStreamType.Subtitle:
{
var attributes = new List<string>();
if (!string.IsNullOrEmpty(Language))
{
// Use pre-resolved localized language name, falling back to raw language code.
attributes.Add(StringHelper.FirstToUpper(LocalizedLanguage ?? Language));
}
else
{
attributes.Add(string.IsNullOrEmpty(LocalizedUndefined) ? "Und" : LocalizedUndefined);
}
if (IsHearingImpaired == true)
{
attributes.Add(string.IsNullOrEmpty(LocalizedHearingImpaired) ? "Hearing Impaired" : LocalizedHearingImpaired);
}
if (IsDefault)
{
attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);
}
if (IsForced)
{
attributes.Add(string.IsNullOrEmpty(LocalizedForced) ? "Forced" : LocalizedForced);
}
if (!string.IsNullOrEmpty(Codec))
{
attributes.Add(Codec.ToUpperInvariant());
}
if (IsExternal)
{
attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);
}
if (!string.IsNullOrEmpty(Title))
{
var result = new StringBuilder(Title);
foreach (var tag in attributes)
{
// Keep Tags that are not already in Title.
if (!Title.Contains(tag, StringComparison.OrdinalIgnoreCase))
{
result.Append(" - ").Append(tag);
}
}
return result.ToString();
}
return string.Join(" - ", attributes);
}
default:
return null;
}
}
}
public string NalLengthSize { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is interlaced.
/// </summary>
/// <value><c>true</c> if this instance is interlaced; otherwise, <c>false</c>.</value>
public bool IsInterlaced { get; set; }
public bool? IsAVC { get; set; }
/// <summary>
/// Gets or sets the channel layout.
/// </summary>
/// <value>The channel layout.</value>
public string ChannelLayout { get; set; }
/// <summary>
/// Gets or sets the bit rate.
/// </summary>
/// <value>The bit rate.</value>
public int? BitRate { get; set; }
/// <summary>
/// Gets or sets the bit depth.
/// </summary>
/// <value>The bit depth.</value>
public int? BitDepth { get; set; }
/// <summary>
/// Gets or sets the reference frames.
/// </summary>
/// <value>The reference frames.</value>
public int? RefFrames { get; set; }
/// <summary>
/// Gets or sets the length of the packet.
/// </summary>
/// <value>The length of the packet.</value>
public int? PacketLength { get; set; }
/// <summary>
/// Gets or sets the channels.
/// </summary>
/// <value>The channels.</value>
public int? Channels { get; set; }
/// <summary>
/// Gets or sets the sample rate.
/// </summary>
/// <value>The sample rate.</value>
public int? SampleRate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is default.
/// </summary>
/// <value><c>true</c> if this instance is default; otherwise, <c>false</c>.</value>
public bool IsDefault { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is forced.
/// </summary>
/// <value><c>true</c> if this instance is forced; otherwise, <c>false</c>.</value>
public bool IsForced { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is for the hearing impaired.
/// </summary>
/// <value><c>true</c> if this instance is for the hearing impaired; otherwise, <c>false</c>.</value>
public bool IsHearingImpaired { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>The height.</value>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>The width.</value>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the average frame rate.
/// </summary>
/// <value>The average frame rate.</value>
public float? AverageFrameRate { get; set; }
/// <summary>
/// Gets or sets the real frame rate.
/// </summary>
/// <value>The real frame rate.</value>
public float? RealFrameRate { get; set; }
/// <summary>
/// Gets the framerate used as reference.
/// Prefer AverageFrameRate, if that is null or an unrealistic value
/// then fallback to RealFrameRate.
/// </summary>
/// <value>The reference frame rate.</value>
public float? ReferenceFrameRate
{
get
{
// In some cases AverageFrameRate for videos will be read as 1000fps even if it is not.
// This is probably due to a library compatibility issue.
// See https://github.com/jellyfin/jellyfin/pull/12603#discussion_r1748044018 for more info.
return AverageFrameRate < 1000 ? AverageFrameRate : RealFrameRate;
}
}
/// <summary>
/// Gets or sets the profile.
/// </summary>
/// <value>The profile.</value>
public string Profile { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public MediaStreamType Type { get; set; }
/// <summary>
/// Gets or sets the aspect ratio.
/// </summary>
/// <value>The aspect ratio.</value>
public string AspectRatio { get; set; }
/// <summary>
/// Gets or sets the index.
/// </summary>
/// <value>The index.</value>
public int Index { get; set; }
/// <summary>
/// Gets or sets the score.
/// </summary>
/// <value>The score.</value>
public int? Score { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is external.
/// </summary>
/// <value><c>true</c> if this instance is external; otherwise, <c>false</c>.</value>
public bool IsExternal { get; set; }
/// <summary>
/// Gets or sets the method.
/// </summary>
/// <value>The method.</value>
public SubtitleDeliveryMethod? DeliveryMethod { get; set; }
/// <summary>
/// Gets or sets the delivery URL.
/// </summary>
/// <value>The delivery URL.</value>
public string DeliveryUrl { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is external URL.
/// </summary>
/// <value><c>null</c> if [is external URL] contains no value, <c>true</c> if [is external URL]; otherwise, <c>false</c>.</value>
public bool? IsExternalUrl { get; set; }
public bool IsTextSubtitleStream
{
get
{
if (Type != MediaStreamType.Subtitle)
{
return false;
}
if (string.IsNullOrEmpty(Codec) && !IsExternal)
{
return false;
}
return IsTextFormat(Codec);
}
}
[JsonIgnore]
public bool IsPgsSubtitleStream
{
get
{
if (Type != MediaStreamType.Subtitle)
{
return false;
}
if (string.IsNullOrEmpty(Codec) && !IsExternal)
{
return false;
}
return IsPgsFormat(Codec);
}
}
/// <summary>
/// Gets a value indicating whether this is a subtitle steam that is extractable by ffmpeg.
/// All text-based and pgs subtitles can be extracted.
/// </summary>
/// <value><c>true</c> if this is a extractable subtitle steam otherwise, <c>false</c>.</value>
[JsonIgnore]
public bool IsExtractableSubtitleStream => IsTextSubtitleStream || IsPgsSubtitleStream;
/// <summary>
/// Gets or sets a value indicating whether [supports external stream].
/// </summary>
/// <value><c>true</c> if [supports external stream]; otherwise, <c>false</c>.</value>
public bool SupportsExternalStream { get; set; }
/// <summary>
/// Gets or sets the filename.
/// </summary>
/// <value>The filename.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the pixel format.
/// </summary>
/// <value>The pixel format.</value>
public string PixelFormat { get; set; }
/// <summary>
/// Gets or sets the level.
/// </summary>
/// <value>The level.</value>
public double? Level { get; set; }
/// <summary>
/// Gets or sets whether this instance is anamorphic.
/// </summary>
/// <value><c>true</c> if this instance is anamorphic; otherwise, <c>false</c>.</value>
public bool? IsAnamorphic { get; set; }
internal string GetResolutionText()
{
if (!Width.HasValue || !Height.HasValue)
{
return null;
}
return Width switch
{
// 256x144 (16:9 square pixel format)
<= 256 when Height <= 144 => IsInterlaced ? "144i" : "144p",
// 426x240 (16:9 square pixel format)
<= 426 when Height <= 240 => IsInterlaced ? "240i" : "240p",
// 640x360 (16:9 square pixel format)
<= 640 when Height <= 360 => IsInterlaced ? "360i" : "360p",
// 682x384 (16:9 square pixel format)
<= 682 when Height <= 384 => IsInterlaced ? "384i" : "384p",
// 720x404 (16:9 square pixel format)
<= 720 when Height <= 404 => IsInterlaced ? "404i" : "404p",
// 854x480 (16:9 square pixel format)
<= 854 when Height <= 480 => IsInterlaced ? "480i" : "480p",
// 960x544 (16:9 square pixel format)
<= 960 when Height <= 544 => IsInterlaced ? "540i" : "540p",
// 1024x576 (16:9 square pixel format)
<= 1024 when Height <= 576 => IsInterlaced ? "576i" : "576p",
// 1280x720
<= 1280 when Height <= 962 => IsInterlaced ? "720i" : "720p",
// 2560x1080 (FHD ultra wide 21:9) using 1440px width to accommodate WQHD
<= 2560 when Height <= 1440 => IsInterlaced ? "1080i" : "1080p",
// 4K
<= 4096 when Height <= 3072 => "4K",
// 8K
<= 8192 when Height <= 6144 => "8K",
_ => null
};
}
public static bool IsTextFormat(string format)
{
string codec = format ?? string.Empty;
// microdvd and dvdsub/vobsub share the ".sub" file extension, but it's text-based.
return codec.Contains("microdvd", StringComparison.OrdinalIgnoreCase)
|| (!codec.Contains("pgs", StringComparison.OrdinalIgnoreCase)
&& !codec.Contains("dvdsub", StringComparison.OrdinalIgnoreCase)
&& !codec.Contains("dvbsub", StringComparison.OrdinalIgnoreCase)
&& !string.Equals(codec, "sup", StringComparison.OrdinalIgnoreCase)
&& !string.Equals(codec, "sub", StringComparison.OrdinalIgnoreCase));
}
public static bool IsPgsFormat(string format)
{
string codec = format ?? string.Empty;
return codec.Contains("pgs", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codec, "sup", StringComparison.OrdinalIgnoreCase);
}
public bool SupportsSubtitleConversionTo(string toCodec)
{
if (!IsTextSubtitleStream)
{
return false;
}
var fromCodec = Codec;
// Can't convert from this
if (string.Equals(fromCodec, "ass", StringComparison.OrdinalIgnoreCase))
{
return false;
}
if (string.Equals(fromCodec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;
}
// Can't convert to this
if (string.Equals(toCodec, "ass", StringComparison.OrdinalIgnoreCase))
{
return false;
}
if (string.Equals(toCodec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;
}
return true;
}
public (VideoRange VideoRange, VideoRangeType VideoRangeType) GetVideoColorRange()
{
if (Type != MediaStreamType.Video)
{
return (VideoRange.Unknown, VideoRangeType.Unknown);
}
var codecTag = CodecTag;
var dvProfile = DvProfile;
var rpuPresentFlag = RpuPresentFlag == 1;
var blPresentFlag = BlPresentFlag == 1;
var dvBlCompatId = DvBlSignalCompatibilityId;
var isDoViProfile = dvProfile is 5 or 7 or 8 or 10;
var isDoViFlag = rpuPresentFlag && blPresentFlag && dvBlCompatId is 0 or 1 or 4 or 2 or 6;
if ((isDoViProfile && isDoViFlag)
|| string.Equals(codecTag, "dovi", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codecTag, "dvh1", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codecTag, "dvhe", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codecTag, "dav1", StringComparison.OrdinalIgnoreCase))
{
var dvRangeSet = dvProfile switch
{
5 => (VideoRange.HDR, VideoRangeType.DOVI),
8 => dvBlCompatId switch
{
1 => (VideoRange.HDR, VideoRangeType.DOVIWithHDR10),
4 => (VideoRange.HDR, VideoRangeType.DOVIWithHLG),
2 => (VideoRange.SDR, VideoRangeType.DOVIWithSDR),
// Out of Dolby Spec files should be marked as invalid
_ => (VideoRange.HDR, VideoRangeType.DOVIInvalid)
},
7 => (VideoRange.HDR, VideoRangeType.DOVIWithEL),
10 => dvBlCompatId switch
{
0 => (VideoRange.HDR, VideoRangeType.DOVI),
1 => (VideoRange.HDR, VideoRangeType.DOVIWithHDR10),
2 => (VideoRange.SDR, VideoRangeType.DOVIWithSDR),
4 => (VideoRange.HDR, VideoRangeType.DOVIWithHLG),
// Out of Dolby Spec files should be marked as invalid
_ => (VideoRange.HDR, VideoRangeType.DOVIInvalid)
},
_ => (VideoRange.SDR, VideoRangeType.SDR)
};
if (Hdr10PlusPresentFlag == true)
{
return dvRangeSet.Item2 switch
{
VideoRangeType.DOVIWithHDR10 => (VideoRange.HDR, VideoRangeType.DOVIWithHDR10Plus),
VideoRangeType.DOVIWithEL => (VideoRange.HDR, VideoRangeType.DOVIWithELHDR10Plus),
_ => dvRangeSet
};
}
return dvRangeSet;
}
var colorTransfer = ColorTransfer;
if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase))
{
return Hdr10PlusPresentFlag == true ? (VideoRange.HDR, VideoRangeType.HDR10Plus) : (VideoRange.HDR, VideoRangeType.HDR10);
}
else if (string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase))
{
return (VideoRange.HDR, VideoRangeType.HLG);
}
return (VideoRange.SDR, VideoRangeType.SDR);
}
}
}
@@ -0,0 +1,38 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum MediaStreamType.
/// </summary>
public enum MediaStreamType
{
/// <summary>
/// The audio.
/// </summary>
Audio,
/// <summary>
/// The video.
/// </summary>
Video,
/// <summary>
/// The subtitle.
/// </summary>
Subtitle,
/// <summary>
/// The embedded image.
/// </summary>
EmbeddedImage,
/// <summary>
/// The data.
/// </summary>
Data,
/// <summary>
/// The lyric.
/// </summary>
Lyric
}
}
+12
View File
@@ -0,0 +1,12 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Entities
{
public class MediaUrl
{
public string Url { get; set; }
public string Name { get; set; }
}
}
@@ -0,0 +1,53 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum MetadataFields.
/// </summary>
public enum MetadataField
{
/// <summary>
/// The cast.
/// </summary>
Cast,
/// <summary>
/// The genres.
/// </summary>
Genres,
/// <summary>
/// The production locations.
/// </summary>
ProductionLocations,
/// <summary>
/// The studios.
/// </summary>
Studios,
/// <summary>
/// The tags.
/// </summary>
Tags,
/// <summary>
/// The name.
/// </summary>
Name,
/// <summary>
/// The overview.
/// </summary>
Overview,
/// <summary>
/// The runtime.
/// </summary>
Runtime,
/// <summary>
/// The official rating.
/// </summary>
OfficialRating
}
}
@@ -0,0 +1,94 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum MetadataProviders.
/// </summary>
public enum MetadataProvider
{
/// <summary>
/// This metadata provider is for users and/or plugins to override the
/// default merging behaviour.
/// </summary>
Custom = 0,
/// <summary>
/// The IMDb provider.
/// </summary>
Imdb = 2,
/// <summary>
/// The TMDb provider.
/// </summary>
Tmdb = 3,
/// <summary>
/// The TVDb provider.
/// </summary>
Tvdb = 4,
/// <summary>
/// The tvcom provider.
/// </summary>
Tvcom = 5,
/// <summary>
/// TMDb collection provider.
/// </summary>
TmdbCollection = 7,
/// <summary>
/// The MusicBrainz album provider.
/// </summary>
MusicBrainzAlbum = 8,
/// <summary>
/// The MusicBrainz album artist provider.
/// </summary>
MusicBrainzAlbumArtist = 9,
/// <summary>
/// The MusicBrainz artist provider.
/// </summary>
MusicBrainzArtist = 10,
/// <summary>
/// The MusicBrainz release group provider.
/// </summary>
MusicBrainzReleaseGroup = 11,
/// <summary>
/// The Zap2It provider.
/// </summary>
Zap2It = 12,
/// <summary>
/// The TvRage provider.
/// </summary>
TvRage = 15,
/// <summary>
/// The AudioDb artist provider.
/// </summary>
AudioDbArtist = 16,
/// <summary>
/// The AudioDb collection provider.
/// </summary>
AudioDbAlbum = 17,
/// <summary>
/// The MusicBrainz track provider.
/// </summary>
MusicBrainzTrack = 18,
/// <summary>
/// The TvMaze provider.
/// </summary>
TvMaze = 19,
/// <summary>
/// The MusicBrainz recording provider.
/// </summary>
MusicBrainzRecording = 20,
}
}
@@ -0,0 +1,40 @@
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Class ParentalRating.
/// </summary>
public class ParentalRating
{
/// <summary>
/// Initializes a new instance of the <see cref="ParentalRating"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="score">The score.</param>
public ParentalRating(string name, ParentalRatingScore? score)
{
Name = name;
Value = score?.Score;
RatingScore = score;
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
/// <remarks>
/// Deprecated.
/// </remarks>
public int? Value { get; set; }
/// <summary>
/// Gets or sets the rating score.
/// </summary>
/// <value>The rating score.</value>
public ParentalRatingScore? RatingScore { get; set; }
}
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace MediaBrowser.Model.Entities;
/// <summary>
/// A class representing an parental rating entry.
/// </summary>
public class ParentalRatingEntry
{
/// <summary>
/// Gets or sets the rating strings.
/// </summary>
[JsonPropertyName("ratingStrings")]
public required IReadOnlyList<string> RatingStrings { get; set; }
/// <summary>
/// Gets or sets the score.
/// </summary>
[JsonPropertyName("ratingScore")]
public required ParentalRatingScore RatingScore { get; set; }
}
@@ -0,0 +1,32 @@
using System.Text.Json.Serialization;
namespace MediaBrowser.Model.Entities;
/// <summary>
/// A class representing an parental rating score.
/// </summary>
public class ParentalRatingScore
{
/// <summary>
/// Initializes a new instance of the <see cref="ParentalRatingScore"/> class.
/// </summary>
/// <param name="score">The score.</param>
/// <param name="subScore">The sub score.</param>
public ParentalRatingScore(int score, int? subScore)
{
Score = score;
SubScore = subScore;
}
/// <summary>
/// Gets or sets the score.
/// </summary>
[JsonPropertyName("score")]
public int Score { get; set; }
/// <summary>
/// Gets or sets the sub score.
/// </summary>
[JsonPropertyName("subScore")]
public int? SubScore { get; set; }
}
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace MediaBrowser.Model.Entities;
/// <summary>
/// A class representing a parental rating system.
/// </summary>
public class ParentalRatingSystem
{
/// <summary>
/// Gets or sets the country code.
/// </summary>
[JsonPropertyName("countryCode")]
public required string CountryCode { get; set; }
/// <summary>
/// Gets or sets a value indicating whether sub scores are supported.
/// </summary>
[JsonPropertyName("supportsSubScores")]
public bool SupportsSubScores { get; set; }
/// <summary>
/// Gets or sets the ratings.
/// </summary>
[JsonPropertyName("ratings")]
public IReadOnlyList<ParentalRatingEntry>? Ratings { get; set; }
}
+68
View File
@@ -0,0 +1,68 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Types of persons.
/// </summary>
public static class PersonType
{
/// <summary>
/// A person whose profession is acting on the stage, in films, or on television.
/// </summary>
public const string Actor = "Actor";
/// <summary>
/// A person who supervises the actors and other staff in a film, play, or similar production.
/// </summary>
public const string Director = "Director";
/// <summary>
/// A person who writes music, especially as a professional occupation.
/// </summary>
public const string Composer = "Composer";
/// <summary>
/// A writer of a book, article, or document. Can also be used as a generic term for music writer if there is a lack of specificity.
/// </summary>
public const string Writer = "Writer";
/// <summary>
/// A well-known actor or other performer who appears in a work in which they do not have a regular role.
/// </summary>
public const string GuestStar = "GuestStar";
/// <summary>
/// A person responsible for the financial and managerial aspects of the making of a film or broadcast or for staging a play, opera, etc.
/// </summary>
public const string Producer = "Producer";
/// <summary>
/// A person who directs the performance of an orchestra or choir.
/// </summary>
public const string Conductor = "Conductor";
/// <summary>
/// A person who writes the words to a song or musical.
/// </summary>
public const string Lyricist = "Lyricist";
/// <summary>
/// A person who adapts a musical composition for performance.
/// </summary>
public const string Arranger = "Arranger";
/// <summary>
/// An audio engineer who performed a general engineering role.
/// </summary>
public const string Engineer = "Engineer";
/// <summary>
/// An engineer responsible for using a mixing console to mix a recorded track into a single piece of music suitable for release.
/// </summary>
public const string Mixer = "Mixer";
/// <summary>
/// A person who remixed a recording by taking one or more other tracks, substantially altering them and mixing them together with other material.
/// </summary>
public const string Remixer = "Remixer";
}
}
@@ -0,0 +1,30 @@
using System;
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Class to hold data on user permissions for playlists.
/// </summary>
public class PlaylistUserPermissions
{
/// <summary>
/// Initializes a new instance of the <see cref="PlaylistUserPermissions"/> class.
/// </summary>
/// <param name="userId">The user id.</param>
/// <param name="canEdit">Edit permission.</param>
public PlaylistUserPermissions(Guid userId, bool canEdit = false)
{
UserId = userId;
CanEdit = canEdit;
}
/// <summary>
/// Gets or sets the user id.
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the user has edit permissions.
/// </summary>
public bool CanEdit { get; set; }
}
@@ -0,0 +1,216 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Class ProviderIdsExtensions.
/// </summary>
public static class ProviderIdsExtensions
{
/// <summary>
/// Case-insensitive dictionary of <see cref="MetadataProvider"/> string representation.
/// </summary>
private static readonly Dictionary<string, string> _metadataProviderEnumDictionary =
Enum.GetValues<MetadataProvider>()
.ToDictionary(
enumValue => enumValue.ToString(),
enumValue => enumValue.ToString(),
StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Checks if this instance has an id for the given provider.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="name">The of the provider name.</param>
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool HasProviderId(this IHasProviderIds instance, string name)
=> instance.TryGetProviderId(name, out _);
/// <summary>
/// Checks if this instance has an id for the given provider.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool HasProviderId(this IHasProviderIds instance, MetadataProvider provider)
=> instance.HasProviderId(provider.ToString());
/// <summary>
/// Gets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="name">The name.</param>
/// <param name="id">The provider id.</param>
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool TryGetProviderId(this IHasProviderIds instance, string name, [NotNullWhen(true)] out string? id)
{
ArgumentNullException.ThrowIfNull(instance);
if (instance.ProviderIds is null)
{
id = null;
return false;
}
var foundProviderId = instance.ProviderIds.TryGetValue(name, out id);
// This occurs when searching with Identify (and possibly in other places)
if (string.IsNullOrEmpty(id))
{
id = null;
foundProviderId = false;
}
return foundProviderId;
}
/// <summary>
/// Gets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <param name="id">The provider id.</param>
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool TryGetProviderId(this IHasProviderIds instance, MetadataProvider provider, [NotNullWhen(true)] out string? id)
{
return instance.TryGetProviderId(provider.ToString(), out id);
}
/// <summary>
/// Gets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="name">The name.</param>
/// <returns>System.String.</returns>
public static string? GetProviderId(this IHasProviderIds instance, string name)
{
instance.TryGetProviderId(name, out string? id);
return id;
}
/// <summary>
/// Gets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <returns>System.String.</returns>
public static string? GetProviderId(this IHasProviderIds instance, MetadataProvider provider)
{
return instance.GetProviderId(provider.ToString());
}
/// <summary>
/// Sets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="name">The name, this should not contain a '=' character.</param>
/// <param name="value">The value.</param>
/// <remarks>Due to how deserialization from the database works the name cannot contain '='.</remarks>
/// <returns><c>true</c> if the provider id got set successfully; otherwise, <c>false</c>.</returns>
public static bool TrySetProviderId(this IHasProviderIds instance, string? name, string? value)
{
ArgumentNullException.ThrowIfNull(instance);
// When name contains a '=' it can't be deserialized from the database
if (string.IsNullOrWhiteSpace(name)
|| string.IsNullOrWhiteSpace(value)
|| name.Contains('=', StringComparison.Ordinal))
{
return false;
}
// Ensure it exists
instance.ProviderIds ??= new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
// Match on internal MetadataProvider enum string values before adding arbitrary providers
if (_metadataProviderEnumDictionary.TryGetValue(name, out var enumValue))
{
instance.ProviderIds[enumValue] = value;
}
else
{
instance.ProviderIds[name] = value;
}
return true;
}
/// <summary>
/// Sets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <param name="value">The value.</param>
/// <returns><c>true</c> if the provider id got set successfully; otherwise, <c>false</c>.</returns>
public static bool TrySetProviderId(this IHasProviderIds instance, MetadataProvider provider, string? value)
=> instance.TrySetProviderId(provider.ToString(), value);
/// <summary>
/// Sets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="name">The name, this should not contain a '=' character.</param>
/// <param name="value">The value.</param>
/// <remarks>Due to how deserialization from the database works the name cannot contain '='.</remarks>
public static void SetProviderId(this IHasProviderIds instance, string name, string value)
{
ArgumentNullException.ThrowIfNull(instance);
ArgumentException.ThrowIfNullOrWhiteSpace(name);
ArgumentException.ThrowIfNullOrWhiteSpace(value);
// When name contains a '=' it can't be deserialized from the database
if (name.Contains('=', StringComparison.Ordinal))
{
throw new ArgumentException("Provider id name cannot contain '='", nameof(name));
}
// Ensure it exists
instance.ProviderIds ??= new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
// Match on internal MetadataProvider enum string values before adding arbitrary providers
if (_metadataProviderEnumDictionary.TryGetValue(name, out var enumValue))
{
instance.ProviderIds[enumValue] = value;
}
else
{
instance.ProviderIds[name] = value;
}
}
/// <summary>
/// Sets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <param name="value">The value.</param>
public static void SetProviderId(this IHasProviderIds instance, MetadataProvider provider, string value)
=> instance.SetProviderId(provider.ToString(), value);
/// <summary>
/// Removes a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="name">The name.</param>
public static void RemoveProviderId(this IHasProviderIds instance, string name)
{
ArgumentNullException.ThrowIfNull(instance);
ArgumentException.ThrowIfNullOrEmpty(name);
instance.ProviderIds?.Remove(name);
}
/// <summary>
/// Removes a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
public static void RemoveProviderId(this IHasProviderIds instance, MetadataProvider provider)
{
ArgumentNullException.ThrowIfNull(instance);
instance.ProviderIds?.Remove(provider.ToString());
}
}
@@ -0,0 +1,23 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// The status of a series.
/// </summary>
public enum SeriesStatus
{
/// <summary>
/// The continuing status. This indicates that a series is currently releasing.
/// </summary>
Continuing,
/// <summary>
/// The ended status. This indicates that a series has completed and is no longer being released.
/// </summary>
Ended,
/// <summary>
/// The unreleased status. This indicates that a series has not been released yet.
/// </summary>
Unreleased
}
}
@@ -0,0 +1,49 @@
#pragma warning disable SA1300 // Lowercase required for backwards compat.
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Enum containing tonemapping algorithms.
/// </summary>
public enum TonemappingAlgorithm
{
/// <summary>
/// None.
/// </summary>
none = 0,
/// <summary>
/// Clip.
/// </summary>
clip = 1,
/// <summary>
/// Linear.
/// </summary>
linear = 2,
/// <summary>
/// Gamma.
/// </summary>
gamma = 3,
/// <summary>
/// Reinhard.
/// </summary>
reinhard = 4,
/// <summary>
/// Hable.
/// </summary>
hable = 5,
/// <summary>
/// Mobius.
/// </summary>
mobius = 6,
/// <summary>
/// BT2390.
/// </summary>
bt2390 = 7
}
@@ -0,0 +1,34 @@
#pragma warning disable SA1300 // Lowercase required for backwards compat.
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Enum containing tonemapping modes.
/// </summary>
public enum TonemappingMode
{
/// <summary>
/// Auto.
/// </summary>
auto = 0,
/// <summary>
/// Max.
/// </summary>
max = 1,
/// <summary>
/// RGB.
/// </summary>
rgb = 2,
/// <summary>
/// Lum.
/// </summary>
lum = 3,
/// <summary>
/// ITP.
/// </summary>
itp = 4
}
@@ -0,0 +1,24 @@
#pragma warning disable SA1300 // Lowercase required for backwards compat.
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Enum containing tonemapping ranges.
/// </summary>
public enum TonemappingRange
{
/// <summary>
/// Auto.
/// </summary>
auto = 0,
/// <summary>
/// TV.
/// </summary>
tv = 1,
/// <summary>
/// PC.
/// </summary>
pc = 2
}
@@ -0,0 +1,13 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Entities
{
public enum TrailerType
{
ComingSoonToTheaters = 1,
ComingSoonToDvd = 2,
ComingSoonToStreaming = 3,
Archive = 4,
LocalTrailer = 5
}
}
@@ -0,0 +1,43 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum UserDataSaveReason.
/// </summary>
public enum UserDataSaveReason
{
/// <summary>
/// The playback start.
/// </summary>
PlaybackStart = 1,
/// <summary>
/// The playback progress.
/// </summary>
PlaybackProgress = 2,
/// <summary>
/// The playback finished.
/// </summary>
PlaybackFinished = 3,
/// <summary>
/// The toggle played.
/// </summary>
TogglePlayed = 4,
/// <summary>
/// The update user rating.
/// </summary>
UpdateUserRating = 5,
/// <summary>
/// The import.
/// </summary>
Import = 6,
/// <summary>
/// API call updated item user data.
/// </summary>
UpdateUserData = 7,
}
}
@@ -0,0 +1,13 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Entities
{
public enum Video3DFormat
{
HalfSideBySide,
FullSideBySide,
FullTopAndBottom,
HalfTopAndBottom,
MVC
}
}
+28
View File
@@ -0,0 +1,28 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum VideoType.
/// </summary>
public enum VideoType
{
/// <summary>
/// The video file.
/// </summary>
VideoFile,
/// <summary>
/// The iso.
/// </summary>
Iso,
/// <summary>
/// The DVD.
/// </summary>
Dvd,
/// <summary>
/// The blu ray.
/// </summary>
BluRay
}
}
@@ -0,0 +1,58 @@
#nullable disable
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Used to hold information about a user's list of configured virtual folders.
/// </summary>
public class VirtualFolderInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="VirtualFolderInfo"/> class.
/// </summary>
public VirtualFolderInfo()
{
Locations = Array.Empty<string>();
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the locations.
/// </summary>
/// <value>The locations.</value>
public string[] Locations { get; set; }
/// <summary>
/// Gets or sets the type of the collection.
/// </summary>
/// <value>The type of the collection.</value>
public CollectionTypeOptions? CollectionType { get; set; }
public LibraryOptions LibraryOptions { get; set; }
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
public string ItemId { get; set; }
/// <summary>
/// Gets or sets the primary image item identifier.
/// </summary>
/// <value>The primary image item identifier.</value>
public string PrimaryImageItemId { get; set; }
public double? RefreshProgress { get; set; }
public string RefreshStatus { get; set; }
}
}