aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Entities
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-03-01 20:35:38 +0100
committerBond_009 <bond.009@outlook.com>2021-03-01 20:35:38 +0100
commitba62d9d1fe84dfb16c502ab7e105c6c6807770ab (patch)
treeada77a978cc7ff9b9cfe3a039d3f144eee8c44ee /MediaBrowser.Model/Entities
parent9390dd2df87d4ed74bcb5f7077ab19d3ec219c43 (diff)
Revert breaking change
Diffstat (limited to 'MediaBrowser.Model/Entities')
-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>