aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2021-03-02 09:35:51 +0100
committerJoshua M. Boniface <joshua@boniface.me>2021-03-06 14:26:41 -0500
commit20810eedbe0c4fdd9f1ea443ea1d196697e5d2e1 (patch)
tree19115677db52d4a6822c15ecf2300f853bfbea63 /MediaBrowser.Model
parent2d88b8346d76ab618406448f4b4a60e29bcb9427 (diff)
Merge pull request #5339 from Bond-009/hasproviderids
Revert breaking change to HasProviderId (cherry picked from commit e858e5f0b8ee548eee08aa69158ba1aa9bfcb1f9) Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/Entities/ProviderIdsExtensions.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
index 4aff6e3a4..16e1d49c7 100644
--- a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
+++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
@@ -10,6 +10,33 @@ namespace MediaBrowser.Model.Entities
public static class ProviderIdsExtensions
{
/// <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)
+ {
+ if (instance == null)
+ {
+ throw new ArgumentNullException(nameof(instance));
+ }
+
+ return instance.ProviderIds?.ContainsKey(name) ?? false;
+ }
+
+ /// <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)
+ {
+ return instance.HasProviderId(provider.ToString());
+ }
+
+ /// <summary>
/// Gets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>