aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model/Entities')
-rw-r--r--MediaBrowser.Model/Entities/ChapterInfo.cs6
-rw-r--r--MediaBrowser.Model/Entities/CollectionType.cs34
-rw-r--r--MediaBrowser.Model/Entities/CollectionTypeOptions.cs16
-rw-r--r--MediaBrowser.Model/Entities/DisplayPreferencesDto.cs (renamed from MediaBrowser.Model/Entities/DisplayPreferences.cs)30
-rw-r--r--MediaBrowser.Model/Entities/EmptyRequestResult.cs6
-rw-r--r--MediaBrowser.Model/Entities/ExtraType.cs3
-rw-r--r--MediaBrowser.Model/Entities/IHasProviderIds.cs2
-rw-r--r--MediaBrowser.Model/Entities/ImageType.cs44
-rw-r--r--MediaBrowser.Model/Entities/IsoType.cs7
-rw-r--r--MediaBrowser.Model/Entities/LibraryUpdateInfo.cs31
-rw-r--r--MediaBrowser.Model/Entities/LocationType.cs13
-rw-r--r--MediaBrowser.Model/Entities/MediaAttachment.cs51
-rw-r--r--MediaBrowser.Model/Entities/MediaStream.cs477
-rw-r--r--MediaBrowser.Model/Entities/MediaStreamType.cs13
-rw-r--r--MediaBrowser.Model/Entities/MediaType.cs15
-rw-r--r--MediaBrowser.Model/Entities/MediaUrl.cs4
-rw-r--r--MediaBrowser.Model/Entities/MetadataFields.cs30
-rw-r--r--MediaBrowser.Model/Entities/MetadataProvider.cs (renamed from MediaBrowser.Model/Entities/MetadataProviders.cs)20
-rw-r--r--MediaBrowser.Model/Entities/PackageReviewInfo.cs38
-rw-r--r--MediaBrowser.Model/Entities/ParentalRating.cs26
-rw-r--r--MediaBrowser.Model/Entities/PersonType.cs47
-rw-r--r--MediaBrowser.Model/Entities/ProviderIdsExtensions.cs99
-rw-r--r--MediaBrowser.Model/Entities/ScrollDirection.cs17
-rw-r--r--MediaBrowser.Model/Entities/SeriesStatus.cs7
-rw-r--r--MediaBrowser.Model/Entities/SortOrder.cs17
-rw-r--r--MediaBrowser.Model/Entities/SpecialFolder.cs36
-rw-r--r--MediaBrowser.Model/Entities/TrailerType.cs2
-rw-r--r--MediaBrowser.Model/Entities/UserDataSaveReason.cs19
-rw-r--r--MediaBrowser.Model/Entities/Video3DFormat.cs2
-rw-r--r--MediaBrowser.Model/Entities/VideoType.cs13
-rw-r--r--MediaBrowser.Model/Entities/VirtualFolderInfo.cs27
31 files changed, 688 insertions, 464 deletions
diff --git a/MediaBrowser.Model/Entities/ChapterInfo.cs b/MediaBrowser.Model/Entities/ChapterInfo.cs
index dfd6fdf4a..45554c3dc 100644
--- a/MediaBrowser.Model/Entities/ChapterInfo.cs
+++ b/MediaBrowser.Model/Entities/ChapterInfo.cs
@@ -1,9 +1,12 @@
+#nullable disable
+#pragma warning disable CS1591
+
using System;
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Class ChapterInfo
+ /// Class ChapterInfo.
/// </summary>
public class ChapterInfo
{
@@ -24,6 +27,7 @@ namespace MediaBrowser.Model.Entities
/// </summary>
/// <value>The image path.</value>
public string ImagePath { get; set; }
+
public DateTime ImageDateModified { get; set; }
public string ImageTag { get; set; }
diff --git a/MediaBrowser.Model/Entities/CollectionType.cs b/MediaBrowser.Model/Entities/CollectionType.cs
index e26d1b8c3..60b69d4b0 100644
--- a/MediaBrowser.Model/Entities/CollectionType.cs
+++ b/MediaBrowser.Model/Entities/CollectionType.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
namespace MediaBrowser.Model.Entities
{
public static class CollectionType
@@ -22,36 +24,4 @@ namespace MediaBrowser.Model.Entities
public const string Playlists = "playlists";
public const string Folders = "folders";
}
-
- public static class SpecialFolder
- {
- public const string TvShowSeries = "TvShowSeries";
- public const string TvGenres = "TvGenres";
- public const string TvGenre = "TvGenre";
- public const string TvLatest = "TvLatest";
- public const string TvNextUp = "TvNextUp";
- public const string TvResume = "TvResume";
- public const string TvFavoriteSeries = "TvFavoriteSeries";
- public const string TvFavoriteEpisodes = "TvFavoriteEpisodes";
-
- public const string MovieLatest = "MovieLatest";
- public const string MovieResume = "MovieResume";
- public const string MovieMovies = "MovieMovies";
- public const string MovieCollections = "MovieCollections";
- public const string MovieFavorites = "MovieFavorites";
- public const string MovieGenres = "MovieGenres";
- public const string MovieGenre = "MovieGenre";
-
- public const string MusicArtists = "MusicArtists";
- public const string MusicAlbumArtists = "MusicAlbumArtists";
- public const string MusicAlbums = "MusicAlbums";
- public const string MusicGenres = "MusicGenres";
- public const string MusicLatest = "MusicLatest";
- public const string MusicPlaylists = "MusicPlaylists";
- public const string MusicSongs = "MusicSongs";
- public const string MusicFavorites = "MusicFavorites";
- public const string MusicFavoriteArtists = "MusicFavoriteArtists";
- public const string MusicFavoriteAlbums = "MusicFavoriteAlbums";
- public const string MusicFavoriteSongs = "MusicFavoriteSongs";
- }
}
diff --git a/MediaBrowser.Model/Entities/CollectionTypeOptions.cs b/MediaBrowser.Model/Entities/CollectionTypeOptions.cs
new file mode 100644
index 000000000..e1894d84a
--- /dev/null
+++ b/MediaBrowser.Model/Entities/CollectionTypeOptions.cs
@@ -0,0 +1,16 @@
+#pragma warning disable CS1591
+
+namespace MediaBrowser.Model.Entities
+{
+ public enum CollectionTypeOptions
+ {
+ Movies = 0,
+ TvShows = 1,
+ Music = 2,
+ MusicVideos = 3,
+ HomeVideos = 4,
+ BoxSets = 5,
+ Books = 6,
+ Mixed = 7
+ }
+}
diff --git a/MediaBrowser.Model/Entities/DisplayPreferences.cs b/MediaBrowser.Model/Entities/DisplayPreferencesDto.cs
index f9b3ac7b3..1f7fe3030 100644
--- a/MediaBrowser.Model/Entities/DisplayPreferences.cs
+++ b/MediaBrowser.Model/Entities/DisplayPreferencesDto.cs
@@ -1,21 +1,18 @@
+#nullable disable
using System.Collections.Generic;
+using Jellyfin.Data.Enums;
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Defines the display preferences for any item that supports them (usually Folders)
+ /// Defines the display preferences for any item that supports them (usually Folders).
/// </summary>
- public class DisplayPreferences
+ public class DisplayPreferencesDto
{
/// <summary>
- /// The image scale
+ /// Initializes a new instance of the <see cref="DisplayPreferencesDto" /> class.
/// </summary>
- private const double ImageScale = .9;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="DisplayPreferences" /> class.
- /// </summary>
- public DisplayPreferences()
+ public DisplayPreferencesDto()
{
RememberIndexing = false;
PrimaryImageHeight = 250;
@@ -29,68 +26,81 @@ namespace MediaBrowser.Model.Entities
/// </summary>
/// <value>The user id.</value>
public string Id { get; set; }
+
/// <summary>
/// Gets or sets the type of the view.
/// </summary>
/// <value>The type of the view.</value>
public string ViewType { get; set; }
+
/// <summary>
/// Gets or sets the sort by.
/// </summary>
/// <value>The sort by.</value>
public string SortBy { get; set; }
+
/// <summary>
/// Gets or sets the index by.
/// </summary>
/// <value>The index by.</value>
public string IndexBy { get; set; }
+
/// <summary>
/// Gets or sets a value indicating whether [remember indexing].
/// </summary>
/// <value><c>true</c> if [remember indexing]; otherwise, <c>false</c>.</value>
public bool RememberIndexing { get; set; }
+
/// <summary>
/// Gets or sets the height of the primary image.
/// </summary>
/// <value>The height of the primary image.</value>
public int PrimaryImageHeight { get; set; }
+
/// <summary>
/// Gets or sets the width of the primary image.
/// </summary>
/// <value>The width of the primary image.</value>
public int PrimaryImageWidth { get; set; }
+
/// <summary>
/// Gets or sets the custom prefs.
/// </summary>
/// <value>The custom prefs.</value>
public Dictionary<string, string> CustomPrefs { get; set; }
+
/// <summary>
/// Gets or sets the scroll direction.
/// </summary>
/// <value>The scroll direction.</value>
public ScrollDirection ScrollDirection { get; set; }
+
/// <summary>
/// Gets or sets a value indicating whether to show backdrops on this item.
/// </summary>
/// <value><c>true</c> if showing backdrops; otherwise, <c>false</c>.</value>
public bool ShowBackdrop { get; set; }
+
/// <summary>
/// Gets or sets a value indicating whether [remember sorting].
/// </summary>
/// <value><c>true</c> if [remember sorting]; otherwise, <c>false</c>.</value>
public bool RememberSorting { get; set; }
+
/// <summary>
/// Gets or sets the sort order.
/// </summary>
/// <value>The sort order.</value>
public SortOrder SortOrder { get; set; }
+
/// <summary>
/// Gets or sets a value indicating whether [show sidebar].
/// </summary>
/// <value><c>true</c> if [show sidebar]; otherwise, <c>false</c>.</value>
public bool ShowSidebar { get; set; }
+
/// <summary>
- /// Gets or sets the client
+ /// Gets or sets the client.
/// </summary>
public string Client { get; set; }
}
diff --git a/MediaBrowser.Model/Entities/EmptyRequestResult.cs b/MediaBrowser.Model/Entities/EmptyRequestResult.cs
deleted file mode 100644
index 5d29218e3..000000000
--- a/MediaBrowser.Model/Entities/EmptyRequestResult.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace MediaBrowser.Model.Entities
-{
- public class EmptyRequestResult
- {
- }
-}
diff --git a/MediaBrowser.Model/Entities/ExtraType.cs b/MediaBrowser.Model/Entities/ExtraType.cs
index 97350b955..aca4bd282 100644
--- a/MediaBrowser.Model/Entities/ExtraType.cs
+++ b/MediaBrowser.Model/Entities/ExtraType.cs
@@ -1,7 +1,10 @@
+#pragma warning disable CS1591
+
namespace MediaBrowser.Model.Entities
{
public enum ExtraType
{
+ Unknown = 0,
Clip = 1,
Trailer = 2,
BehindTheScenes = 3,
diff --git a/MediaBrowser.Model/Entities/IHasProviderIds.cs b/MediaBrowser.Model/Entities/IHasProviderIds.cs
index 3b8d74cb4..1310f68ae 100644
--- a/MediaBrowser.Model/Entities/IHasProviderIds.cs
+++ b/MediaBrowser.Model/Entities/IHasProviderIds.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repition by using extension methods
+ /// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repetition by using extension methods.
/// </summary>
public interface IHasProviderIds
{
diff --git a/MediaBrowser.Model/Entities/ImageType.cs b/MediaBrowser.Model/Entities/ImageType.cs
index ce3560e78..6ea9ee419 100644
--- a/MediaBrowser.Model/Entities/ImageType.cs
+++ b/MediaBrowser.Model/Entities/ImageType.cs
@@ -1,57 +1,73 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Enum ImageType
+ /// Enum ImageType.
/// </summary>
public enum ImageType
{
/// <summary>
- /// The primary
+ /// The primary.
/// </summary>
Primary = 0,
+
/// <summary>
- /// The art
+ /// The art.
/// </summary>
Art = 1,
+
/// <summary>
- /// The backdrop
+ /// The backdrop.
/// </summary>
Backdrop = 2,
+
/// <summary>
- /// The banner
+ /// The banner.
/// </summary>
Banner = 3,
+
/// <summary>
- /// The logo
+ /// The logo.
/// </summary>
Logo = 4,
+
/// <summary>
- /// The thumb
+ /// The thumb.
/// </summary>
Thumb = 5,
+
/// <summary>
- /// The disc
+ /// The disc.
/// </summary>
Disc = 6,
+
/// <summary>
- /// The box
+ /// The box.
/// </summary>
Box = 7,
+
/// <summary>
- /// The screenshot
+ /// The screenshot.
/// </summary>
Screenshot = 8,
+
/// <summary>
- /// The menu
+ /// The menu.
/// </summary>
Menu = 9,
+
/// <summary>
- /// The chapter image
+ /// The chapter image.
/// </summary>
Chapter = 10,
+
/// <summary>
- /// The box rear
+ /// The box rear.
/// </summary>
- BoxRear = 11
+ BoxRear = 11,
+
+ /// <summary>
+ /// The user profile image.
+ /// </summary>
+ Profile = 12
}
}
diff --git a/MediaBrowser.Model/Entities/IsoType.cs b/MediaBrowser.Model/Entities/IsoType.cs
index 8e4f0d63a..1aa29f31d 100644
--- a/MediaBrowser.Model/Entities/IsoType.cs
+++ b/MediaBrowser.Model/Entities/IsoType.cs
@@ -1,16 +1,17 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Enum IsoType
+ /// Enum IsoType.
/// </summary>
public enum IsoType
{
/// <summary>
- /// The DVD
+ /// The DVD.
/// </summary>
Dvd,
+
/// <summary>
- /// The blu ray
+ /// The blu ray.
/// </summary>
BluRay
}
diff --git a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs
index b83df87e2..6dd6653dc 100644
--- a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs
+++ b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs
@@ -1,17 +1,33 @@
+#pragma warning disable CS1591
+
using System;
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Class LibraryUpdateInfo
+ /// 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>
@@ -39,18 +55,5 @@ namespace MediaBrowser.Model.Entities
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;
-
- /// <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>();
- }
}
}
diff --git a/MediaBrowser.Model/Entities/LocationType.cs b/MediaBrowser.Model/Entities/LocationType.cs
index 52c08b28b..879b31c5c 100644
--- a/MediaBrowser.Model/Entities/LocationType.cs
+++ b/MediaBrowser.Model/Entities/LocationType.cs
@@ -1,24 +1,27 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Enum LocationType
+ /// Enum LocationType.
/// </summary>
public enum LocationType
{
/// <summary>
- /// The file system
+ /// The file system.
/// </summary>
FileSystem = 0,
+
/// <summary>
- /// The remote
+ /// The remote.
/// </summary>
Remote = 1,
+
/// <summary>
- /// The virtual
+ /// The virtual.
/// </summary>
Virtual = 2,
+
/// <summary>
- /// The offline
+ /// The offline.
/// </summary>
Offline = 3
}
diff --git a/MediaBrowser.Model/Entities/MediaAttachment.cs b/MediaBrowser.Model/Entities/MediaAttachment.cs
new file mode 100644
index 000000000..34e3eabc9
--- /dev/null
+++ b/MediaBrowser.Model/Entities/MediaAttachment.cs
@@ -0,0 +1,51 @@
+#nullable disable
+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; }
+ }
+}
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index fc346df37..38ac44794 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -1,6 +1,11 @@
+#nullable disable
+#pragma warning disable CS1591
+
using System;
using System.Collections.Generic;
using System.Globalization;
+using System.Linq;
+using System.Text;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
@@ -8,7 +13,7 @@ using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Class MediaStream
+ /// Class MediaStream.
/// </summary>
public class MediaStream
{
@@ -30,9 +35,29 @@ namespace MediaBrowser.Model.Entities
/// <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; }
- public string ColorSpace { get; set; }
/// <summary>
/// Gets or sets the comment.
@@ -40,11 +65,28 @@ namespace MediaBrowser.Model.Entities
/// <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; }
+ /// <summary>
+ /// Gets the video range.
+ /// </summary>
+ /// <value>The video range.</value>
public string VideoRange
{
get
@@ -56,190 +98,190 @@ namespace MediaBrowser.Model.Entities
var colorTransfer = ColorTransfer;
- if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase))
{
return "HDR";
}
- return "SDR";
- }
- }
-
- public string DisplayTitle
- {
- get
- {
- if (Type == MediaStreamType.Audio)
- {
- //if (!string.IsNullOrEmpty(Title))
- //{
- // return AddLanguageIfNeeded(Title);
- //}
-
- var attributes = new List<string>();
-
- if (!string.IsNullOrEmpty(Language))
- {
- attributes.Add(StringHelper.FirstToUpper(Language));
- }
- if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca"))
- {
- attributes.Add(AudioCodec.GetFriendlyName(Codec));
- }
- else if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc"))
- {
- attributes.Add(Profile);
- }
-
- if (!string.IsNullOrEmpty(ChannelLayout))
- {
- attributes.Add(ChannelLayout);
- }
- else if (Channels.HasValue)
- {
- attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");
- }
- if (IsDefault)
- {
- attributes.Add("Default");
- }
+ // For some Dolby Vision files, no color transfer is provided, so check the codec
- return string.Join(" ", attributes);
- }
+ var codecTag = CodecTag;
- if (Type == MediaStreamType.Video)
+ if (string.Equals(codecTag, "dva1", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(codecTag, "dvav", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(codecTag, "dvh1", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(codecTag, "dvhe", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(codecTag, "dav1", StringComparison.OrdinalIgnoreCase))
{
- var attributes = new List<string>();
-
- var resolutionText = GetResolutionText();
-
- if (!string.IsNullOrEmpty(resolutionText))
- {
- attributes.Add(resolutionText);
- }
-
- if (!string.IsNullOrEmpty(Codec))
- {
- attributes.Add(Codec.ToUpperInvariant());
- }
-
- return string.Join(" ", attributes);
+ return "HDR";
}
- if (Type == MediaStreamType.Subtitle)
- {
- //if (!string.IsNullOrEmpty(Title))
- //{
- // return AddLanguageIfNeeded(Title);
- //}
-
- var attributes = new List<string>();
-
- if (!string.IsNullOrEmpty(Language))
- {
- attributes.Add(StringHelper.FirstToUpper(Language));
- }
- else
- {
- attributes.Add("Und");
- }
-
- if (IsDefault)
- {
- attributes.Add("Default");
- }
-
- if (IsForced)
- {
- attributes.Add("Forced");
- }
-
- string name = string.Join(" ", attributes.ToArray());
-
- return name;
- }
+ return "SDR";
+ }
+ }
- if (Type == MediaStreamType.Video)
- {
+ public string LocalizedUndefined { get; set; }
- }
+ public string LocalizedDefault { get; set; }
- return null;
- }
- }
+ public string LocalizedForced { get; set; }
- private string GetResolutionText()
+ public string DisplayTitle
{
- var i = this;
-
- if (i.Width.HasValue && i.Height.HasValue)
+ get
{
- var width = i.Width.Value;
- var height = i.Height.Value;
-
- if (width >= 3800 || height >= 2000)
- {
- return "4K";
- }
- if (width >= 2500)
+ switch (Type)
{
- if (i.IsInterlaced)
+ case MediaStreamType.Audio:
{
- return "1440I";
+ var attributes = new List<string>();
+
+ if (!string.IsNullOrEmpty(Language))
+ {
+ // Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
+ string fullLanguage = CultureInfo
+ .GetCultures(CultureTypes.NeutralCultures)
+ .FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
+ ?.DisplayName;
+ attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
+ }
+
+ if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
+ {
+ attributes.Add(AudioCodec.GetFriendlyName(Codec));
+ }
+ else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
+ {
+ attributes.Add(Profile);
+ }
+
+ 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 (!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);
}
- return "1440P";
- }
- if (width >= 1900 || height >= 1000)
- {
- if (i.IsInterlaced)
- {
- return "1080I";
- }
- return "1080P";
- }
- if (width >= 1260 || height >= 700)
- {
- if (i.IsInterlaced)
+
+ case MediaStreamType.Video:
{
- return "720I";
+ var attributes = new List<string>();
+
+ var resolutionText = GetResolutionText();
+
+ if (!string.IsNullOrEmpty(resolutionText))
+ {
+ attributes.Add(resolutionText);
+ }
+
+ if (!string.IsNullOrEmpty(Codec))
+ {
+ attributes.Add(Codec.ToUpperInvariant());
+ }
+
+ if (!string.IsNullOrEmpty(VideoRange))
+ {
+ attributes.Add(VideoRange.ToUpperInvariant());
+ }
+
+ 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);
}
- return "720P";
- }
- if (width >= 700 || height >= 440)
- {
- if (i.IsInterlaced)
+ case MediaStreamType.Subtitle:
{
- return "480I";
+ var attributes = new List<string>();
+
+ if (!string.IsNullOrEmpty(Language))
+ {
+ // Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
+ string fullLanguage = CultureInfo
+ .GetCultures(CultureTypes.NeutralCultures)
+ .FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
+ ?.DisplayName;
+ attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
+ }
+ else
+ {
+ attributes.Add(string.IsNullOrEmpty(LocalizedUndefined) ? "Und" : LocalizedUndefined);
+ }
+
+ 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 (!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);
}
- return "480P";
- }
-
- return "SD";
- }
- return null;
- }
-
- private string AddLanguageIfNeeded(string title)
- {
- if (!string.IsNullOrEmpty(Language) &&
- !string.Equals(Language, "und", StringComparison.OrdinalIgnoreCase) &&
- !IsLanguageInTitle(title, Language))
- {
- title = StringHelper.FirstToUpper(Language) + " " + title;
- }
- return title;
- }
-
- private bool IsLanguageInTitle(string title, string language)
- {
- if (title.IndexOf(Language, StringComparison.OrdinalIgnoreCase) != -1)
- {
- return true;
+ default:
+ return null;
+ }
}
-
- return false;
}
public string NalLengthSize { get; set; }
@@ -371,11 +413,13 @@ namespace MediaBrowser.Model.Entities
/// </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>
@@ -386,7 +430,10 @@ namespace MediaBrowser.Model.Entities
{
get
{
- if (Type != MediaStreamType.Subtitle) return false;
+ if (Type != MediaStreamType.Subtitle)
+ {
+ return false;
+ }
if (string.IsNullOrEmpty(Codec) && !IsExternal)
{
@@ -397,17 +444,73 @@ namespace MediaBrowser.Model.Entities
}
}
+ /// <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
+ {
+ <= 720 when Height <= 480 => IsInterlaced ? "480i" : "480p",
+ // 720x576 (PAL) (768 when rescaled for square pixels)
+ <= 768 when Height <= 576 => IsInterlaced ? "576i" : "576p",
+ // 960x540 (sometimes 544 which is multiple of 16)
+ <= 960 when Height <= 544 => IsInterlaced ? "540i" : "540p",
+ // 1280x720
+ <= 1280 when Height <= 962 => IsInterlaced ? "720i" : "720p",
+ // 1920x1080
+ <= 1920 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;
// sub = external .sub file
- return codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) == -1 &&
- codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) == -1 &&
- codec.IndexOf("dvbsub", StringComparison.OrdinalIgnoreCase) == -1 &&
- !StringHelper.EqualsIgnoreCase(codec, "sub") &&
- !StringHelper.EqualsIgnoreCase(codec, "dvb_subtitle");
+ return !codec.Contains("pgs", StringComparison.OrdinalIgnoreCase) &&
+ !codec.Contains("dvd", StringComparison.OrdinalIgnoreCase) &&
+ !codec.Contains("dvbsub", StringComparison.OrdinalIgnoreCase) &&
+ !string.Equals(codec, "sub", StringComparison.OrdinalIgnoreCase) &&
+ !string.Equals(codec, "dvb_subtitle", StringComparison.OrdinalIgnoreCase);
}
public bool SupportsSubtitleConversionTo(string toCodec)
@@ -420,56 +523,28 @@ namespace MediaBrowser.Model.Entities
var fromCodec = Codec;
// Can't convert from this
- if (StringHelper.EqualsIgnoreCase(fromCodec, "ass"))
+ if (string.Equals(fromCodec, "ass", StringComparison.OrdinalIgnoreCase))
{
return false;
}
- if (StringHelper.EqualsIgnoreCase(fromCodec, "ssa"))
+
+ if (string.Equals(fromCodec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;
}
// Can't convert to this
- if (StringHelper.EqualsIgnoreCase(toCodec, "ass"))
+ if (string.Equals(toCodec, "ass", StringComparison.OrdinalIgnoreCase))
{
return false;
}
- if (StringHelper.EqualsIgnoreCase(toCodec, "ssa"))
+
+ if (string.Equals(toCodec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;
}
return true;
}
-
- /// <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 a value indicating 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; }
}
}
diff --git a/MediaBrowser.Model/Entities/MediaStreamType.cs b/MediaBrowser.Model/Entities/MediaStreamType.cs
index 4fc1e5372..e09aaf6d0 100644
--- a/MediaBrowser.Model/Entities/MediaStreamType.cs
+++ b/MediaBrowser.Model/Entities/MediaStreamType.cs
@@ -1,24 +1,27 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Enum MediaStreamType
+ /// Enum MediaStreamType.
/// </summary>
public enum MediaStreamType
{
/// <summary>
- /// The audio
+ /// The audio.
/// </summary>
Audio,
+
/// <summary>
- /// The video
+ /// The video.
/// </summary>
Video,
+
/// <summary>
- /// The subtitle
+ /// The subtitle.
/// </summary>
Subtitle,
+
/// <summary>
- /// The embedded image
+ /// The embedded image.
/// </summary>
EmbeddedImage
}
diff --git a/MediaBrowser.Model/Entities/MediaType.cs b/MediaBrowser.Model/Entities/MediaType.cs
index c56c8f8f2..dd2ae810b 100644
--- a/MediaBrowser.Model/Entities/MediaType.cs
+++ b/MediaBrowser.Model/Entities/MediaType.cs
@@ -1,24 +1,27 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Class MediaType
+ /// Class MediaType.
/// </summary>
- public class MediaType
+ public static class MediaType
{
/// <summary>
- /// The video
+ /// The video.
/// </summary>
public const string Video = "Video";
+
/// <summary>
- /// The audio
+ /// The audio.
/// </summary>
public const string Audio = "Audio";
+
/// <summary>
- /// The photo
+ /// The photo.
/// </summary>
public const string Photo = "Photo";
+
/// <summary>
- /// The book
+ /// The book.
/// </summary>
public const string Book = "Book";
}
diff --git a/MediaBrowser.Model/Entities/MediaUrl.cs b/MediaBrowser.Model/Entities/MediaUrl.cs
index 428c895b6..80ceaa765 100644
--- a/MediaBrowser.Model/Entities/MediaUrl.cs
+++ b/MediaBrowser.Model/Entities/MediaUrl.cs
@@ -1,8 +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; }
}
}
diff --git a/MediaBrowser.Model/Entities/MetadataFields.cs b/MediaBrowser.Model/Entities/MetadataFields.cs
index a7947a933..2cc6c8e33 100644
--- a/MediaBrowser.Model/Entities/MetadataFields.cs
+++ b/MediaBrowser.Model/Entities/MetadataFields.cs
@@ -1,44 +1,52 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Enum MetadataFields
+ /// Enum MetadataFields.
/// </summary>
- public enum MetadataFields
+ public enum MetadataField
{
/// <summary>
- /// The cast
+ /// The cast.
/// </summary>
Cast,
+
/// <summary>
- /// The genres
+ /// The genres.
/// </summary>
Genres,
+
/// <summary>
- /// The production locations
+ /// The production locations.
/// </summary>
ProductionLocations,
+
/// <summary>
- /// The studios
+ /// The studios.
/// </summary>
Studios,
+
/// <summary>
- /// The tags
+ /// The tags.
/// </summary>
Tags,
+
/// <summary>
- /// The name
+ /// The name.
/// </summary>
Name,
+
/// <summary>
- /// The overview
+ /// The overview.
/// </summary>
Overview,
+
/// <summary>
- /// The runtime
+ /// The runtime.
/// </summary>
Runtime,
+
/// <summary>
- /// The official rating
+ /// The official rating.
/// </summary>
OfficialRating
}
diff --git a/MediaBrowser.Model/Entities/MetadataProviders.cs b/MediaBrowser.Model/Entities/MetadataProvider.cs
index e9802cf46..e9c098021 100644
--- a/MediaBrowser.Model/Entities/MetadataProviders.cs
+++ b/MediaBrowser.Model/Entities/MetadataProvider.cs
@@ -1,28 +1,34 @@
+#pragma warning disable CS1591
+
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Enum MetadataProviders
+ /// Enum MetadataProviders.
/// </summary>
- public enum MetadataProviders
+ public enum MetadataProvider
{
/// <summary>
- /// The imdb
+ /// The imdb.
/// </summary>
Imdb = 2,
+
/// <summary>
- /// The TMDB
+ /// The TMDB.
/// </summary>
Tmdb = 3,
+
/// <summary>
- /// The TVDB
+ /// The TVDB.
/// </summary>
Tvdb = 4,
+
/// <summary>
- /// The tvcom
+ /// The tvcom.
/// </summary>
Tvcom = 5,
+
/// <summary>
- /// Tmdb Collection Id
+ /// Tmdb Collection Id.
/// </summary>
TmdbCollection = 7,
MusicBrainzAlbum = 8,
diff --git a/MediaBrowser.Model/Entities/PackageReviewInfo.cs b/MediaBrowser.Model/Entities/PackageReviewInfo.cs
deleted file mode 100644
index b73ba8dd0..000000000
--- a/MediaBrowser.Model/Entities/PackageReviewInfo.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.Entities
-{
- public class PackageReviewInfo
- {
- /// <summary>
- /// The package id (database key) for this review
- /// </summary>
- public int id { get; set; }
-
- /// <summary>
- /// The rating value
- /// </summary>
- public int rating { get; set; }
-
- /// <summary>
- /// Whether or not this review recommends this item
- /// </summary>
- public bool recommend { get; set; }
-
- /// <summary>
- /// A short description of the review
- /// </summary>
- public string title { get; set; }
-
- /// <summary>
- /// A full review
- /// </summary>
- public string review { get; set; }
-
- /// <summary>
- /// Time of review
- /// </summary>
- public DateTime timestamp { get; set; }
-
- }
-}
diff --git a/MediaBrowser.Model/Entities/ParentalRating.cs b/MediaBrowser.Model/Entities/ParentalRating.cs
index a22e119fa..17b2868a3 100644
--- a/MediaBrowser.Model/Entities/ParentalRating.cs
+++ b/MediaBrowser.Model/Entities/ParentalRating.cs
@@ -1,10 +1,23 @@
+#nullable disable
+#pragma warning disable CS1591
+
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Class ParentalRating
+ /// Class ParentalRating.
/// </summary>
public class ParentalRating
{
+ public ParentalRating()
+ {
+ }
+
+ public ParentalRating(string name, int value)
+ {
+ Name = name;
+ Value = value;
+ }
+
/// <summary>
/// Gets or sets the name.
/// </summary>
@@ -16,16 +29,5 @@ namespace MediaBrowser.Model.Entities
/// </summary>
/// <value>The value.</value>
public int Value { get; set; }
-
- public ParentalRating()
- {
-
- }
-
- public ParentalRating(string name, int value)
- {
- Name = name;
- Value = value;
- }
}
}
diff --git a/MediaBrowser.Model/Entities/PersonType.cs b/MediaBrowser.Model/Entities/PersonType.cs
index 72e3538fc..b985507f0 100644
--- a/MediaBrowser.Model/Entities/PersonType.cs
+++ b/MediaBrowser.Model/Entities/PersonType.cs
@@ -1,41 +1,68 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Struct PersonType
+ /// Types of persons.
/// </summary>
- public class PersonType
+ public static class PersonType
{
/// <summary>
- /// The actor
+ /// A person whose profession is acting on the stage, in films, or on television.
/// </summary>
public const string Actor = "Actor";
+
/// <summary>
- /// The director
+ /// A person who supervises the actors and other staff in a film, play, or similar production.
/// </summary>
public const string Director = "Director";
+
/// <summary>
- /// The composer
+ /// A person who writes music, especially as a professional occupation.
/// </summary>
public const string Composer = "Composer";
+
/// <summary>
- /// The writer
+ /// 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>
- /// The guest star
+ /// 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>
- /// The producer
+ /// 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>
- /// The conductor
+ /// A person who directs the performance of an orchestra or choir.
/// </summary>
public const string Conductor = "Conductor";
+
/// <summary>
- /// The lyricist
+ /// 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";
}
}
diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
index a151bb3bb..ce4b0ec92 100644
--- a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
+++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
@@ -1,42 +1,49 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Class ProviderIdsExtensions
+ /// Class ProviderIdsExtensions.
/// </summary>
public static class ProviderIdsExtensions
{
/// <summary>
- /// Determines whether [has provider identifier] [the specified instance].
+ /// 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 [has provider identifier] [the specified instance]; otherwise, <c>false</c>.</returns>
- public static bool HasProviderId(this IHasProviderIds instance, MetadataProviders provider)
+ /// <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)
{
- return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString()));
+ if (instance == null)
+ {
+ throw new ArgumentNullException(nameof(instance));
+ }
+
+ return instance.TryGetProviderId(name, out _);
}
/// <summary>
- /// Gets a provider id
+ /// 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>System.String.</returns>
- public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider)
+ /// <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)
{
- return instance.GetProviderId(provider.ToString());
+ return instance.HasProviderId(provider.ToString());
}
/// <summary>
- /// Gets a provider id
+ /// 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)
+ /// <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)
{
if (instance == null)
{
@@ -45,15 +52,58 @@ namespace MediaBrowser.Model.Entities
if (instance.ProviderIds == null)
{
- return null;
+ id = null;
+ return false;
}
- instance.ProviderIds.TryGetValue(name, out string id);
+ 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>
- /// Sets a provider id
+ /// 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.</param>
@@ -68,33 +118,24 @@ namespace MediaBrowser.Model.Entities
// If it's null remove the key from the dictionary
if (string.IsNullOrEmpty(value))
{
- if (instance.ProviderIds != null)
- {
- if (instance.ProviderIds.ContainsKey(name))
- {
- instance.ProviderIds.Remove(name);
- }
- }
+ instance.ProviderIds?.Remove(name);
}
else
{
// Ensure it exists
- if (instance.ProviderIds == null)
- {
- instance.ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- }
+ instance.ProviderIds ??= new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
instance.ProviderIds[name] = value;
}
}
/// <summary>
- /// Sets a provider id
+ /// 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, MetadataProviders provider, string value)
+ public static void SetProviderId(this IHasProviderIds instance, MetadataProvider provider, string value)
{
instance.SetProviderId(provider.ToString(), value);
}
diff --git a/MediaBrowser.Model/Entities/ScrollDirection.cs b/MediaBrowser.Model/Entities/ScrollDirection.cs
deleted file mode 100644
index bc66364f7..000000000
--- a/MediaBrowser.Model/Entities/ScrollDirection.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace MediaBrowser.Model.Entities
-{
- /// <summary>
- /// Enum ScrollDirection
- /// </summary>
- public enum ScrollDirection
- {
- /// <summary>
- /// The horizontal
- /// </summary>
- Horizontal,
- /// <summary>
- /// The vertical
- /// </summary>
- Vertical
- }
-}
diff --git a/MediaBrowser.Model/Entities/SeriesStatus.cs b/MediaBrowser.Model/Entities/SeriesStatus.cs
index cab6a83e8..c77c4a8ad 100644
--- a/MediaBrowser.Model/Entities/SeriesStatus.cs
+++ b/MediaBrowser.Model/Entities/SeriesStatus.cs
@@ -1,16 +1,17 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Enum SeriesStatus
+ /// Enum SeriesStatus.
/// </summary>
public enum SeriesStatus
{
/// <summary>
- /// The continuing
+ /// The continuing.
/// </summary>
Continuing,
+
/// <summary>
- /// The ended
+ /// The ended.
/// </summary>
Ended
}
diff --git a/MediaBrowser.Model/Entities/SortOrder.cs b/MediaBrowser.Model/Entities/SortOrder.cs
deleted file mode 100644
index 558ebeac2..000000000
--- a/MediaBrowser.Model/Entities/SortOrder.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace MediaBrowser.Model.Entities
-{
- /// <summary>
- /// Enum SortOrder
- /// </summary>
- public enum SortOrder
- {
- /// <summary>
- /// The ascending
- /// </summary>
- Ascending,
- /// <summary>
- /// The descending
- /// </summary>
- Descending
- }
-}
diff --git a/MediaBrowser.Model/Entities/SpecialFolder.cs b/MediaBrowser.Model/Entities/SpecialFolder.cs
new file mode 100644
index 000000000..2250c5dff
--- /dev/null
+++ b/MediaBrowser.Model/Entities/SpecialFolder.cs
@@ -0,0 +1,36 @@
+#pragma warning disable CS1591
+
+namespace MediaBrowser.Model.Entities
+{
+ public static class SpecialFolder
+ {
+ public const string TvShowSeries = "TvShowSeries";
+ public const string TvGenres = "TvGenres";
+ public const string TvGenre = "TvGenre";
+ public const string TvLatest = "TvLatest";
+ public const string TvNextUp = "TvNextUp";
+ public const string TvResume = "TvResume";
+ public const string TvFavoriteSeries = "TvFavoriteSeries";
+ public const string TvFavoriteEpisodes = "TvFavoriteEpisodes";
+
+ public const string MovieLatest = "MovieLatest";
+ public const string MovieResume = "MovieResume";
+ public const string MovieMovies = "MovieMovies";
+ public const string MovieCollections = "MovieCollections";
+ public const string MovieFavorites = "MovieFavorites";
+ public const string MovieGenres = "MovieGenres";
+ public const string MovieGenre = "MovieGenre";
+
+ public const string MusicArtists = "MusicArtists";
+ public const string MusicAlbumArtists = "MusicAlbumArtists";
+ public const string MusicAlbums = "MusicAlbums";
+ public const string MusicGenres = "MusicGenres";
+ public const string MusicLatest = "MusicLatest";
+ public const string MusicPlaylists = "MusicPlaylists";
+ public const string MusicSongs = "MusicSongs";
+ public const string MusicFavorites = "MusicFavorites";
+ public const string MusicFavoriteArtists = "MusicFavoriteArtists";
+ public const string MusicFavoriteAlbums = "MusicFavoriteAlbums";
+ public const string MusicFavoriteSongs = "MusicFavoriteSongs";
+ }
+}
diff --git a/MediaBrowser.Model/Entities/TrailerType.cs b/MediaBrowser.Model/Entities/TrailerType.cs
index 73be5d7ca..68d992b0d 100644
--- a/MediaBrowser.Model/Entities/TrailerType.cs
+++ b/MediaBrowser.Model/Entities/TrailerType.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
namespace MediaBrowser.Model.Entities
{
public enum TrailerType
diff --git a/MediaBrowser.Model/Entities/UserDataSaveReason.cs b/MediaBrowser.Model/Entities/UserDataSaveReason.cs
index bd7471682..20404e6f4 100644
--- a/MediaBrowser.Model/Entities/UserDataSaveReason.cs
+++ b/MediaBrowser.Model/Entities/UserDataSaveReason.cs
@@ -1,32 +1,37 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Enum UserDataSaveReason
+ /// Enum UserDataSaveReason.
/// </summary>
public enum UserDataSaveReason
{
/// <summary>
- /// The playback start
+ /// The playback start.
/// </summary>
PlaybackStart = 1,
+
/// <summary>
- /// The playback progress
+ /// The playback progress.
/// </summary>
PlaybackProgress = 2,
+
/// <summary>
- /// The playback finished
+ /// The playback finished.
/// </summary>
PlaybackFinished = 3,
+
/// <summary>
- /// The toggle played
+ /// The toggle played.
/// </summary>
TogglePlayed = 4,
+
/// <summary>
- /// The update user rating
+ /// The update user rating.
/// </summary>
UpdateUserRating = 5,
+
/// <summary>
- /// The import
+ /// The import.
/// </summary>
Import = 6
}
diff --git a/MediaBrowser.Model/Entities/Video3DFormat.cs b/MediaBrowser.Model/Entities/Video3DFormat.cs
index 89923ae52..a4f62e18b 100644
--- a/MediaBrowser.Model/Entities/Video3DFormat.cs
+++ b/MediaBrowser.Model/Entities/Video3DFormat.cs
@@ -1,3 +1,5 @@
+#pragma warning disable CS1591
+
namespace MediaBrowser.Model.Entities
{
public enum Video3DFormat
diff --git a/MediaBrowser.Model/Entities/VideoType.cs b/MediaBrowser.Model/Entities/VideoType.cs
index 95d69fb7b..172796301 100644
--- a/MediaBrowser.Model/Entities/VideoType.cs
+++ b/MediaBrowser.Model/Entities/VideoType.cs
@@ -1,24 +1,27 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Enum VideoType
+ /// Enum VideoType.
/// </summary>
public enum VideoType
{
/// <summary>
- /// The video file
+ /// The video file.
/// </summary>
VideoFile,
+
/// <summary>
- /// The iso
+ /// The iso.
/// </summary>
Iso,
+
/// <summary>
- /// The DVD
+ /// The DVD.
/// </summary>
Dvd,
+
/// <summary>
- /// The blu ray
+ /// The blu ray.
/// </summary>
BluRay
}
diff --git a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs
index 6bdbdb489..2b2bda12c 100644
--- a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs
+++ b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs
@@ -1,14 +1,27 @@
+#nullable disable
+#pragma warning disable CS1591
+
using System;
+using System.Text.Json.Serialization;
+using Jellyfin.Extensions.Json.Converters;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Model.Entities
{
/// <summary>
- /// Used to hold information about a user's list of configured virtual folders
+ /// 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>
@@ -24,19 +37,12 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the type of the collection.
/// </summary>
/// <value>The type of the collection.</value>
- public string CollectionType { get; set; }
+ [JsonConverter(typeof(JsonLowerCaseConverter<CollectionTypeOptions?>))]
+ public CollectionTypeOptions? CollectionType { get; set; }
public LibraryOptions LibraryOptions { get; set; }
/// <summary>
- /// Initializes a new instance of the <see cref="VirtualFolderInfo"/> class.
- /// </summary>
- public VirtualFolderInfo()
- {
- Locations = Array.Empty<string>();
- }
-
- /// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
@@ -49,6 +55,7 @@ namespace MediaBrowser.Model.Entities
public string PrimaryImageItemId { get; set; }
public double? RefreshProgress { get; set; }
+
public string RefreshStatus { get; set; }
}
}