mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
fixes #299 - Add trailer urls to MovieDbProvider
This commit is contained in:
parent
c70f1047f7
commit
5782d9084d
9 changed files with 62 additions and 25 deletions
|
@ -399,9 +399,9 @@ namespace MediaBrowser.Controller.Dto
|
||||||
dto.Taglines = item.Taglines;
|
dto.Taglines = item.Taglines;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fields.Contains(ItemFields.TrailerUrls))
|
if (fields.Contains(ItemFields.RemoteTrailers))
|
||||||
{
|
{
|
||||||
dto.TrailerUrls = item.TrailerUrls;
|
dto.RemoteTrailers = item.RemoteTrailers;
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.Type = item.GetType().Name;
|
dto.Type = item.GetType().Name;
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
protected BaseItem()
|
protected BaseItem()
|
||||||
{
|
{
|
||||||
Genres = new List<string>();
|
Genres = new List<string>();
|
||||||
TrailerUrls = new List<string>();
|
RemoteTrailers = new List<MediaUrl>();
|
||||||
Studios = new List<string>();
|
Studios = new List<string>();
|
||||||
People = new List<PersonInfo>();
|
People = new List<PersonInfo>();
|
||||||
Taglines = new List<string>();
|
Taglines = new List<string>();
|
||||||
|
@ -903,7 +903,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Gets or sets the trailer URL.
|
/// Gets or sets the trailer URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The trailer URL.</value>
|
/// <value>The trailer URL.</value>
|
||||||
public List<string> TrailerUrls { get; set; }
|
public List<MediaUrl> RemoteTrailers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the provider ids.
|
/// Gets or sets the provider ids.
|
||||||
|
@ -1180,22 +1180,28 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Adds a TrailerUrl to the item
|
/// Adds a TrailerUrl to the item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url">The URL.</param>
|
/// <param name="url">The URL.</param>
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <param name="isDirectLink">if set to <c>true</c> [is direct link].</param>
|
||||||
public void AddTrailerUrl(string url)
|
/// <exception cref="System.ArgumentNullException">url</exception>
|
||||||
|
public void AddTrailerUrl(string url, bool isDirectLink)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(url))
|
if (string.IsNullOrWhiteSpace(url))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("url");
|
throw new ArgumentNullException("url");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TrailerUrls == null)
|
var current = RemoteTrailers.FirstOrDefault(i => string.Equals(i.Url, url, StringComparison.OrdinalIgnoreCase));
|
||||||
{
|
|
||||||
TrailerUrls = new List<string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!TrailerUrls.Contains(url, StringComparer.OrdinalIgnoreCase))
|
if (current != null)
|
||||||
{
|
{
|
||||||
TrailerUrls.Add(url);
|
current.IsDirectLink = isDirectLink;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RemoteTrailers.Add(new MediaUrl
|
||||||
|
{
|
||||||
|
Url = url,
|
||||||
|
IsDirectLink = isDirectLink
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -406,7 +406,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(val))
|
if (!string.IsNullOrWhiteSpace(val))
|
||||||
{
|
{
|
||||||
//item.AddTrailerUrl(val);
|
item.AddTrailerUrl(val, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,9 @@
|
||||||
<Compile Include="..\MediaBrowser.Model\Entities\MediaType.cs">
|
<Compile Include="..\MediaBrowser.Model\Entities\MediaType.cs">
|
||||||
<Link>Entities\MediaType.cs</Link>
|
<Link>Entities\MediaType.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\Entities\MediaUrl.cs">
|
||||||
|
<Link>Entities\MediaUrl.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MediaBrowser.Model\Entities\MetadataFields.cs">
|
<Compile Include="..\MediaBrowser.Model\Entities\MetadataFields.cs">
|
||||||
<Link>Entities\MetadataFields.cs</Link>
|
<Link>Entities\MetadataFields.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -160,7 +160,7 @@ namespace MediaBrowser.Model.Dto
|
||||||
/// Gets or sets the trailer urls.
|
/// Gets or sets the trailer urls.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The trailer urls.</value>
|
/// <value>The trailer urls.</value>
|
||||||
public List<string> TrailerUrls { get; set; }
|
public List<MediaUrl> RemoteTrailers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the provider ids.
|
/// Gets or sets the provider ids.
|
||||||
|
@ -614,16 +614,6 @@ namespace MediaBrowser.Model.Dto
|
||||||
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Menu); }
|
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Menu); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether this instance is video.
|
|
||||||
/// </summary>
|
|
||||||
/// <value><c>true</c> if this instance is video; otherwise, <c>false</c>.</value>
|
|
||||||
[IgnoreDataMember]
|
|
||||||
public bool HasTrailer
|
|
||||||
{
|
|
||||||
get { return LocalTrailerCount > 0 || (TrailerUrls != null && TrailerUrls.Count > 0); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance is video.
|
/// Gets a value indicating whether this instance is video.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
11
MediaBrowser.Model/Entities/MediaUrl.cs
Normal file
11
MediaBrowser.Model/Entities/MediaUrl.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.Entities
|
||||||
|
{
|
||||||
|
public class MediaUrl
|
||||||
|
{
|
||||||
|
public string Url { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public bool? IsHD { get; set; }
|
||||||
|
public bool IsDirectLink { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -52,6 +52,7 @@
|
||||||
<Compile Include="Dto\ItemCounts.cs" />
|
<Compile Include="Dto\ItemCounts.cs" />
|
||||||
<Compile Include="Dto\StudioDto.cs" />
|
<Compile Include="Dto\StudioDto.cs" />
|
||||||
<Compile Include="Entities\ItemReview.cs" />
|
<Compile Include="Entities\ItemReview.cs" />
|
||||||
|
<Compile Include="Entities\MediaUrl.cs" />
|
||||||
<Compile Include="Entities\MetadataFields.cs" />
|
<Compile Include="Entities\MetadataFields.cs" />
|
||||||
<Compile Include="Entities\Video3DFormat.cs" />
|
<Compile Include="Entities\Video3DFormat.cs" />
|
||||||
<Compile Include="Net\WebSocketMessage.cs" />
|
<Compile Include="Net\WebSocketMessage.cs" />
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace MediaBrowser.Model.Querying
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The trailer url of the item
|
/// The trailer url of the item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TrailerUrls,
|
RemoteTrailers,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user data of the item
|
/// The user data of the item
|
||||||
|
|
|
@ -793,6 +793,19 @@ namespace MediaBrowser.Providers.Movies
|
||||||
{
|
{
|
||||||
movie.Tags = movieData.keywords.keywords.Select(i => i.name).ToList();
|
movie.Tags = movieData.keywords.keywords.Select(i => i.name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (movieData.trailers != null && movieData.trailers.youtube != null &&
|
||||||
|
movieData.trailers.youtube.Count > 0)
|
||||||
|
{
|
||||||
|
movie.RemoteTrailers = movieData.trailers.youtube.Select(i => new MediaUrl
|
||||||
|
{
|
||||||
|
Url = string.Format("http://www.youtube.com/watch?{0}", i.source),
|
||||||
|
IsDirectLink = false,
|
||||||
|
Name = i.name,
|
||||||
|
IsHD = string.Equals("hd", i.size, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1179,6 +1192,19 @@ namespace MediaBrowser.Providers.Movies
|
||||||
public Casts casts { get; set; }
|
public Casts casts { get; set; }
|
||||||
public Releases releases { get; set; }
|
public Releases releases { get; set; }
|
||||||
public Keywords keywords { get; set; }
|
public Keywords keywords { get; set; }
|
||||||
|
public Trailers trailers { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Trailers
|
||||||
|
{
|
||||||
|
public List<Youtube> youtube { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Youtube
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public string size { get; set; }
|
||||||
|
public string source { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TmdbImageSettings
|
public class TmdbImageSettings
|
||||||
|
|
Loading…
Reference in a new issue