aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-06-27 12:36:41 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-06-27 12:36:41 -0400
commit5782d9084db2e3b4f2b5d4dfc8d5dfef02498906 (patch)
treef8cbbd095c6a050fe4d7b6630868f246da4d23f5 /MediaBrowser.Controller/Entities
parentc70f1047f7433102c54004b0f3c4d44a3b859882 (diff)
fixes #299 - Add trailer urls to MovieDbProvider
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs24
1 files changed, 15 insertions, 9 deletions
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<string>();
- TrailerUrls = new List<string>();
+ RemoteTrailers = new List<MediaUrl>();
Studios = new List<string>();
People = new List<PersonInfo>();
Taglines = new List<string>();
@@ -903,7 +903,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets or sets the trailer URL.
/// </summary>
/// <value>The trailer URL.</value>
- public List<string> TrailerUrls { get; set; }
+ public List<MediaUrl> RemoteTrailers { get; set; }
/// <summary>
/// Gets or sets the provider ids.
@@ -1180,22 +1180,28 @@ namespace MediaBrowser.Controller.Entities
/// Adds a TrailerUrl to the item
/// </summary>
/// <param name="url">The URL.</param>
- /// <exception cref="System.ArgumentNullException"></exception>
- public void AddTrailerUrl(string url)
+ /// <param name="isDirectLink">if set to <c>true</c> [is direct link].</param>
+ /// <exception cref="System.ArgumentNullException">url</exception>
+ 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<string>();
+ current.IsDirectLink = isDirectLink;
}
-
- if (!TrailerUrls.Contains(url, StringComparer.OrdinalIgnoreCase))
+ else
{
- TrailerUrls.Add(url);
+ RemoteTrailers.Add(new MediaUrl
+ {
+ Url = url,
+ IsDirectLink = isDirectLink
+ });
}
}