using MediaBrowser.Model.Entities;
using System;
using System.Linq;
namespace MediaBrowser.Controller.Entities
{
///
/// Class Extensions
///
public static class Extensions
{
///
/// Adds the trailer URL.
///
/// The item.
/// The URL.
/// if set to true [is direct link].
/// url
public static void AddTrailerUrl(this IHasTrailers item, string url, bool isDirectLink)
{
if (string.IsNullOrWhiteSpace(url))
{
throw new ArgumentNullException("url");
}
var current = item.RemoteTrailers.FirstOrDefault(i => string.Equals(i.Url, url, StringComparison.OrdinalIgnoreCase));
if (current == null)
{
item.RemoteTrailers.Add(new MediaUrl
{
Url = url
});
}
}
}
}