aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2021-03-02 09:35:51 +0100
committerGitHub <noreply@github.com>2021-03-02 09:35:51 +0100
commite858e5f0b8ee548eee08aa69158ba1aa9bfcb1f9 (patch)
treeeb93d9cc59d4ac2affd82534b2167791f16cc904 /MediaBrowser.Model
parent1f0bbe266c2af4dae09ee4ecb8fd7efaabd99176 (diff)
parentba62d9d1fe84dfb16c502ab7e105c6c6807770ab (diff)
Merge pull request #5339 from Bond-009/hasproviderids
Revert breaking change to HasProviderId
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 11c3dbe42..bde5a1da1 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>