mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 14:03:03 +03:00
Update to 3.5.2 and .net core 2.1
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Class Extensions
|
||||
/// </summary>
|
||||
public static class Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds the trailer URL.
|
||||
/// </summary>
|
||||
public static void AddTrailerUrl(this IHasTrailers item, string url)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
throw new ArgumentNullException("url");
|
||||
}
|
||||
|
||||
var current = item.RemoteTrailers.FirstOrDefault(i => string.Equals(i.Url, url, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (current == null)
|
||||
{
|
||||
var mediaUrl = new MediaUrl
|
||||
{
|
||||
Url = url
|
||||
};
|
||||
|
||||
if (item.RemoteTrailers.Length == 0)
|
||||
{
|
||||
item.RemoteTrailers = new[] { mediaUrl };
|
||||
}
|
||||
else
|
||||
{
|
||||
var list = item.RemoteTrailers.ToArray(item.RemoteTrailers.Length + 1);
|
||||
list[list.Length - 1] = mediaUrl;
|
||||
|
||||
item.RemoteTrailers = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user