From 5782d9084db2e3b4f2b5d4dfc8d5dfef02498906 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 27 Jun 2013 12:36:41 -0400 Subject: fixes #299 - Add trailer urls to MovieDbProvider --- MediaBrowser.Controller/Entities/BaseItem.cs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'MediaBrowser.Controller/Entities') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index d13e69fce..320225031 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -27,7 +27,7 @@ namespace MediaBrowser.Controller.Entities protected BaseItem() { Genres = new List(); - TrailerUrls = new List(); + RemoteTrailers = new List(); Studios = new List(); People = new List(); Taglines = new List(); @@ -903,7 +903,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the trailer URL. /// /// The trailer URL. - public List TrailerUrls { get; set; } + public List RemoteTrailers { get; set; } /// /// Gets or sets the provider ids. @@ -1180,22 +1180,28 @@ namespace MediaBrowser.Controller.Entities /// Adds a TrailerUrl to the item /// /// The URL. - /// - public void AddTrailerUrl(string url) + /// if set to true [is direct link]. + /// url + public void AddTrailerUrl(string url, bool isDirectLink) { if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException("url"); } - if (TrailerUrls == null) + var current = RemoteTrailers.FirstOrDefault(i => string.Equals(i.Url, url, StringComparison.OrdinalIgnoreCase)); + + if (current != null) { - TrailerUrls = new List(); + current.IsDirectLink = isDirectLink; } - - if (!TrailerUrls.Contains(url, StringComparer.OrdinalIgnoreCase)) + else { - TrailerUrls.Add(url); + RemoteTrailers.Add(new MediaUrl + { + Url = url, + IsDirectLink = isDirectLink + }); } } -- cgit v1.2.3