aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/Configuration/LibraryOptions.cs6
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs2
-rw-r--r--MediaBrowser.Model/Configuration/TrickplayOptions.cs6
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs89
-rw-r--r--MediaBrowser.Model/Dlna/StreamInfo.cs4
-rw-r--r--MediaBrowser.Model/Dlna/TranscodingProfile.cs4
-rw-r--r--MediaBrowser.Model/Dto/BaseItemDto.cs8
-rw-r--r--MediaBrowser.Model/Entities/CollectionTypeOptions.cs59
-rw-r--r--MediaBrowser.Model/Entities/IHasShares.cs6
-rw-r--r--MediaBrowser.Model/Entities/MediaStream.cs60
-rw-r--r--MediaBrowser.Model/Entities/PlaylistUserPermissions.cs30
-rw-r--r--MediaBrowser.Model/Entities/ProviderIdsExtensions.cs60
-rw-r--r--MediaBrowser.Model/Entities/Share.cs17
-rw-r--r--MediaBrowser.Model/Entities/VirtualFolderInfo.cs3
-rw-r--r--MediaBrowser.Model/MediaBrowser.Model.csproj7
-rw-r--r--MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs11
-rw-r--r--MediaBrowser.Model/Playlists/PlaylistUpdateRequest.cs41
-rw-r--r--MediaBrowser.Model/Playlists/PlaylistUserUpdateRequest.cs24
-rw-r--r--MediaBrowser.Model/Providers/ExternalIdInfo.cs5
-rw-r--r--MediaBrowser.Model/Search/SearchHint.cs2
-rw-r--r--MediaBrowser.Model/Tasks/TaskTriggerInfo.cs1
21 files changed, 359 insertions, 86 deletions
diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs
index e777d5fd8..c956bee47 100644
--- a/MediaBrowser.Model/Configuration/LibraryOptions.cs
+++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs
@@ -21,7 +21,7 @@ namespace MediaBrowser.Model.Configuration
AutomaticallyAddToCollection = false;
EnablePhotos = true;
SaveSubtitlesWithMedia = true;
- SaveLyricsWithMedia = true;
+ SaveLyricsWithMedia = false;
PathInfos = Array.Empty<MediaPathInfo>();
EnableAutomaticSeriesGrouping = true;
SeasonZeroDisplayName = "Specials";
@@ -35,8 +35,6 @@ namespace MediaBrowser.Model.Configuration
public bool EnableLUFSScan { get; set; }
- public bool UseReplayGainTags { get; set; }
-
public bool EnableChapterImageExtraction { get; set; }
public bool ExtractChapterImagesDuringLibraryScan { get; set; }
@@ -96,7 +94,7 @@ namespace MediaBrowser.Model.Configuration
public bool SaveSubtitlesWithMedia { get; set; }
- [DefaultValue(true)]
+ [DefaultValue(false)]
public bool SaveLyricsWithMedia { get; set; }
public bool AutomaticallyAddToCollection { get; set; }
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index fe92251e9..52f7e53b8 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -163,7 +163,7 @@ public class ServerConfiguration : BaseApplicationConfiguration
/// If set to 0 the check for inactive sessions gets disabled.
/// </summary>
/// <value>The close inactive session threshold in minutes. 0 to disable.</value>
- public int InactiveSessionThreshold { get; set; } = 10;
+ public int InactiveSessionThreshold { get; set; }
/// <summary>
/// Gets or sets the delay in seconds that we will wait after a file system change to try and discover what has been added/removed
diff --git a/MediaBrowser.Model/Configuration/TrickplayOptions.cs b/MediaBrowser.Model/Configuration/TrickplayOptions.cs
index a151d3429..578bb306a 100644
--- a/MediaBrowser.Model/Configuration/TrickplayOptions.cs
+++ b/MediaBrowser.Model/Configuration/TrickplayOptions.cs
@@ -19,6 +19,12 @@ public class TrickplayOptions
public bool EnableHwEncoding { get; set; } = false;
/// <summary>
+ /// Gets or sets a value indicating whether to only extract key frames.
+ /// Significantly faster, but is not compatible with all decoders and/or video files.
+ /// </summary>
+ public bool EnableKeyFrameOnlyExtraction { get; set; } = false;
+
+ /// <summary>
/// Gets or sets the behavior used by trickplay provider on library scan/update.
/// </summary>
public TrickplayScanBehavior ScanBehavior { get; set; } = TrickplayScanBehavior.NonBlocking;
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index 55d1c3d51..d37528ede 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -25,7 +25,7 @@ namespace MediaBrowser.Model.Dlna
private readonly ILogger _logger;
private readonly ITranscoderSupport _transcoderSupport;
- private static readonly string[] _supportedHlsVideoCodecs = new string[] { "h264", "hevc", "av1" };
+ private static readonly string[] _supportedHlsVideoCodecs = new string[] { "h264", "hevc", "vp9", "av1" };
private static readonly string[] _supportedHlsAudioCodecsTs = new string[] { "aac", "ac3", "eac3", "mp3" };
private static readonly string[] _supportedHlsAudioCodecsMp4 = new string[] { "aac", "ac3", "eac3", "mp3", "alac", "flac", "opus", "dca", "truehd" };
@@ -108,7 +108,7 @@ namespace MediaBrowser.Model.Dlna
var inputAudioSampleRate = audioStream?.SampleRate;
var inputAudioBitDepth = audioStream?.BitDepth;
- if (directPlayMethod.HasValue)
+ if (directPlayMethod is PlayMethod.DirectPlay)
{
var profile = options.Profile;
var audioFailureConditions = GetProfileConditionsForAudio(profile.CodecProfiles, item.Container, audioStream?.Codec, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth, true);
@@ -124,6 +124,46 @@ namespace MediaBrowser.Model.Dlna
}
}
+ if (directPlayMethod is PlayMethod.DirectStream)
+ {
+ var remuxContainer = item.TranscodingContainer ?? "ts";
+ var supportedHlsContainers = new[] { "ts", "mp4" };
+ // If the container specified for the profile is an HLS supported container, use that container instead, overriding the preference
+ // The client should be responsible to ensure this container is compatible
+ remuxContainer = Array.Exists(supportedHlsContainers, element => string.Equals(element, directPlayInfo.Profile?.Container, StringComparison.OrdinalIgnoreCase)) ? directPlayInfo.Profile?.Container : remuxContainer;
+ bool codeIsSupported;
+ if (item.TranscodingSubProtocol == MediaStreamProtocol.hls)
+ {
+ // Enforce HLS audio codec restrictions
+ if (string.Equals(remuxContainer, "mp4", StringComparison.OrdinalIgnoreCase))
+ {
+ codeIsSupported = _supportedHlsAudioCodecsMp4.Contains(directPlayInfo.Profile?.AudioCodec ?? directPlayInfo.Profile?.Container);
+ }
+ else
+ {
+ codeIsSupported = _supportedHlsAudioCodecsTs.Contains(directPlayInfo.Profile?.AudioCodec ?? directPlayInfo.Profile?.Container);
+ }
+ }
+ else
+ {
+ // Let's assume the client has given a correct container for http
+ codeIsSupported = true;
+ }
+
+ if (codeIsSupported)
+ {
+ playlistItem.PlayMethod = directPlayMethod.Value;
+ playlistItem.Container = remuxContainer;
+ playlistItem.TranscodeReasons = transcodeReasons;
+ playlistItem.SubProtocol = item.TranscodingSubProtocol;
+ item.TranscodingContainer = remuxContainer;
+ return playlistItem;
+ }
+
+ transcodeReasons |= TranscodeReason.AudioCodecNotSupported;
+ playlistItem.TranscodeReasons = transcodeReasons;
+ }
+
TranscodingProfile? transcodingProfile = null;
foreach (var tcProfile in options.Profile.TranscodingProfiles)
{
@@ -379,6 +419,7 @@ namespace MediaBrowser.Model.Dlna
var directPlayProfile = options.Profile.DirectPlayProfiles
.FirstOrDefault(x => x.Type == DlnaProfileType.Audio && IsAudioDirectPlaySupported(x, item, audioStream));
+ TranscodeReason transcodeReasons = 0;
if (directPlayProfile is null)
{
_logger.LogDebug(
@@ -387,14 +428,25 @@ namespace MediaBrowser.Model.Dlna
item.Path ?? "Unknown path",
audioStream.Codec ?? "Unknown codec");
- return (null, null, GetTranscodeReasonsFromDirectPlayProfile(item, null, audioStream, options.Profile.DirectPlayProfiles));
- }
+ var directStreamProfile = options.Profile.DirectPlayProfiles
+ .FirstOrDefault(x => x.Type == DlnaProfileType.Audio && IsAudioDirectStreamSupported(x, item, audioStream));
- TranscodeReason transcodeReasons = 0;
+ if (directStreamProfile is not null)
+ {
+ directPlayProfile = directStreamProfile;
+ transcodeReasons |= TranscodeReason.ContainerNotSupported;
+ }
+ else
+ {
+ return (null, null, GetTranscodeReasonsFromDirectPlayProfile(item, null, audioStream, options.Profile.DirectPlayProfiles));
+ }
+ }
// The profile describes what the device supports
// If device requirements are satisfied then allow both direct stream and direct play
- if (item.SupportsDirectPlay)
+ // Note: As of 10.10 codebase, SupportsDirectPlay is always true because the MediaSourceInfo initializes this key as true
+ // Need to check additionally for current transcode reasons
+ if (item.SupportsDirectPlay && transcodeReasons == 0)
{
if (!IsBitrateLimitExceeded(item, options.GetMaxBitrate(true) ?? 0))
{
@@ -414,7 +466,10 @@ namespace MediaBrowser.Model.Dlna
{
if (!IsBitrateLimitExceeded(item, options.GetMaxBitrate(true) ?? 0))
{
- if (options.EnableDirectStream)
+ // Note: as of 10.10 codebase, the options.EnableDirectStream is always false due to
+ // "direct-stream http streaming is currently broken"
+ // Don't check that option for audio as we always assume that is supported
+ if (transcodeReasons == TranscodeReason.ContainerNotSupported)
{
return (directPlayProfile, PlayMethod.DirectStream, transcodeReasons);
}
@@ -542,6 +597,7 @@ namespace MediaBrowser.Model.Dlna
playlistItem.EnableMpegtsM2TsMode = transcodingProfile.EnableMpegtsM2TsMode;
playlistItem.BreakOnNonKeyFrames = transcodingProfile.BreakOnNonKeyFrames;
+ playlistItem.EnableAudioVbrEncoding = transcodingProfile.EnableAudioVbrEncoding;
if (transcodingProfile.MinSegments > 0)
{
@@ -2129,5 +2185,24 @@ namespace MediaBrowser.Model.Dlna
return true;
}
+
+ private static bool IsAudioDirectStreamSupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream audioStream)
+ {
+ // Check container type, this should NOT be supported
+ // If the container is supported, the file should be directly played
+ if (!profile.SupportsContainer(item.Container))
+ {
+ // Check audio codec, we cannot use the SupportsAudioCodec here
+ // Because that one assumes empty container supports all codec, which is just useless
+ string? audioCodec = audioStream?.Codec;
+ if (string.Equals(profile.AudioCodec, audioCodec, StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(profile.Container, audioCodec, StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
}
}
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index 75e5b6d18..c8a341d41 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -108,6 +108,8 @@ namespace MediaBrowser.Model.Dlna
public string? MediaSourceId => MediaSource?.Id;
+ public bool EnableAudioVbrEncoding { get; set; }
+
public bool IsDirectStream => MediaSource?.VideoType is not (VideoType.Dvd or VideoType.BluRay)
&& PlayMethod is PlayMethod.DirectStream or PlayMethod.DirectPlay;
@@ -768,6 +770,8 @@ namespace MediaBrowser.Model.Dlna
}
list.Add(new NameValuePair("RequireAvc", item.RequireAvc.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
+
+ list.Add(new NameValuePair("EnableAudioVbrEncoding", item.EnableAudioVbrEncoding.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
}
list.Add(new NameValuePair("Tag", item.MediaSource?.ETag ?? string.Empty));
diff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.cs
index 891448c66..a556799de 100644
--- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs
+++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs
@@ -70,6 +70,10 @@ namespace MediaBrowser.Model.Dlna
public ProfileCondition[] Conditions { get; set; }
+ [DefaultValue(true)]
+ [XmlAttribute("enableAudioVbrEncoding")]
+ public bool EnableAudioVbrEncoding { get; set; } = true;
+
public string[] GetAudioCodecs()
{
return ContainerProfile.SplitValue(AudioCodec);
diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs
index cfff717db..7e8949e1f 100644
--- a/MediaBrowser.Model/Dto/BaseItemDto.cs
+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs
@@ -65,7 +65,7 @@ namespace MediaBrowser.Model.Dto
public DateTime? DateLastMediaAdded { get; set; }
- public string ExtraType { get; set; }
+ public ExtraType? ExtraType { get; set; }
public int? AirsBeforeSeasonNumber { get; set; }
@@ -782,10 +782,10 @@ namespace MediaBrowser.Model.Dto
public string TimerId { get; set; }
/// <summary>
- /// Gets or sets the LUFS value.
+ /// Gets or sets the gain required for audio normalization.
/// </summary>
- /// <value>The LUFS Value.</value>
- public float? LUFS { get; set; }
+ /// <value>The gain required for audio normalization.</value>
+ public float? NormalizationGain { get; set; }
/// <summary>
/// Gets or sets the current program.
diff --git a/MediaBrowser.Model/Entities/CollectionTypeOptions.cs b/MediaBrowser.Model/Entities/CollectionTypeOptions.cs
index e1894d84a..fc4cfdd66 100644
--- a/MediaBrowser.Model/Entities/CollectionTypeOptions.cs
+++ b/MediaBrowser.Model/Entities/CollectionTypeOptions.cs
@@ -1,16 +1,49 @@
-#pragma warning disable CS1591
+#pragma warning disable SA1300 // Lowercase required for backwards compat.
-namespace MediaBrowser.Model.Entities
+namespace MediaBrowser.Model.Entities;
+
+/// <summary>
+/// The collection type options.
+/// </summary>
+public enum CollectionTypeOptions
{
- public enum CollectionTypeOptions
- {
- Movies = 0,
- TvShows = 1,
- Music = 2,
- MusicVideos = 3,
- HomeVideos = 4,
- BoxSets = 5,
- Books = 6,
- Mixed = 7
- }
+ /// <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
}
diff --git a/MediaBrowser.Model/Entities/IHasShares.cs b/MediaBrowser.Model/Entities/IHasShares.cs
index b34d1a037..8c4ba6c42 100644
--- a/MediaBrowser.Model/Entities/IHasShares.cs
+++ b/MediaBrowser.Model/Entities/IHasShares.cs
@@ -1,4 +1,6 @@
-namespace MediaBrowser.Model.Entities;
+using System.Collections.Generic;
+
+namespace MediaBrowser.Model.Entities;
/// <summary>
/// Interface for access to shares.
@@ -8,5 +10,5 @@ public interface IHasShares
/// <summary>
/// Gets or sets the shares.
/// </summary>
- Share[] Shares { get; set; }
+ IReadOnlyList<PlaylistUserPermissions> Shares { get; set; }
}
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index fa09902e5..844214fae 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -7,6 +7,7 @@ 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;
@@ -273,13 +274,13 @@ namespace MediaBrowser.Model.Entities
attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
}
- if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase) && !string.Equals(Codec, "dts", StringComparison.OrdinalIgnoreCase))
+ if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
{
- attributes.Add(AudioCodec.GetFriendlyName(Codec));
+ attributes.Add(Profile);
}
- else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
+ else if (!string.IsNullOrEmpty(Codec))
{
- attributes.Add(Profile);
+ attributes.Add(AudioCodec.GetFriendlyName(Codec));
}
if (!string.IsNullOrEmpty(ChannelLayout))
@@ -591,6 +592,33 @@ namespace MediaBrowser.Model.Entities
}
}
+ [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>
@@ -662,14 +690,22 @@ namespace MediaBrowser.Model.Entities
{
string codec = format ?? string.Empty;
- // sub = external .sub file
+ // 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)
- && !codec.Contains("dvd", StringComparison.OrdinalIgnoreCase)
- && !codec.Contains("dvbsub", StringComparison.OrdinalIgnoreCase)
- && !string.Equals(codec, "sub", StringComparison.OrdinalIgnoreCase)
- && !string.Equals(codec, "sup", StringComparison.OrdinalIgnoreCase)
- && !string.Equals(codec, "dvb_subtitle", StringComparison.OrdinalIgnoreCase);
+ return codec.Contains("pgs", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(codec, "sup", StringComparison.OrdinalIgnoreCase);
}
public bool SupportsSubtitleConversionTo(string toCodec)
@@ -736,6 +772,8 @@ namespace MediaBrowser.Model.Entities
1 => (VideoRange.HDR, VideoRangeType.DOVIWithHDR10),
4 => (VideoRange.HDR, VideoRangeType.DOVIWithHLG),
2 => (VideoRange.SDR, VideoRangeType.DOVIWithSDR),
+ // While not in Dolby Spec, Profile 8 CCid 6 media are possible to create, and since CCid 6 stems from Bluray (Profile 7 originally) an HDR10 base layer is guaranteed to exist.
+ 6 => (VideoRange.HDR, VideoRangeType.DOVIWithHDR10),
// There is no other case to handle here as per Dolby Spec. Default case included for completeness and linting purposes
_ => (VideoRange.SDR, VideoRangeType.SDR)
},
diff --git a/MediaBrowser.Model/Entities/PlaylistUserPermissions.cs b/MediaBrowser.Model/Entities/PlaylistUserPermissions.cs
new file mode 100644
index 000000000..b5f017d2b
--- /dev/null
+++ b/MediaBrowser.Model/Entities/PlaylistUserPermissions.cs
@@ -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; }
+}
diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
index cf453d62c..1c73091f0 100644
--- a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
+++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
@@ -111,31 +111,32 @@ namespace MediaBrowser.Model.Entities
/// Sets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
- /// <param name="name">The name.</param>
+ /// <param name="name">The name, this should not contain a '=' character.</param>
/// <param name="value">The value.</param>
- public static void SetProviderId(this IHasProviderIds instance, string name, string? value)
+ /// <remarks>Due to how deserialization from the database works the name can not contain '='.</remarks>
+ public static void SetProviderId(this IHasProviderIds instance, string name, string value)
{
ArgumentNullException.ThrowIfNull(instance);
+ ArgumentException.ThrowIfNullOrEmpty(name);
+ ArgumentException.ThrowIfNullOrEmpty(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);
- // If it's null remove the key from the dictionary
- if (string.IsNullOrEmpty(value))
+ // Match on internal MetadataProvider enum string values before adding arbitrary providers
+ if (_metadataProviderEnumDictionary.TryGetValue(name, out var enumValue))
{
- instance.ProviderIds?.Remove(name);
+ instance.ProviderIds[enumValue] = value;
}
else
{
- // 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;
- }
+ instance.ProviderIds[name] = value;
}
}
@@ -149,5 +150,30 @@ namespace MediaBrowser.Model.Entities
{
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());
+ }
}
}
diff --git a/MediaBrowser.Model/Entities/Share.cs b/MediaBrowser.Model/Entities/Share.cs
deleted file mode 100644
index 186aad189..000000000
--- a/MediaBrowser.Model/Entities/Share.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace MediaBrowser.Model.Entities;
-
-/// <summary>
-/// Class to hold data on sharing permissions.
-/// </summary>
-public class Share
-{
- /// <summary>
- /// Gets or sets the user id.
- /// </summary>
- public string? UserId { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether the user has edit permissions.
- /// </summary>
- public bool CanEdit { get; set; }
-}
diff --git a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs
index 2b2bda12c..ea3df3726 100644
--- a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs
+++ b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs
@@ -2,8 +2,6 @@
#pragma warning disable CS1591
using System;
-using System.Text.Json.Serialization;
-using Jellyfin.Extensions.Json.Converters;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Model.Entities
@@ -37,7 +35,6 @@ namespace MediaBrowser.Model.Entities
/// Gets or sets the type of the collection.
/// </summary>
/// <value>The type of the collection.</value>
- [JsonConverter(typeof(JsonLowerCaseConverter<CollectionTypeOptions?>))]
public CollectionTypeOptions? CollectionType { get; set; }
public LibraryOptions LibraryOptions { get; set; }
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index 7af46f8a0..b4a30b5d5 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -8,7 +8,7 @@
<PropertyGroup>
<Authors>Jellyfin Contributors</Authors>
<PackageId>Jellyfin.Model</PackageId>
- <VersionPrefix>10.9.0</VersionPrefix>
+ <VersionPrefix>10.10.0</VersionPrefix>
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
</PropertyGroup>
@@ -33,7 +33,10 @@
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.AspNetCore.HttpOverrides" />
+ <FrameworkReference Include="Microsoft.AspNetCore.App" />
+ </ItemGroup>
+
+ <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="MimeTypes">
<PrivateAssets>all</PrivateAssets>
diff --git a/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs b/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs
index 62d496d04..ec54b1afd 100644
--- a/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs
+++ b/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs
@@ -18,7 +18,7 @@ public class PlaylistCreationRequest
/// <summary>
/// Gets or sets the list of items.
/// </summary>
- public IReadOnlyList<Guid> ItemIdList { get; set; } = Array.Empty<Guid>();
+ public IReadOnlyList<Guid> ItemIdList { get; set; } = [];
/// <summary>
/// Gets or sets the media type.
@@ -31,7 +31,12 @@ public class PlaylistCreationRequest
public Guid UserId { get; set; }
/// <summary>
- /// Gets or sets the shares.
+ /// Gets or sets the user permissions.
/// </summary>
- public Share[]? Shares { get; set; }
+ public IReadOnlyList<PlaylistUserPermissions> Users { get; set; } = [];
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the playlist is public.
+ /// </summary>
+ public bool? Public { get; set; } = true;
}
diff --git a/MediaBrowser.Model/Playlists/PlaylistUpdateRequest.cs b/MediaBrowser.Model/Playlists/PlaylistUpdateRequest.cs
new file mode 100644
index 000000000..db290bbdb
--- /dev/null
+++ b/MediaBrowser.Model/Playlists/PlaylistUpdateRequest.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Model.Playlists;
+
+/// <summary>
+/// A playlist update request.
+/// </summary>
+public class PlaylistUpdateRequest
+{
+ /// <summary>
+ /// Gets or sets the id of the playlist.
+ /// </summary>
+ public Guid Id { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id of the user updating the playlist.
+ /// </summary>
+ public Guid UserId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name of the playlist.
+ /// </summary>
+ public string? Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets item ids to add to the playlist.
+ /// </summary>
+ public IReadOnlyList<Guid>? Ids { get; set; }
+
+ /// <summary>
+ /// Gets or sets the playlist users.
+ /// </summary>
+ public IReadOnlyList<PlaylistUserPermissions>? Users { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the playlist is public.
+ /// </summary>
+ public bool? Public { get; set; }
+}
diff --git a/MediaBrowser.Model/Playlists/PlaylistUserUpdateRequest.cs b/MediaBrowser.Model/Playlists/PlaylistUserUpdateRequest.cs
new file mode 100644
index 000000000..1840efdf3
--- /dev/null
+++ b/MediaBrowser.Model/Playlists/PlaylistUserUpdateRequest.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace MediaBrowser.Model.Playlists;
+
+/// <summary>
+/// A playlist user update request.
+/// </summary>
+public class PlaylistUserUpdateRequest
+{
+ /// <summary>
+ /// Gets or sets the id of the playlist.
+ /// </summary>
+ public Guid Id { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id of the updated user.
+ /// </summary>
+ public Guid UserId { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the user can edit the playlist.
+ /// </summary>
+ public bool? CanEdit { get; set; }
+}
diff --git a/MediaBrowser.Model/Providers/ExternalIdInfo.cs b/MediaBrowser.Model/Providers/ExternalIdInfo.cs
index d026d574f..1f5163aa8 100644
--- a/MediaBrowser.Model/Providers/ExternalIdInfo.cs
+++ b/MediaBrowser.Model/Providers/ExternalIdInfo.cs
@@ -1,3 +1,5 @@
+using System;
+
namespace MediaBrowser.Model.Providers
{
/// <summary>
@@ -17,7 +19,9 @@ namespace MediaBrowser.Model.Providers
Name = name;
Key = key;
Type = type;
+#pragma warning disable CS0618 // Type or member is obsolete - Remove 10.11
UrlFormatString = urlFormatString;
+#pragma warning restore CS0618 // Type or member is obsolete
}
/// <summary>
@@ -46,6 +50,7 @@ namespace MediaBrowser.Model.Providers
/// <summary>
/// Gets or sets the URL format string.
/// </summary>
+ [Obsolete("Obsolete in 10.10, to be removed in 10.11")]
public string? UrlFormatString { get; set; }
}
}
diff --git a/MediaBrowser.Model/Search/SearchHint.cs b/MediaBrowser.Model/Search/SearchHint.cs
index fd911dbed..2e2979fcf 100644
--- a/MediaBrowser.Model/Search/SearchHint.cs
+++ b/MediaBrowser.Model/Search/SearchHint.cs
@@ -43,7 +43,7 @@ namespace MediaBrowser.Model.Search
/// Gets or sets the matched term.
/// </summary>
/// <value>The matched term.</value>
- public string MatchedTerm { get; set; }
+ public string? MatchedTerm { get; set; }
/// <summary>
/// Gets or sets the index number.
diff --git a/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs b/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs
index f8a8c727e..1d8767dc1 100644
--- a/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs
+++ b/MediaBrowser.Model/Tasks/TaskTriggerInfo.cs
@@ -13,7 +13,6 @@ namespace MediaBrowser.Model.Tasks
public const string TriggerDaily = "DailyTrigger";
public const string TriggerWeekly = "WeeklyTrigger";
public const string TriggerInterval = "IntervalTrigger";
- public const string TriggerSystemEvent = "SystemEventTrigger";
public const string TriggerStartup = "StartupTrigger";
/// <summary>