Exemple #1
0
        public IEnumerable <ExternalUrl> GetExternalUrls(IHasProviderIds item)
        {
            return(GetExternalIds(item)
                   .Select(i =>
            {
                if (string.IsNullOrEmpty(i.UrlFormatString))
                {
                    return null;
                }

                var value = item.GetProviderId(i.Key);

                if (string.IsNullOrEmpty(value))
                {
                    return null;
                }

                return new ExternalUrl
                {
                    Name = i.Name,
                    Url = string.Format(i.UrlFormatString, value)
                };
            }).Where(i => i != null));
        }
Exemple #2
0
 /// <summary>
 /// 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()));
 }
Exemple #3
0
 /// <summary>
 /// Determines whether [has provider identifier] [the specified instance].
 /// </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, MetadataProvider provider)
 {
     return(!string.IsNullOrEmpty(instance.GetProviderId(provider.ToString())));
 }
Exemple #4
0
 /// <summary>
 /// Check whether a dictionary of provider IDs includes an entry for a valid TV metadata provider.
 /// </summary>
 /// <param name="series">The instance of <see cref="IHasProviderIds"/> to check.</param>
 /// <returns>True, if the series contains a valid TV provider ID, otherwise false.</returns>
 internal static bool IsValidSeries(IHasProviderIds series)
 {
     return(!string.IsNullOrEmpty(series.GetProviderId(MetadataProvider.Tvdb)) ||
            !string.IsNullOrEmpty(series.GetProviderId(MetadataProvider.Imdb)) ||
            !string.IsNullOrEmpty(series.GetProviderId(MetadataProvider.Zap2It)));
 }