mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Conflicts: SharedVersion.cs
This commit is contained in:
commit
c48458f215
@ -102,7 +102,7 @@ namespace MediaBrowser.Api
|
|||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private readonly INetworkManager _netManager;
|
private readonly INetworkManager _netManager;
|
||||||
private readonly IJsonSerializer _serializer;
|
private readonly IJsonSerializer _serializer;
|
||||||
private const string MbAdminUrl = "http://www.mb3admin.com/admin/";
|
private const string MbAdminUrl = "https://www.mb3admin.com/admin/";
|
||||||
|
|
||||||
public PackageReviewService(IHttpClient client, INetworkManager net, IJsonSerializer serializer)
|
public PackageReviewService(IHttpClient client, INetworkManager net, IJsonSerializer serializer)
|
||||||
{
|
{
|
||||||
|
@ -135,7 +135,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
|||||||
request.Referer = options.Referer;
|
request.Referer = options.Referer;
|
||||||
}
|
}
|
||||||
|
|
||||||
request.ServicePoint.BindIPEndPointDelegate = BindIPEndPointCallback;
|
//request.ServicePoint.BindIPEndPointDelegate = BindIPEndPointCallback;
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace MediaBrowser.Common.Implementations.Security
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PluginSecurityManager : ISecurityManager
|
public class PluginSecurityManager : ISecurityManager
|
||||||
{
|
{
|
||||||
private const string MbAdminUrl = "http://www.mb3admin.com/admin/";
|
private const string MbAdminUrl = "https://www.mb3admin.com/admin/";
|
||||||
|
|
||||||
private const string MBValidateUrl = MbAdminUrl + "service/registration/validate";
|
private const string MBValidateUrl = MbAdminUrl + "service/registration/validate";
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Tuple<List<PackageInfo>, DateTime> _lastPackageListResult;
|
private Tuple<List<PackageInfo>, DateTime> _lastPackageListResult;
|
||||||
private const string MbAdminUrl = "http://www.mb3admin.com/admin/";
|
private const string MbAdminUrl = "https://www.mb3admin.com/admin/";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all available packages.
|
/// Gets all available packages.
|
||||||
|
@ -602,118 +602,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return PlayAccess.Full;
|
return PlayAccess.Full;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Loads local trailers from the file system
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>List{Video}.</returns>
|
|
||||||
private IEnumerable<Trailer> LoadLocalTrailers(List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
|
||||||
{
|
|
||||||
var files = fileSystemChildren.OfType<DirectoryInfo>()
|
|
||||||
.Where(i => string.Equals(i.Name, TrailerFolderName, StringComparison.OrdinalIgnoreCase))
|
|
||||||
.SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var extraTypes = new List<ExtraType> { ExtraType.Trailer };
|
|
||||||
var suffixes = ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
|
|
||||||
.Select(i => i.Key)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
files.AddRange(fileSystemChildren.OfType<FileInfo>()
|
|
||||||
.Where(i =>
|
|
||||||
{
|
|
||||||
var nameEithoutExtension = FileSystem.GetFileNameWithoutExtension(i);
|
|
||||||
|
|
||||||
if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !string.Equals(Path, i.FullName, StringComparison.OrdinalIgnoreCase);
|
|
||||||
}));
|
|
||||||
|
|
||||||
return LibraryManager.ResolvePaths<Trailer>(files, directoryService, null).Select(video =>
|
|
||||||
{
|
|
||||||
// Try to retrieve it from the db. If we don't find it, use the resolved version
|
|
||||||
var dbItem = LibraryManager.GetItemById(video.Id) as Trailer;
|
|
||||||
|
|
||||||
if (dbItem != null)
|
|
||||||
{
|
|
||||||
video = dbItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (video != null)
|
|
||||||
{
|
|
||||||
video.ExtraType = ExtraType.Trailer;
|
|
||||||
}
|
|
||||||
|
|
||||||
return video;
|
|
||||||
|
|
||||||
// Sort them so that the list can be easily compared for changes
|
|
||||||
}).OrderBy(i => i.Path).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IEnumerable<Video> LoadSpecialFeatures(List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
|
||||||
{
|
|
||||||
var files = fileSystemChildren.OfType<DirectoryInfo>()
|
|
||||||
.Where(i => string.Equals(i.Name, "extras", StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, "specials", StringComparison.OrdinalIgnoreCase))
|
|
||||||
.SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var extraTypes = new List<ExtraType> { ExtraType.BehindTheScenes, ExtraType.DeletedScene, ExtraType.Interview, ExtraType.Sample, ExtraType.Scene, ExtraType.Clip };
|
|
||||||
var suffixes = ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
|
|
||||||
.Select(i => i.Key)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
files.AddRange(fileSystemChildren.OfType<FileInfo>()
|
|
||||||
.Where(i =>
|
|
||||||
{
|
|
||||||
var nameEithoutExtension = FileSystem.GetFileNameWithoutExtension(i);
|
|
||||||
|
|
||||||
if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !string.Equals(Path, i.FullName, StringComparison.OrdinalIgnoreCase);
|
|
||||||
}));
|
|
||||||
|
|
||||||
return LibraryManager.ResolvePaths<Video>(files, directoryService, null).Select(video =>
|
|
||||||
{
|
|
||||||
// Try to retrieve it from the db. If we don't find it, use the resolved version
|
|
||||||
var dbItem = LibraryManager.GetItemById(video.Id) as Video;
|
|
||||||
|
|
||||||
if (dbItem != null)
|
|
||||||
{
|
|
||||||
video = dbItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (video != null)
|
|
||||||
{
|
|
||||||
SetExtraTypeFromFilename(video);
|
|
||||||
}
|
|
||||||
|
|
||||||
return video;
|
|
||||||
|
|
||||||
// Sort them so that the list can be easily compared for changes
|
|
||||||
}).OrderBy(i => i.Path).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetExtraTypeFromFilename(Video item)
|
|
||||||
{
|
|
||||||
var name = System.IO.Path.GetFileNameWithoutExtension(item.Path) ?? string.Empty;
|
|
||||||
|
|
||||||
foreach (var suffix in ExtraSuffixes)
|
|
||||||
{
|
|
||||||
if (name.EndsWith(suffix.Key, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
item.ExtraType = suffix.Value;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
item.ExtraType = ExtraType.Clip;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the theme songs.
|
/// Loads the theme songs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -879,7 +767,8 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
private async Task<bool> RefreshLocalTrailers(IHasTrailers item, MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
private async Task<bool> RefreshLocalTrailers(IHasTrailers item, MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var newItems = LoadLocalTrailers(fileSystemChildren, options.DirectoryService).ToList();
|
var newItems = LibraryManager.FindTrailers(this, fileSystemChildren, options.DirectoryService).ToList();
|
||||||
|
|
||||||
var newItemIds = newItems.Select(i => i.Id).ToList();
|
var newItemIds = newItems.Select(i => i.Id).ToList();
|
||||||
|
|
||||||
var itemsChanged = !item.LocalTrailerIds.SequenceEqual(newItemIds);
|
var itemsChanged = !item.LocalTrailerIds.SequenceEqual(newItemIds);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Progress;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Localization;
|
using MediaBrowser.Controller.Localization;
|
||||||
|
@ -119,7 +119,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||||||
|
|
||||||
private async Task<bool> RefreshSpecialFeatures(MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
private async Task<bool> RefreshSpecialFeatures(MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var newItems = LoadSpecialFeatures(fileSystemChildren, options.DirectoryService).ToList();
|
var newItems = LibraryManager.FindExtras(this, fileSystemChildren, options.DirectoryService).ToList();
|
||||||
var newItemIds = newItems.Select(i => i.Id).ToList();
|
var newItemIds = newItems.Select(i => i.Id).ToList();
|
||||||
|
|
||||||
var itemsChanged = !SpecialFeatureIds.SequenceEqual(newItemIds);
|
var itemsChanged = !SpecialFeatureIds.SequenceEqual(newItemIds);
|
||||||
|
@ -229,46 +229,6 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <returns>BaseItem.</returns>
|
/// <returns>BaseItem.</returns>
|
||||||
BaseItem RetrieveItem(Guid id);
|
BaseItem RetrieveItem(Guid id);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Validates the artists.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <param name="progress">The progress.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task ValidateArtists(CancellationToken cancellationToken, IProgress<double> progress);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Validates the music genres.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <param name="progress">The progress.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task ValidateMusicGenres(CancellationToken cancellationToken, IProgress<double> progress);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Validates the game genres.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <param name="progress">The progress.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task ValidateGameGenres(CancellationToken cancellationToken, IProgress<double> progress);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Validates the genres.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <param name="progress">The progress.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task ValidateGenres(CancellationToken cancellationToken, IProgress<double> progress);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Validates the studios.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <param name="progress">The progress.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task ValidateStudios(CancellationToken cancellationToken, IProgress<double> progress);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when [item added].
|
/// Occurs when [item added].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -422,5 +382,25 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <param name="type">The type.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <returns>Guid.</returns>
|
/// <returns>Guid.</returns>
|
||||||
Guid GetNewItemId(string key, Type type);
|
Guid GetNewItemId(string key, Type type);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the trailers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="owner">The owner.</param>
|
||||||
|
/// <param name="fileSystemChildren">The file system children.</param>
|
||||||
|
/// <param name="directoryService">The directory service.</param>
|
||||||
|
/// <returns>IEnumerable<Trailer>.</returns>
|
||||||
|
IEnumerable<Trailer> FindTrailers(BaseItem owner, List<FileSystemInfo> fileSystemChildren,
|
||||||
|
IDirectoryService directoryService);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the extras.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="owner">The owner.</param>
|
||||||
|
/// <param name="fileSystemChildren">The file system children.</param>
|
||||||
|
/// <param name="directoryService">The directory service.</param>
|
||||||
|
/// <returns>IEnumerable<Video>.</returns>
|
||||||
|
IEnumerable<Video> FindExtras(BaseItem owner, List<FileSystemInfo> fileSystemChildren,
|
||||||
|
IDirectoryService directoryService);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -111,7 +111,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddCover(item, element);
|
AddCover(item, null, element);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||||||
|
|
||||||
AddCommonFields(folder, stubType, null, container, filter);
|
AddCommonFields(folder, stubType, null, container, filter);
|
||||||
|
|
||||||
AddCover(folder, container);
|
AddCover(folder, stubType, container);
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
@ -750,8 +750,14 @@ namespace MediaBrowser.Dlna.Didl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCover(BaseItem item, XmlElement element)
|
private void AddCover(BaseItem item, StubType? stubType, XmlElement element)
|
||||||
{
|
{
|
||||||
|
if (stubType.HasValue && stubType.Value == StubType.People)
|
||||||
|
{
|
||||||
|
AddEmbeddedImageAsCover("people", element);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var imageInfo = GetImageInfo(item);
|
var imageInfo = GetImageInfo(item);
|
||||||
|
|
||||||
if (imageInfo == null)
|
if (imageInfo == null)
|
||||||
@ -810,6 +816,22 @@ namespace MediaBrowser.Dlna.Didl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddEmbeddedImageAsCover(string name, XmlElement element)
|
||||||
|
{
|
||||||
|
var result = element.OwnerDocument;
|
||||||
|
|
||||||
|
var icon = result.CreateElement("upnp", "albumArtURI", NS_UPNP);
|
||||||
|
var profile = result.CreateAttribute("dlna", "profileID", NS_DLNA);
|
||||||
|
profile.InnerText = _profile.AlbumArtPn;
|
||||||
|
icon.SetAttributeNode(profile);
|
||||||
|
icon.InnerText = _serverAddress + "/Dlna/icons/people480.jpg";
|
||||||
|
element.AppendChild(icon);
|
||||||
|
|
||||||
|
icon = result.CreateElement("upnp", "icon", NS_UPNP);
|
||||||
|
icon.InnerText = _serverAddress + "/Dlna/icons/people48.jpg";
|
||||||
|
element.AppendChild(icon);
|
||||||
|
}
|
||||||
|
|
||||||
private void AddImageResElement(BaseItem item,
|
private void AddImageResElement(BaseItem item,
|
||||||
XmlElement element,
|
XmlElement element,
|
||||||
int maxWidth,
|
int maxWidth,
|
||||||
|
BIN
MediaBrowser.Dlna/Images/people48.jpg
Normal file
BIN
MediaBrowser.Dlna/Images/people48.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
MediaBrowser.Dlna/Images/people48.png
Normal file
BIN
MediaBrowser.Dlna/Images/people48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 688 B |
BIN
MediaBrowser.Dlna/Images/people480.jpg
Normal file
BIN
MediaBrowser.Dlna/Images/people480.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
BIN
MediaBrowser.Dlna/Images/people480.png
Normal file
BIN
MediaBrowser.Dlna/Images/people480.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
@ -198,6 +198,14 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Profiles\Xml\Popcorn Hour.xml" />
|
<EmbeddedResource Include="Profiles\Xml\Popcorn Hour.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Images\people48.jpg" />
|
||||||
|
<EmbeddedResource Include="Images\people48.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Images\people480.jpg" />
|
||||||
|
<EmbeddedResource Include="Images\people480.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
|
|||||||
{
|
{
|
||||||
public class RemoteNotifications : IServerEntryPoint
|
public class RemoteNotifications : IServerEntryPoint
|
||||||
{
|
{
|
||||||
private const string Url = "http://www.mb3admin.com/admin/service/MB3ServerNotifications.json";
|
private const string Url = "https://www.mb3admin.com/admin/service/MB3ServerNotifications.json";
|
||||||
|
|
||||||
private Timer _timer;
|
private Timer _timer;
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
|
@ -12,7 +12,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||||||
private readonly IApplicationHost _applicationHost;
|
private readonly IApplicationHost _applicationHost;
|
||||||
private readonly INetworkManager _networkManager;
|
private readonly INetworkManager _networkManager;
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private const string MbAdminUrl = "http://www.mb3admin.com/admin/";
|
private const string MbAdminUrl = "https://www.mb3admin.com/admin/";
|
||||||
|
|
||||||
public UsageReporter(IApplicationHost applicationHost, INetworkManager networkManager, IHttpClient httpClient)
|
public UsageReporter(IApplicationHost applicationHost, INetworkManager networkManager, IHttpClient httpClient)
|
||||||
{
|
{
|
||||||
|
@ -1736,5 +1736,113 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
return new List<FileSystemInfo>();
|
return new List<FileSystemInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Trailer> FindTrailers(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
||||||
|
{
|
||||||
|
var files = fileSystemChildren.OfType<DirectoryInfo>()
|
||||||
|
.Where(i => string.Equals(i.Name, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var extraTypes = new List<ExtraType> { ExtraType.Trailer };
|
||||||
|
var suffixes = BaseItem.ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
|
||||||
|
.Select(i => i.Key)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
files.AddRange(fileSystemChildren.OfType<FileInfo>()
|
||||||
|
.Where(i =>
|
||||||
|
{
|
||||||
|
var nameEithoutExtension = _fileSystem.GetFileNameWithoutExtension(i);
|
||||||
|
|
||||||
|
if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !string.Equals(owner.Path, i.FullName, StringComparison.OrdinalIgnoreCase);
|
||||||
|
}));
|
||||||
|
|
||||||
|
return ResolvePaths<Trailer>(files, directoryService, null).Select(video =>
|
||||||
|
{
|
||||||
|
// Try to retrieve it from the db. If we don't find it, use the resolved version
|
||||||
|
var dbItem = GetItemById(video.Id) as Trailer;
|
||||||
|
|
||||||
|
if (dbItem != null)
|
||||||
|
{
|
||||||
|
video = dbItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (video != null)
|
||||||
|
{
|
||||||
|
video.ExtraType = ExtraType.Trailer;
|
||||||
|
}
|
||||||
|
|
||||||
|
return video;
|
||||||
|
|
||||||
|
// Sort them so that the list can be easily compared for changes
|
||||||
|
}).OrderBy(i => i.Path).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Video> FindExtras(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
||||||
|
{
|
||||||
|
var files = fileSystemChildren.OfType<DirectoryInfo>()
|
||||||
|
.Where(i => string.Equals(i.Name, "extras", StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, "specials", StringComparison.OrdinalIgnoreCase))
|
||||||
|
.SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var extraTypes = new List<ExtraType> { ExtraType.BehindTheScenes, ExtraType.DeletedScene, ExtraType.Interview, ExtraType.Sample, ExtraType.Scene, ExtraType.Clip };
|
||||||
|
var suffixes = BaseItem.ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
|
||||||
|
.Select(i => i.Key)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
files.AddRange(fileSystemChildren.OfType<FileInfo>()
|
||||||
|
.Where(i =>
|
||||||
|
{
|
||||||
|
var nameEithoutExtension = _fileSystem.GetFileNameWithoutExtension(i);
|
||||||
|
|
||||||
|
if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !string.Equals(owner.Path, i.FullName, StringComparison.OrdinalIgnoreCase);
|
||||||
|
}));
|
||||||
|
|
||||||
|
return ResolvePaths<Video>(files, directoryService, null).Select(video =>
|
||||||
|
{
|
||||||
|
// Try to retrieve it from the db. If we don't find it, use the resolved version
|
||||||
|
var dbItem = GetItemById(video.Id) as Video;
|
||||||
|
|
||||||
|
if (dbItem != null)
|
||||||
|
{
|
||||||
|
video = dbItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (video != null)
|
||||||
|
{
|
||||||
|
SetExtraTypeFromFilename(video);
|
||||||
|
}
|
||||||
|
|
||||||
|
return video;
|
||||||
|
|
||||||
|
// Sort them so that the list can be easily compared for changes
|
||||||
|
}).OrderBy(i => i.Path).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetExtraTypeFromFilename(Video item)
|
||||||
|
{
|
||||||
|
var name = System.IO.Path.GetFileNameWithoutExtension(item.Path) ?? string.Empty;
|
||||||
|
|
||||||
|
foreach (var suffix in BaseItem.ExtraSuffixes)
|
||||||
|
{
|
||||||
|
if (name.EndsWith(suffix.Key, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item.ExtraType = suffix.Value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
item.ExtraType = ExtraType.Clip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _libraryManager.ValidateArtists(cancellationToken, progress);
|
return ((LibraryManager)_libraryManager).ValidateArtists(cancellationToken, progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _libraryManager.ValidateGameGenres(cancellationToken, progress);
|
return ((LibraryManager)_libraryManager).ValidateGameGenres(cancellationToken, progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _libraryManager.ValidateGenres(cancellationToken, progress);
|
return ((LibraryManager)_libraryManager).ValidateGenres(cancellationToken, progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _libraryManager.ValidateMusicGenres(cancellationToken, progress);
|
return ((LibraryManager)_libraryManager).ValidateMusicGenres(cancellationToken, progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _libraryManager.ValidateStudios(cancellationToken, progress);
|
return ((LibraryManager)_libraryManager).ValidateStudios(cancellationToken, progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user