mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
updated nuget
This commit is contained in:
parent
c48458f215
commit
56f6b0335c
@ -37,12 +37,6 @@ namespace MediaBrowser.Api
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/Trailer", "POST")]
|
|
||||||
[Authenticated]
|
|
||||||
public class GetTrailerRemoteSearchResults : RemoteSearchQuery<TrailerInfo>, IReturn<List<RemoteSearchResult>>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/AdultVideo", "POST")]
|
[Route("/Items/RemoteSearch/AdultVideo", "POST")]
|
||||||
[Authenticated]
|
[Authenticated]
|
||||||
public class GetAdultVideoRemoteSearchResults : RemoteSearchQuery<ItemLookupInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetAdultVideoRemoteSearchResults : RemoteSearchQuery<ItemLookupInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
@ -162,13 +156,6 @@ namespace MediaBrowser.Api
|
|||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Post(GetTrailerRemoteSearchResults request)
|
|
||||||
{
|
|
||||||
var result = _providerManager.GetRemoteSearchResults<Trailer, TrailerInfo>(request, CancellationToken.None).Result;
|
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Post(GetMusicAlbumRemoteSearchResults request)
|
public object Post(GetMusicAlbumRemoteSearchResults request)
|
||||||
{
|
{
|
||||||
var result = _providerManager.GetRemoteSearchResults<MusicAlbum, AlbumInfo>(request, CancellationToken.None).Result;
|
var result = _providerManager.GetRemoteSearchResults<MusicAlbum, AlbumInfo>(request, CancellationToken.None).Result;
|
||||||
|
@ -92,7 +92,7 @@ namespace MediaBrowser.Api.Movies
|
|||||||
Logger,
|
Logger,
|
||||||
|
|
||||||
// Strip out secondary versions
|
// Strip out secondary versions
|
||||||
request, item => (item is Movie || item is Trailer) && !((Video)item).PrimaryVersionId.HasValue,
|
request, item => (item is Movie) && !((Video)item).PrimaryVersionId.HasValue,
|
||||||
|
|
||||||
SimilarItemsHelper.GetSimiliarityScore);
|
SimilarItemsHelper.GetSimiliarityScore);
|
||||||
|
|
||||||
|
@ -173,9 +173,10 @@ namespace MediaBrowser.Api
|
|||||||
public object Get(GetPackage request)
|
public object Get(GetPackage request)
|
||||||
{
|
{
|
||||||
var packages = _installationManager.GetAvailablePackages(CancellationToken.None, applicationVersion: _appHost.ApplicationVersion).Result;
|
var packages = _installationManager.GetAvailablePackages(CancellationToken.None, applicationVersion: _appHost.ApplicationVersion).Result;
|
||||||
|
var list = packages.ToList();
|
||||||
|
|
||||||
var result = packages.FirstOrDefault(p => string.Equals(p.guid, request.AssemblyGuid ?? "none", StringComparison.OrdinalIgnoreCase))
|
var result = list.FirstOrDefault(p => string.Equals(p.guid, request.AssemblyGuid ?? "none", StringComparison.OrdinalIgnoreCase))
|
||||||
?? packages.FirstOrDefault(p => p.name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));
|
?? list.FirstOrDefault(p => p.name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
}
|
}
|
||||||
|
@ -24,14 +24,28 @@ namespace MediaBrowser.Common.Implementations.Networking
|
|||||||
/// <returns>IPAddress.</returns>
|
/// <returns>IPAddress.</returns>
|
||||||
public IEnumerable<string> GetLocalIpAddresses()
|
public IEnumerable<string> GetLocalIpAddresses()
|
||||||
{
|
{
|
||||||
var list = GetIPsDefault().Where(i => !IPAddress.IsLoopback(i)).Select(i => i.ToString()).ToList();
|
var list = GetIPsDefault()
|
||||||
|
.Where(i => !IPAddress.IsLoopback(i))
|
||||||
|
.Select(i => i.ToString())
|
||||||
|
.Where(FilterIpAddress)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetLocalIpAddressesFallback();
|
return GetLocalIpAddressesFallback().Where(FilterIpAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool FilterIpAddress(string address)
|
||||||
|
{
|
||||||
|
if (address.StartsWith("169.", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsInPrivateAddressSpace(string endpoint)
|
private bool IsInPrivateAddressSpace(string endpoint)
|
||||||
|
@ -893,6 +893,28 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return Id.ToString();
|
return Id.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal virtual bool IsValidFromResolver(BaseItem newItem)
|
||||||
|
{
|
||||||
|
var current = this;
|
||||||
|
|
||||||
|
var currentAsPlaceHolder = current as ISupportsPlaceHolders;
|
||||||
|
|
||||||
|
if (currentAsPlaceHolder != null)
|
||||||
|
{
|
||||||
|
var newHasPlaceHolder = newItem as ISupportsPlaceHolders;
|
||||||
|
|
||||||
|
if (newHasPlaceHolder != null)
|
||||||
|
{
|
||||||
|
if (currentAsPlaceHolder.IsPlaceHolder != newHasPlaceHolder.IsPlaceHolder)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return current.IsInMixedFolder == newItem.IsInMixedFolder;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the preferred metadata language.
|
/// Gets the preferred metadata language.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1726,5 +1748,34 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Task RefreshMetadataForOwnedVideo(MetadataRefreshOptions options, string path, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var newOptions = new MetadataRefreshOptions(options.DirectoryService)
|
||||||
|
{
|
||||||
|
ImageRefreshMode = options.ImageRefreshMode,
|
||||||
|
MetadataRefreshMode = options.MetadataRefreshMode,
|
||||||
|
ReplaceAllMetadata = options.ReplaceAllMetadata
|
||||||
|
};
|
||||||
|
|
||||||
|
var id = LibraryManager.GetNewItemId(path, typeof(Video));
|
||||||
|
|
||||||
|
// Try to retrieve it from the db. If we don't find it, use the resolved version
|
||||||
|
var video = LibraryManager.GetItemById(id) as Video;
|
||||||
|
|
||||||
|
if (video == null)
|
||||||
|
{
|
||||||
|
video = LibraryManager.ResolvePath(new FileInfo(path)) as Video;
|
||||||
|
|
||||||
|
newOptions.ForceSave = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (video == null)
|
||||||
|
{
|
||||||
|
return Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return video.RefreshMetadata(newOptions, cancellationToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,47 +363,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
private bool IsValidFromResolver(BaseItem current, BaseItem newItem)
|
private bool IsValidFromResolver(BaseItem current, BaseItem newItem)
|
||||||
{
|
{
|
||||||
var currentAsVideo = current as Video;
|
return current.IsValidFromResolver(newItem);
|
||||||
|
|
||||||
if (currentAsVideo != null)
|
|
||||||
{
|
|
||||||
var newAsVideo = newItem as Video;
|
|
||||||
|
|
||||||
if (newAsVideo != null)
|
|
||||||
{
|
|
||||||
if (currentAsVideo.IsPlaceHolder != newAsVideo.IsPlaceHolder)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (currentAsVideo.IsMultiPart != newAsVideo.IsMultiPart)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (currentAsVideo.HasLocalAlternateVersions != newAsVideo.HasLocalAlternateVersions)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var currentAsPlaceHolder = current as ISupportsPlaceHolders;
|
|
||||||
|
|
||||||
if (currentAsPlaceHolder != null)
|
|
||||||
{
|
|
||||||
var newHasPlaceHolder = newItem as ISupportsPlaceHolders;
|
|
||||||
|
|
||||||
if (newHasPlaceHolder != null)
|
|
||||||
{
|
|
||||||
if (currentAsPlaceHolder.IsPlaceHolder != newHasPlaceHolder.IsPlaceHolder)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return current.IsInMixedFolder == newItem.IsInMixedFolder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -12,6 +12,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Trailer
|
/// Class Trailer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete]
|
||||||
public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasMetascore, IHasLookupInfo<TrailerInfo>
|
public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasMetascore, IHasLookupInfo<TrailerInfo>
|
||||||
{
|
{
|
||||||
public List<Guid> SoundtrackIds { get; set; }
|
public List<Guid> SoundtrackIds { get; set; }
|
||||||
|
@ -63,8 +63,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
CollectionType.Books,
|
CollectionType.Books,
|
||||||
CollectionType.HomeVideos,
|
CollectionType.HomeVideos,
|
||||||
CollectionType.Photos,
|
CollectionType.Photos
|
||||||
CollectionType.Trailers
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var collectionFolder = folder as ICollectionFolder;
|
var collectionFolder = folder as ICollectionFolder;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
@ -28,12 +27,11 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
IHasPreferredMetadataLanguage,
|
IHasPreferredMetadataLanguage,
|
||||||
IThemeMedia
|
IThemeMedia
|
||||||
{
|
{
|
||||||
public bool IsMultiPart { get; set; }
|
|
||||||
public bool HasLocalAlternateVersions { get; set; }
|
|
||||||
public Guid? PrimaryVersionId { get; set; }
|
public Guid? PrimaryVersionId { get; set; }
|
||||||
|
|
||||||
public List<Guid> AdditionalPartIds { get; set; }
|
public List<string> AdditionalParts { get; set; }
|
||||||
public List<Guid> LocalAlternateVersionIds { get; set; }
|
public List<string> LocalAlternateVersions { get; set; }
|
||||||
|
public List<LinkedChild> LinkedAlternateVersions { get; set; }
|
||||||
|
|
||||||
public bool IsThemeMedia { get; set; }
|
public bool IsThemeMedia { get; set; }
|
||||||
|
|
||||||
@ -60,8 +58,8 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
public Video()
|
public Video()
|
||||||
{
|
{
|
||||||
PlayableStreamFileNames = new List<string>();
|
PlayableStreamFileNames = new List<string>();
|
||||||
AdditionalPartIds = new List<Guid>();
|
AdditionalParts = new List<string>();
|
||||||
LocalAlternateVersionIds = new List<Guid>();
|
LocalAlternateVersions = new List<string>();
|
||||||
Tags = new List<string>();
|
Tags = new List<string>();
|
||||||
SubtitleFiles = new List<string>();
|
SubtitleFiles = new List<string>();
|
||||||
LinkedAlternateVersions = new List<LinkedChild>();
|
LinkedAlternateVersions = new List<LinkedChild>();
|
||||||
@ -78,11 +76,31 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return LinkedAlternateVersions.Count + LocalAlternateVersionIds.Count + 1;
|
return LinkedAlternateVersions.Count + LocalAlternateVersions.Count + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LinkedChild> LinkedAlternateVersions { get; set; }
|
[IgnoreDataMember]
|
||||||
|
public bool IsStacked
|
||||||
|
{
|
||||||
|
get { return AdditionalParts.Count > 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public bool HasLocalAlternateVersions
|
||||||
|
{
|
||||||
|
get { return LocalAlternateVersions.Count > 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Guid> GetAdditionalPartIds()
|
||||||
|
{
|
||||||
|
return AdditionalParts.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Guid> GetLocalAlternateVersionIds()
|
||||||
|
{
|
||||||
|
return LocalAlternateVersions.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the linked children.
|
/// Gets the linked children.
|
||||||
@ -90,7 +108,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
public IEnumerable<Video> GetAlternateVersions()
|
public IEnumerable<Video> GetAlternateVersions()
|
||||||
{
|
{
|
||||||
var filesWithinSameDirectory = LocalAlternateVersionIds
|
var filesWithinSameDirectory = GetLocalAlternateVersionIds()
|
||||||
.Select(i => LibraryManager.GetItemById(i))
|
.Select(i => LibraryManager.GetItemById(i))
|
||||||
.Where(i => i != null)
|
.Where(i => i != null)
|
||||||
.OfType<Video>();
|
.OfType<Video>();
|
||||||
@ -116,7 +134,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// <returns>IEnumerable{Video}.</returns>
|
/// <returns>IEnumerable{Video}.</returns>
|
||||||
public IEnumerable<Video> GetAdditionalParts()
|
public IEnumerable<Video> GetAdditionalParts()
|
||||||
{
|
{
|
||||||
return AdditionalPartIds
|
return GetAdditionalPartIds()
|
||||||
.Select(i => LibraryManager.GetItemById(i))
|
.Select(i => LibraryManager.GetItemById(i))
|
||||||
.Where(i => i != null)
|
.Where(i => i != null)
|
||||||
.OfType<Video>()
|
.OfType<Video>()
|
||||||
@ -200,7 +218,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (IsMultiPart)
|
if (IsStacked)
|
||||||
{
|
{
|
||||||
return System.IO.Path.GetDirectoryName(Path);
|
return System.IO.Path.GetDirectoryName(Path);
|
||||||
}
|
}
|
||||||
@ -218,6 +236,27 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal override bool IsValidFromResolver(BaseItem newItem)
|
||||||
|
{
|
||||||
|
var current = this;
|
||||||
|
|
||||||
|
var newAsVideo = newItem as Video;
|
||||||
|
|
||||||
|
if (newAsVideo != null)
|
||||||
|
{
|
||||||
|
if (!current.AdditionalParts.SequenceEqual(newAsVideo.AdditionalParts, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!current.LocalAlternateVersions.SequenceEqual(newAsVideo.LocalAlternateVersions, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.IsValidFromResolver(newItem);
|
||||||
|
}
|
||||||
|
|
||||||
public string MainFeaturePlaylistName { get; set; }
|
public string MainFeaturePlaylistName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -263,37 +302,34 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
var hasChanges = await base.RefreshedOwnedItems(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
var hasChanges = await base.RefreshedOwnedItems(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (IsStacked)
|
||||||
|
{
|
||||||
|
var tasks = AdditionalParts
|
||||||
|
.Select(i => RefreshMetadataForOwnedVideo(options, i, cancellationToken));
|
||||||
|
|
||||||
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Must have a parent to have additional parts or alternate versions
|
// Must have a parent to have additional parts or alternate versions
|
||||||
// In other words, it must be part of the Parent/Child tree
|
// In other words, it must be part of the Parent/Child tree
|
||||||
// The additional parts won't have additional parts themselves
|
// The additional parts won't have additional parts themselves
|
||||||
if (LocationType == LocationType.FileSystem && Parent != null)
|
if (LocationType == LocationType.FileSystem && Parent != null)
|
||||||
{
|
{
|
||||||
if (IsMultiPart)
|
if (!IsStacked)
|
||||||
{
|
|
||||||
var additionalPartsChanged = await RefreshAdditionalParts(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
|
||||||
|
|
||||||
if (additionalPartsChanged)
|
|
||||||
{
|
|
||||||
hasChanges = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
RefreshLinkedAlternateVersions();
|
RefreshLinkedAlternateVersions();
|
||||||
|
|
||||||
var additionalPartsChanged = await RefreshAlternateVersionsWithinSameDirectory(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
var tasks = LocalAlternateVersions
|
||||||
|
.Select(i => RefreshMetadataForOwnedVideo(options, i, cancellationToken));
|
||||||
|
|
||||||
if (additionalPartsChanged)
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
{
|
|
||||||
hasChanges = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasChanges;
|
return hasChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool RefreshLinkedAlternateVersions()
|
private void RefreshLinkedAlternateVersions()
|
||||||
{
|
{
|
||||||
foreach (var child in LinkedAlternateVersions)
|
foreach (var child in LinkedAlternateVersions)
|
||||||
{
|
{
|
||||||
@ -303,111 +339,13 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
child.ItemId = null;
|
child.ItemId = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Refreshes the additional parts.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="options">The options.</param>
|
|
||||||
/// <param name="fileSystemChildren">The file system children.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task{System.Boolean}.</returns>
|
|
||||||
private async Task<bool> RefreshAdditionalParts(MetadataRefreshOptions options, IEnumerable<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var newItems = LoadAdditionalParts(fileSystemChildren, options.DirectoryService).ToList();
|
|
||||||
|
|
||||||
var newItemIds = newItems.Select(i => i.Id).ToList();
|
|
||||||
|
|
||||||
var itemsChanged = !AdditionalPartIds.SequenceEqual(newItemIds);
|
|
||||||
|
|
||||||
var tasks = newItems.Select(i => i.RefreshMetadata(options, cancellationToken));
|
|
||||||
|
|
||||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
|
||||||
|
|
||||||
AdditionalPartIds = newItemIds;
|
|
||||||
|
|
||||||
return itemsChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Loads the additional parts.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>IEnumerable{Video}.</returns>
|
|
||||||
private IEnumerable<Video> LoadAdditionalParts(IEnumerable<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
|
||||||
{
|
|
||||||
var files = LibraryManager.GetAdditionalParts(Path, VideoType, fileSystemChildren);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return video;
|
|
||||||
|
|
||||||
// Sort them so that the list can be easily compared for changes
|
|
||||||
}).OrderBy(i => i.Path).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<bool> RefreshAlternateVersionsWithinSameDirectory(MetadataRefreshOptions options, IEnumerable<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var newItems = HasLocalAlternateVersions ?
|
|
||||||
LoadAlternateVersionsWithinSameDirectory(fileSystemChildren, options.DirectoryService).ToList() :
|
|
||||||
new List<Video>();
|
|
||||||
|
|
||||||
var newItemIds = newItems.Select(i => i.Id).ToList();
|
|
||||||
|
|
||||||
var itemsChanged = !LocalAlternateVersionIds.SequenceEqual(newItemIds);
|
|
||||||
|
|
||||||
var tasks = newItems.Select(i => RefreshAlternateVersion(options, i, cancellationToken));
|
|
||||||
|
|
||||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
|
||||||
|
|
||||||
LocalAlternateVersionIds = newItemIds;
|
|
||||||
|
|
||||||
return itemsChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task RefreshAlternateVersion(MetadataRefreshOptions options, Video video, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var currentImagePath = video.GetImagePath(ImageType.Primary);
|
|
||||||
var ownerImagePath = this.GetImagePath(ImageType.Primary);
|
|
||||||
|
|
||||||
var newOptions = new MetadataRefreshOptions(options.DirectoryService)
|
|
||||||
{
|
|
||||||
ImageRefreshMode = options.ImageRefreshMode,
|
|
||||||
MetadataRefreshMode = options.MetadataRefreshMode,
|
|
||||||
ReplaceAllMetadata = options.ReplaceAllMetadata
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!string.Equals(currentImagePath, ownerImagePath, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
newOptions.ForceSave = true;
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(ownerImagePath))
|
|
||||||
{
|
|
||||||
video.ImageInfos.Clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
video.SetImagePath(ImageType.Primary, ownerImagePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return video.RefreshMetadata(newOptions, cancellationToken);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
|
public override async Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await base.UpdateToRepository(updateReason, cancellationToken).ConfigureAwait(false);
|
await base.UpdateToRepository(updateReason, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
foreach (var item in LocalAlternateVersionIds.Select(i => LibraryManager.GetItemById(i)))
|
foreach (var item in GetLocalAlternateVersionIds().Select(i => LibraryManager.GetItemById(i)))
|
||||||
{
|
{
|
||||||
item.ImageInfos = ImageInfos;
|
item.ImageInfos = ImageInfos;
|
||||||
item.Overview = Overview;
|
item.Overview = Overview;
|
||||||
@ -422,56 +360,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Loads the additional parts.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>IEnumerable{Video}.</returns>
|
|
||||||
private IEnumerable<Video> LoadAlternateVersionsWithinSameDirectory(IEnumerable<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
|
||||||
{
|
|
||||||
IEnumerable<FileSystemInfo> files;
|
|
||||||
|
|
||||||
// Only support this for video files. For folder rips, they'll have to use the linking feature
|
|
||||||
if (VideoType == VideoType.VideoFile || VideoType == VideoType.Iso)
|
|
||||||
{
|
|
||||||
var path = Path;
|
|
||||||
|
|
||||||
var filenamePrefix = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(path));
|
|
||||||
|
|
||||||
files = fileSystemChildren.Where(i =>
|
|
||||||
{
|
|
||||||
if ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !string.Equals(i.FullName, path, StringComparison.OrdinalIgnoreCase) &&
|
|
||||||
LibraryManager.IsVideoFile(i.FullName) &&
|
|
||||||
i.Name.StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
files = new List<FileSystemInfo>();
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
video.PrimaryVersionId = Id;
|
|
||||||
|
|
||||||
return video;
|
|
||||||
|
|
||||||
// Sort them so that the list can be easily compared for changes
|
|
||||||
}).OrderBy(i => i.Path).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IEnumerable<string> GetDeletePaths()
|
public override IEnumerable<string> GetDeletePaths()
|
||||||
{
|
{
|
||||||
if (!IsInMixedFolder)
|
if (!IsInMixedFolder)
|
||||||
|
@ -364,17 +364,6 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <returns>ItemInfo.</returns>
|
/// <returns>ItemInfo.</returns>
|
||||||
ItemLookupInfo ParseName(string name);
|
ItemLookupInfo ParseName(string name);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the additional parts.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="file">The file.</param>
|
|
||||||
/// <param name="type">The type.</param>
|
|
||||||
/// <param name="files">The files.</param>
|
|
||||||
/// <returns>IEnumerable<System.String>.</returns>
|
|
||||||
IEnumerable<FileSystemInfo> GetAdditionalParts(string file,
|
|
||||||
VideoType type,
|
|
||||||
IEnumerable<FileSystemInfo> files);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the new item identifier.
|
/// Gets the new item identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -390,7 +379,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <param name="fileSystemChildren">The file system children.</param>
|
/// <param name="fileSystemChildren">The file system children.</param>
|
||||||
/// <param name="directoryService">The directory service.</param>
|
/// <param name="directoryService">The directory service.</param>
|
||||||
/// <returns>IEnumerable<Trailer>.</returns>
|
/// <returns>IEnumerable<Trailer>.</returns>
|
||||||
IEnumerable<Trailer> FindTrailers(BaseItem owner, List<FileSystemInfo> fileSystemChildren,
|
IEnumerable<Video> FindTrailers(BaseItem owner, List<FileSystemInfo> fileSystemChildren,
|
||||||
IDirectoryService directoryService);
|
IDirectoryService directoryService);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -72,7 +72,6 @@
|
|||||||
<Compile Include="Providers\PlaylistXmlProvider.cs" />
|
<Compile Include="Providers\PlaylistXmlProvider.cs" />
|
||||||
<Compile Include="Providers\SeasonXmlProvider.cs" />
|
<Compile Include="Providers\SeasonXmlProvider.cs" />
|
||||||
<Compile Include="Providers\SeriesXmlProvider.cs" />
|
<Compile Include="Providers\SeriesXmlProvider.cs" />
|
||||||
<Compile Include="Providers\TrailerXmlProvider.cs" />
|
|
||||||
<Compile Include="Providers\VideoXmlProvider.cs" />
|
<Compile Include="Providers\VideoXmlProvider.cs" />
|
||||||
<Compile Include="Savers\BoxSetXmlSaver.cs" />
|
<Compile Include="Savers\BoxSetXmlSaver.cs" />
|
||||||
<Compile Include="Savers\ChannelXmlSaver.cs" />
|
<Compile Include="Savers\ChannelXmlSaver.cs" />
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
|
||||||
using MediaBrowser.LocalMetadata.Parsers;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Providers
|
|
||||||
{
|
|
||||||
public class TrailerXmlProvider : BaseXmlProvider<Trailer>
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
public TrailerXmlProvider(IFileSystem fileSystem, ILogger logger)
|
|
||||||
: base(fileSystem)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Trailer> result, string path, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var chapters = new List<ChapterInfo>();
|
|
||||||
|
|
||||||
new MovieXmlParser(_logger).Fetch(result.Item, chapters, path, cancellationToken);
|
|
||||||
|
|
||||||
result.Chapters = chapters;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
|
||||||
{
|
|
||||||
return MovieXmlProvider.GetXmlFileInfo(info, FileSystem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,7 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
public enum ConnectionMode
|
public enum ConnectionMode
|
||||||
{
|
{
|
||||||
Local = 1,
|
Local = 1,
|
||||||
Remote = 2
|
Remote = 2,
|
||||||
|
Manual = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -413,7 +413,7 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query">The query.</param>
|
/// <param name="query">The query.</param>
|
||||||
/// <returns>Task{ItemsResult}.</returns>
|
/// <returns>Task{ItemsResult}.</returns>
|
||||||
Task<ItemsResult> GetUpcomingEpisodesAsync(NextUpQuery query);
|
Task<ItemsResult> GetUpcomingEpisodesAsync(UpcomingEpisodesQuery query);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a genre
|
/// Gets a genre
|
||||||
|
@ -50,10 +50,14 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
{
|
{
|
||||||
existing.RemoteAddress = server.RemoteAddress;
|
existing.RemoteAddress = server.RemoteAddress;
|
||||||
}
|
}
|
||||||
if (!existing.IsLocalAddressFixed && !string.IsNullOrEmpty(server.LocalAddress))
|
if (!string.IsNullOrEmpty(server.LocalAddress))
|
||||||
{
|
{
|
||||||
existing.LocalAddress = server.LocalAddress;
|
existing.LocalAddress = server.LocalAddress;
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrEmpty(server.ManualAddress))
|
||||||
|
{
|
||||||
|
existing.LocalAddress = server.ManualAddress;
|
||||||
|
}
|
||||||
if (!string.IsNullOrEmpty(server.Name))
|
if (!string.IsNullOrEmpty(server.Name))
|
||||||
{
|
{
|
||||||
existing.Name = server.Name;
|
existing.Name = server.Name;
|
||||||
@ -62,9 +66,9 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
{
|
{
|
||||||
existing.WakeOnLanInfos = server.WakeOnLanInfos.ToList();
|
existing.WakeOnLanInfos = server.WakeOnLanInfos.ToList();
|
||||||
}
|
}
|
||||||
if (server.IsLocalAddressFixed)
|
if (server.LastConnectionMode.HasValue)
|
||||||
{
|
{
|
||||||
existing.IsLocalAddressFixed = true;
|
existing.LastConnectionMode = server.LastConnectionMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -18,5 +18,10 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the endpoint address.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The endpoint address.</value>
|
||||||
|
public string EndpointAddress { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,14 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
public String Id { get; set; }
|
public String Id { get; set; }
|
||||||
public String LocalAddress { get; set; }
|
public String LocalAddress { get; set; }
|
||||||
public String RemoteAddress { get; set; }
|
public String RemoteAddress { get; set; }
|
||||||
|
public String ManualAddress { get; set; }
|
||||||
public String UserId { get; set; }
|
public String UserId { get; set; }
|
||||||
public String AccessToken { get; set; }
|
public String AccessToken { get; set; }
|
||||||
public List<WakeOnLanInfo> WakeOnLanInfos { get; set; }
|
public List<WakeOnLanInfo> WakeOnLanInfos { get; set; }
|
||||||
public DateTime DateLastAccessed { get; set; }
|
public DateTime DateLastAccessed { get; set; }
|
||||||
public String ExchangeToken { get; set; }
|
public String ExchangeToken { get; set; }
|
||||||
public UserLinkType? UserLinkType { get; set; }
|
public UserLinkType? UserLinkType { get; set; }
|
||||||
|
public ConnectionMode? LastConnectionMode { get; set; }
|
||||||
public bool IsLocalAddressFixed { get; set; }
|
|
||||||
|
|
||||||
public ServerInfo()
|
public ServerInfo()
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
Name = systemInfo.ServerName;
|
Name = systemInfo.ServerName;
|
||||||
Id = systemInfo.Id;
|
Id = systemInfo.Id;
|
||||||
|
|
||||||
if (!IsLocalAddressFixed && !string.IsNullOrEmpty(systemInfo.LocalAddress))
|
if (!string.IsNullOrEmpty(systemInfo.LocalAddress))
|
||||||
{
|
{
|
||||||
LocalAddress = systemInfo.LocalAddress;
|
LocalAddress = systemInfo.LocalAddress;
|
||||||
}
|
}
|
||||||
@ -55,5 +55,20 @@ namespace MediaBrowser.Model.ApiClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetAddress(ConnectionMode mode)
|
||||||
|
{
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case ConnectionMode.Local:
|
||||||
|
return LocalAddress;
|
||||||
|
case ConnectionMode.Manual:
|
||||||
|
return ManualAddress;
|
||||||
|
case ConnectionMode.Remote:
|
||||||
|
return RemoteAddress;
|
||||||
|
default:
|
||||||
|
throw new ArgumentException("Unexpected ConnectionMode");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -708,11 +708,6 @@ namespace MediaBrowser.Model.Dto
|
|||||||
/// <value>The game count.</value>
|
/// <value>The game count.</value>
|
||||||
public int? GameCount { get; set; }
|
public int? GameCount { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the trailer count.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The trailer count.</value>
|
|
||||||
public int? TrailerCount { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the song count.
|
/// Gets or sets the song count.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The song count.</value>
|
/// <value>The song count.</value>
|
||||||
|
@ -116,11 +116,6 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
ParentId,
|
ParentId,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The part count
|
|
||||||
/// </summary>
|
|
||||||
PartCount,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The physical path of the item
|
/// The physical path of the item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -285,7 +285,7 @@ namespace MediaBrowser.Model.Querying
|
|||||||
|
|
||||||
public bool? EnableImages { get; set; }
|
public bool? EnableImages { get; set; }
|
||||||
public int? ImageTypeLimit { get; set; }
|
public int? ImageTypeLimit { get; set; }
|
||||||
public string EnableImageTypes { get; set; }
|
public ImageType[] EnableImageTypes { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ItemQuery" /> class.
|
/// Initializes a new instance of the <see cref="ItemQuery" /> class.
|
||||||
@ -297,13 +297,13 @@ namespace MediaBrowser.Model.Querying
|
|||||||
|
|
||||||
SortBy = new string[] { };
|
SortBy = new string[] { };
|
||||||
|
|
||||||
Filters = new ItemFilter[] {};
|
Filters = new ItemFilter[] { };
|
||||||
|
|
||||||
Fields = new ItemFields[] {};
|
Fields = new ItemFields[] { };
|
||||||
|
|
||||||
MediaTypes = new string[] {};
|
MediaTypes = new string[] { };
|
||||||
|
|
||||||
VideoTypes = new VideoType[] {};
|
VideoTypes = new VideoType[] { };
|
||||||
|
|
||||||
Genres = new string[] { };
|
Genres = new string[] { };
|
||||||
Studios = new string[] { };
|
Studios = new string[] { };
|
||||||
@ -317,6 +317,7 @@ namespace MediaBrowser.Model.Querying
|
|||||||
ImageTypes = new ImageType[] { };
|
ImageTypes = new ImageType[] { };
|
||||||
AirDays = new DayOfWeek[] { };
|
AirDays = new DayOfWeek[] { };
|
||||||
SeriesStatuses = new SeriesStatus[] { };
|
SeriesStatuses = new SeriesStatus[] { };
|
||||||
|
EnableImageTypes = new ImageType[] { };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// Gets or sets the enable image types.
|
/// Gets or sets the enable image types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The enable image types.</value>
|
/// <value>The enable image types.</value>
|
||||||
public string EnableImageTypes { get; set; }
|
public ImageType[] EnableImageTypes { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ItemsByNameQuery" /> class.
|
/// Initializes a new instance of the <see cref="ItemsByNameQuery" /> class.
|
||||||
@ -130,6 +130,7 @@ namespace MediaBrowser.Model.Querying
|
|||||||
SortBy = new string[] { };
|
SortBy = new string[] { };
|
||||||
ExcludeItemTypes = new string[] { };
|
ExcludeItemTypes = new string[] { };
|
||||||
IncludeItemTypes = new string[] { };
|
IncludeItemTypes = new string[] { };
|
||||||
|
EnableImageTypes = new ImageType[] { };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Querying
|
namespace MediaBrowser.Model.Querying
|
||||||
{
|
{
|
||||||
public class LatestItemsQuery
|
public class LatestItemsQuery
|
||||||
@ -64,6 +66,11 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// Gets or sets the enable image types.
|
/// Gets or sets the enable image types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The enable image types.</value>
|
/// <value>The enable image types.</value>
|
||||||
public string EnableImageTypes { get; set; }
|
public ImageType[] EnableImageTypes { get; set; }
|
||||||
|
|
||||||
|
public LatestItemsQuery()
|
||||||
|
{
|
||||||
|
EnableImageTypes = new ImageType[] {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Querying
|
namespace MediaBrowser.Model.Querying
|
||||||
{
|
{
|
||||||
public class NextUpQuery
|
public class NextUpQuery
|
||||||
@ -52,7 +53,11 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// Gets or sets the enable image types.
|
/// Gets or sets the enable image types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The enable image types.</value>
|
/// <value>The enable image types.</value>
|
||||||
public string EnableImageTypes { get; set; }
|
public ImageType[] EnableImageTypes { get; set; }
|
||||||
|
|
||||||
|
public NextUpQuery()
|
||||||
|
{
|
||||||
|
EnableImageTypes = new ImageType[] {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace MediaBrowser.Model.Querying
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.Querying
|
||||||
{
|
{
|
||||||
public class UpcomingEpisodesQuery
|
public class UpcomingEpisodesQuery
|
||||||
{
|
{
|
||||||
@ -45,6 +47,11 @@
|
|||||||
/// Gets or sets the enable image types.
|
/// Gets or sets the enable image types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The enable image types.</value>
|
/// <value>The enable image types.</value>
|
||||||
public string EnableImageTypes { get; set; }
|
public ImageType[] EnableImageTypes { get; set; }
|
||||||
|
|
||||||
|
public UpcomingEpisodesQuery()
|
||||||
|
{
|
||||||
|
EnableImageTypes = new ImageType[] {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -437,7 +437,6 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
GetPluginSummary<Game>(),
|
GetPluginSummary<Game>(),
|
||||||
GetPluginSummary<GameSystem>(),
|
GetPluginSummary<GameSystem>(),
|
||||||
GetPluginSummary<Movie>(),
|
GetPluginSummary<Movie>(),
|
||||||
GetPluginSummary<Trailer>(),
|
|
||||||
GetPluginSummary<BoxSet>(),
|
GetPluginSummary<BoxSet>(),
|
||||||
GetPluginSummary<Book>(),
|
GetPluginSummary<Book>(),
|
||||||
GetPluginSummary<Series>(),
|
GetPluginSummary<Series>(),
|
||||||
|
@ -110,7 +110,6 @@
|
|||||||
<Compile Include="MediaInfo\SubtitleScheduledTask.cs" />
|
<Compile Include="MediaInfo\SubtitleScheduledTask.cs" />
|
||||||
<Compile Include="Movies\MovieDbTrailerProvider.cs" />
|
<Compile Include="Movies\MovieDbTrailerProvider.cs" />
|
||||||
<Compile Include="Movies\MovieExternalIds.cs" />
|
<Compile Include="Movies\MovieExternalIds.cs" />
|
||||||
<Compile Include="Movies\TrailerMetadataService.cs" />
|
|
||||||
<Compile Include="Movies\GenericMovieDbInfo.cs" />
|
<Compile Include="Movies\GenericMovieDbInfo.cs" />
|
||||||
<Compile Include="Movies\MovieDbSearch.cs" />
|
<Compile Include="Movies\MovieDbSearch.cs" />
|
||||||
<Compile Include="Movies\MovieMetadataService.cs" />
|
<Compile Include="Movies\MovieMetadataService.cs" />
|
||||||
|
@ -31,7 +31,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
ICustomMetadataProvider<Movie>,
|
ICustomMetadataProvider<Movie>,
|
||||||
ICustomMetadataProvider<LiveTvVideoRecording>,
|
ICustomMetadataProvider<LiveTvVideoRecording>,
|
||||||
ICustomMetadataProvider<LiveTvAudioRecording>,
|
ICustomMetadataProvider<LiveTvAudioRecording>,
|
||||||
ICustomMetadataProvider<Trailer>,
|
|
||||||
ICustomMetadataProvider<Video>,
|
ICustomMetadataProvider<Video>,
|
||||||
ICustomMetadataProvider<Audio>,
|
ICustomMetadataProvider<Audio>,
|
||||||
IHasItemChangeMonitor,
|
IHasItemChangeMonitor,
|
||||||
@ -77,11 +76,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
return FetchVideoInfo(item, options, cancellationToken);
|
return FetchVideoInfo(item, options, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ItemUpdateType> FetchAsync(Trailer item, MetadataRefreshOptions options, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
return FetchVideoInfo(item, options, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<ItemUpdateType> FetchAsync(Video item, MetadataRefreshOptions options, CancellationToken cancellationToken)
|
public Task<ItemUpdateType> FetchAsync(Video item, MetadataRefreshOptions options, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return FetchVideoInfo(item, options, cancellationToken);
|
return FetchVideoInfo(item, options, cancellationToken);
|
||||||
|
@ -57,13 +57,6 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
public bool Supports(IHasImages item)
|
public bool Supports(IHasImages item)
|
||||||
{
|
{
|
||||||
var trailer = item as Trailer;
|
|
||||||
|
|
||||||
if (trailer != null)
|
|
||||||
{
|
|
||||||
return !trailer.IsLocalTrailer;
|
|
||||||
}
|
|
||||||
|
|
||||||
return item is Movie || item is BoxSet || item is MusicVideo;
|
return item is Movie || item is BoxSet || item is MusicVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,13 +40,6 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
public bool Supports(IHasImages item)
|
public bool Supports(IHasImages item)
|
||||||
{
|
{
|
||||||
var trailer = item as Trailer;
|
|
||||||
|
|
||||||
if (trailer != null)
|
|
||||||
{
|
|
||||||
return !trailer.IsLocalTrailer;
|
|
||||||
}
|
|
||||||
|
|
||||||
var channelItem = item as ChannelVideoItem;
|
var channelItem = item as ChannelVideoItem;
|
||||||
|
|
||||||
if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.MovieExtra && channelItem.ExtraType == ExtraType.Trailer)
|
if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.MovieExtra && channelItem.ExtraType == ExtraType.Trailer)
|
||||||
|
@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace MediaBrowser.Providers.Movies
|
namespace MediaBrowser.Providers.Movies
|
||||||
{
|
{
|
||||||
public class MovieDbTrailerProvider : IRemoteMetadataProvider<Trailer, TrailerInfo>, IHasOrder, IRemoteMetadataProvider<ChannelVideoItem, ChannelItemLookupInfo>
|
public class MovieDbTrailerProvider : IHasOrder, IRemoteMetadataProvider<ChannelVideoItem, ChannelItemLookupInfo>
|
||||||
{
|
{
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
|
|
||||||
@ -21,11 +21,6 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<MetadataResult<Trailer>> GetMetadata(TrailerInfo info, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
return MovieDbProvider.Current.GetItemMetadata<Trailer>(info, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(TrailerInfo searchInfo, CancellationToken cancellationToken)
|
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(TrailerInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return MovieDbProvider.Current.GetMovieSearchResults(searchInfo, cancellationToken);
|
return MovieDbProvider.Current.GetMovieSearchResults(searchInfo, cancellationToken);
|
||||||
|
@ -34,7 +34,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return item is Movie || item is Trailer || item is MusicVideo;
|
return item is Movie || item is MusicVideo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
{
|
{
|
||||||
return item is Movie || item is Trailer || item is MusicVideo;
|
return item is Movie || item is MusicVideo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return item is Movie || item is Trailer || item is MusicVideo || item is Series || item is Episode;
|
return item is Movie || item is MusicVideo || item is Series || item is Episode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
// Gather all movies into a lookup by tmdb id
|
// Gather all movies into a lookup by tmdb id
|
||||||
var allMovies = _libraryManager.RootFolder.RecursiveChildren
|
var allMovies = _libraryManager.RootFolder.RecursiveChildren
|
||||||
.Where(i => i is Movie || i is Trailer)
|
.Where(i => i is Movie)
|
||||||
.Where(i => !string.IsNullOrEmpty(i.GetProviderId(MetadataProviders.Tmdb)))
|
.Where(i => !string.IsNullOrEmpty(i.GetProviderId(MetadataProviders.Tmdb)))
|
||||||
.ToLookup(i => i.GetProviderId(MetadataProviders.Tmdb));
|
.ToLookup(i => i.GetProviderId(MetadataProviders.Tmdb));
|
||||||
|
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Controller.Configuration;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Library;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using MediaBrowser.Providers.Manager;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Movies
|
|
||||||
{
|
|
||||||
public class TrailerMetadataService : MetadataService<Trailer, TrailerInfo>
|
|
||||||
{
|
|
||||||
public TrailerMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Merges the specified source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The source.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
|
||||||
/// <param name="lockedFields">The locked fields.</param>
|
|
||||||
/// <param name="replaceData">if set to <c>true</c> [replace data].</param>
|
|
||||||
/// <param name="mergeMetadataSettings">if set to <c>true</c> [merge metadata settings].</param>
|
|
||||||
protected override void MergeData(Trailer source, Trailer target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
||||||
{
|
|
||||||
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -108,7 +108,7 @@ namespace MediaBrowser.Providers.Omdb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return item is Movie || item is Trailer;
|
return item is Movie;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order
|
public int Order
|
||||||
|
@ -20,7 +20,7 @@ using System.Threading.Tasks;
|
|||||||
namespace MediaBrowser.Providers.Omdb
|
namespace MediaBrowser.Providers.Omdb
|
||||||
{
|
{
|
||||||
public class OmdbItemProvider : IRemoteMetadataProvider<Series, SeriesInfo>,
|
public class OmdbItemProvider : IRemoteMetadataProvider<Series, SeriesInfo>,
|
||||||
IRemoteMetadataProvider<Movie, MovieInfo>, IRemoteMetadataProvider<Trailer, TrailerInfo>, IRemoteMetadataProvider<ChannelVideoItem, ChannelItemLookupInfo>
|
IRemoteMetadataProvider<Movie, MovieInfo>, IRemoteMetadataProvider<ChannelVideoItem, ChannelItemLookupInfo>
|
||||||
{
|
{
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
@ -114,18 +114,6 @@ namespace MediaBrowser.Providers.Omdb
|
|||||||
return GetMovieResult<Movie>(info, cancellationToken);
|
return GetMovieResult<Movie>(info, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<MetadataResult<Trailer>> GetMetadata(TrailerInfo info, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var result = new MetadataResult<Trailer>();
|
|
||||||
|
|
||||||
if (info.IsLocalTrailer)
|
|
||||||
{
|
|
||||||
return Task.FromResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetMovieResult<Trailer>(info, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<MetadataResult<T>> GetMovieResult<T>(ItemLookupInfo info, CancellationToken cancellationToken)
|
private async Task<MetadataResult<T>> GetMovieResult<T>(ItemLookupInfo info, CancellationToken cancellationToken)
|
||||||
where T : Video, new()
|
where T : Video, new()
|
||||||
{
|
{
|
||||||
|
@ -233,7 +233,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
dto.MusicVideoCount = taggedItems.Count(i => i is MusicVideo);
|
dto.MusicVideoCount = taggedItems.Count(i => i is MusicVideo);
|
||||||
dto.SeriesCount = taggedItems.Count(i => i is Series);
|
dto.SeriesCount = taggedItems.Count(i => i is Series);
|
||||||
dto.SongCount = taggedItems.Count(i => i is Audio);
|
dto.SongCount = taggedItems.Count(i => i is Audio);
|
||||||
dto.TrailerCount = taggedItems.Count(i => i is Trailer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.ChildCount = taggedItems.Count;
|
dto.ChildCount = taggedItems.Count;
|
||||||
@ -1053,9 +1052,9 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
dto.IsoType = video.IsoType;
|
dto.IsoType = video.IsoType;
|
||||||
dto.IsHD = video.IsHD;
|
dto.IsHD = video.IsHD;
|
||||||
|
|
||||||
if (fields.Contains(ItemFields.Chapters))
|
if (video.AdditionalParts.Count != 0)
|
||||||
{
|
{
|
||||||
dto.PartCount = video.AdditionalPartIds.Count + 1;
|
dto.PartCount = video.AdditionalParts.Count + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fields.Contains(ItemFields.MediaSourceCount))
|
if (fields.Contains(ItemFields.MediaSourceCount))
|
||||||
|
@ -59,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ratingLevel = string.IsNullOrWhiteSpace(item.OfficialRating)
|
var ratingLevel = string.IsNullOrWhiteSpace(item.OfficialRating)
|
||||||
? (int?)null
|
? null
|
||||||
: _localization.GetRatingLevel(item.OfficialRating);
|
: _localization.GetRatingLevel(item.OfficialRating);
|
||||||
|
|
||||||
var libaryItems = user.RootFolder.GetRecursiveChildren(user, false)
|
var libaryItems = user.RootFolder.GetRecursiveChildren(user, false)
|
||||||
@ -134,15 +134,6 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||||||
WatchingItem = item,
|
WatchingItem = item,
|
||||||
Random = random
|
Random = random
|
||||||
}));
|
}));
|
||||||
|
|
||||||
candidates.AddRange(libaryItems.Where(i => i is Trailer).Select(i => new ItemWithTrailer
|
|
||||||
{
|
|
||||||
Item = i,
|
|
||||||
Type = ItemWithTrailerType.LibraryTrailer,
|
|
||||||
User = user,
|
|
||||||
WatchingItem = item,
|
|
||||||
Random = random
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var customIntros = !string.IsNullOrWhiteSpace(config.CustomIntroPath) ?
|
var customIntros = !string.IsNullOrWhiteSpace(config.CustomIntroPath) ?
|
||||||
|
@ -17,6 +17,7 @@ using MediaBrowser.Model.Entities;
|
|||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Naming.Audio;
|
using MediaBrowser.Naming.Audio;
|
||||||
using MediaBrowser.Naming.Common;
|
using MediaBrowser.Naming.Common;
|
||||||
|
using MediaBrowser.Naming.IO;
|
||||||
using MediaBrowser.Naming.Video;
|
using MediaBrowser.Naming.Video;
|
||||||
using MediaBrowser.Server.Implementations.Library.Resolvers.TV;
|
using MediaBrowser.Server.Implementations.Library.Resolvers.TV;
|
||||||
using MediaBrowser.Server.Implementations.Library.Validators;
|
using MediaBrowser.Server.Implementations.Library.Validators;
|
||||||
@ -1700,114 +1701,29 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<FileSystemInfo> GetAdditionalParts(string file,
|
public IEnumerable<Video> FindTrailers(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
||||||
VideoType type,
|
|
||||||
IEnumerable<FileSystemInfo> files)
|
|
||||||
{
|
|
||||||
var resolver = new StackResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
|
|
||||||
|
|
||||||
StackResult result;
|
|
||||||
List<FileSystemInfo> filteredFiles;
|
|
||||||
|
|
||||||
if (type == VideoType.BluRay || type == VideoType.Dvd)
|
|
||||||
{
|
|
||||||
filteredFiles = files.Where(i => (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
result = resolver.ResolveDirectories(filteredFiles.Select(i => i.FullName));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filteredFiles = files.Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
result = resolver.ResolveFiles(filteredFiles.Select(i => i.FullName));
|
|
||||||
}
|
|
||||||
|
|
||||||
var stack = result.Stacks
|
|
||||||
.FirstOrDefault(i => i.Files.Contains(file, StringComparer.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
if (stack != null)
|
|
||||||
{
|
|
||||||
return stack.Files.Where(i => !string.Equals(i, file, StringComparison.OrdinalIgnoreCase))
|
|
||||||
.Select(i => filteredFiles.FirstOrDefault(f => string.Equals(i, f.FullName, StringComparison.OrdinalIgnoreCase)))
|
|
||||||
.Where(i => i != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new List<FileSystemInfo>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Trailer> FindTrailers(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
|
||||||
{
|
{
|
||||||
var files = fileSystemChildren.OfType<DirectoryInfo>()
|
var files = fileSystemChildren.OfType<DirectoryInfo>()
|
||||||
.Where(i => string.Equals(i.Name, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
|
.Where(i => string.Equals(i.Name, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
|
||||||
.SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
.SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var extraTypes = new List<ExtraType> { ExtraType.Trailer };
|
var videoListResolver = new VideoListResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
|
||||||
var suffixes = BaseItem.ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
|
|
||||||
.Select(i => i.Key)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
files.AddRange(fileSystemChildren.OfType<FileInfo>()
|
var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new PortableFileInfo
|
||||||
.Where(i =>
|
|
||||||
{
|
{
|
||||||
var nameEithoutExtension = _fileSystem.GetFileNameWithoutExtension(i);
|
FullName = i.FullName,
|
||||||
|
Type = GetFileType(i)
|
||||||
|
|
||||||
if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
|
}).ToList());
|
||||||
|
|
||||||
|
var currentVideo = videos.FirstOrDefault(i => string.Equals(owner.Path, i.Files.First().Path, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (currentVideo != null)
|
||||||
{
|
{
|
||||||
return false;
|
files.AddRange(currentVideo.Extras.Where(i => string.Equals(i.ExtraType, "trailer", StringComparison.OrdinalIgnoreCase)).Select(i => new FileInfo(i.Path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
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 =>
|
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
|
// Try to retrieve it from the db. If we don't find it, use the resolved version
|
||||||
@ -1818,11 +1734,59 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
video = dbItem;
|
video = dbItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video != null)
|
video.ExtraType = ExtraType.Trailer;
|
||||||
{
|
|
||||||
SetExtraTypeFromFilename(video);
|
return video;
|
||||||
|
|
||||||
|
// Sort them so that the list can be easily compared for changes
|
||||||
|
}).OrderBy(i => i.Path).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private FileInfoType GetFileType(FileSystemInfo info)
|
||||||
|
{
|
||||||
|
if ((info.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
||||||
|
{
|
||||||
|
return FileInfoType.Directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FileInfoType.File;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 videoListResolver = new VideoListResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
|
||||||
|
|
||||||
|
var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new PortableFileInfo
|
||||||
|
{
|
||||||
|
FullName = i.FullName,
|
||||||
|
Type = GetFileType(i)
|
||||||
|
|
||||||
|
}).ToList());
|
||||||
|
|
||||||
|
var currentVideo = videos.FirstOrDefault(i => string.Equals(owner.Path, i.Files.First().Path, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (currentVideo != null)
|
||||||
|
{
|
||||||
|
files.AddRange(currentVideo.Extras.Where(i => !string.Equals(i.ExtraType, "trailer", StringComparison.OrdinalIgnoreCase)).Select(i => new FileInfo(i.Path)));
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetExtraTypeFromFilename(video);
|
||||||
|
|
||||||
return video;
|
return video;
|
||||||
|
|
||||||
// Sort them so that the list can be easily compared for changes
|
// Sort them so that the list can be easily compared for changes
|
||||||
@ -1831,18 +1795,34 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
private void SetExtraTypeFromFilename(Video item)
|
private void SetExtraTypeFromFilename(Video item)
|
||||||
{
|
{
|
||||||
var name = System.IO.Path.GetFileNameWithoutExtension(item.Path) ?? string.Empty;
|
var resolver = new ExtraResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
|
||||||
|
|
||||||
foreach (var suffix in BaseItem.ExtraSuffixes)
|
var result = resolver.GetExtraInfo(item.Path);
|
||||||
{
|
|
||||||
if (name.EndsWith(suffix.Key, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
item.ExtraType = suffix.Value;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (string.Equals(result.ExtraType, "deletedscene", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item.ExtraType = ExtraType.DeletedScene;
|
||||||
|
}
|
||||||
|
else if (string.Equals(result.ExtraType, "behindthescenes", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item.ExtraType = ExtraType.BehindTheScenes;
|
||||||
|
}
|
||||||
|
else if (string.Equals(result.ExtraType, "interview", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item.ExtraType = ExtraType.Interview;
|
||||||
|
}
|
||||||
|
else if (string.Equals(result.ExtraType, "scene", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item.ExtraType = ExtraType.Scene;
|
||||||
|
}
|
||||||
|
else if (string.Equals(result.ExtraType, "sample", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item.ExtraType = ExtraType.Sample;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
item.ExtraType = ExtraType.Clip;
|
item.ExtraType = ExtraType.Clip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Naming.Common;
|
using MediaBrowser.Naming.Common;
|
||||||
|
using MediaBrowser.Naming.Video;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
@ -42,9 +43,75 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
|||||||
where TVideoType : Video, new()
|
where TVideoType : Video, new()
|
||||||
{
|
{
|
||||||
// If the path is a file check for a matching extensions
|
// If the path is a file check for a matching extensions
|
||||||
if (!args.IsDirectory)
|
|
||||||
{
|
|
||||||
var parser = new Naming.Video.VideoResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
|
var parser = new Naming.Video.VideoResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
|
||||||
|
|
||||||
|
if (args.IsDirectory)
|
||||||
|
{
|
||||||
|
TVideoType video = null;
|
||||||
|
VideoFileInfo videoInfo = null;
|
||||||
|
|
||||||
|
// Loop through each child file/folder and see if we find a video
|
||||||
|
foreach (var child in args.FileSystemChildren)
|
||||||
|
{
|
||||||
|
var filename = child.Name;
|
||||||
|
|
||||||
|
if ((child.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
||||||
|
{
|
||||||
|
if (IsDvdDirectory(filename))
|
||||||
|
{
|
||||||
|
videoInfo = parser.ResolveDirectory(args.Path);
|
||||||
|
|
||||||
|
if (videoInfo == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
video = new TVideoType
|
||||||
|
{
|
||||||
|
Path = args.Path,
|
||||||
|
VideoType = VideoType.Dvd,
|
||||||
|
ProductionYear = videoInfo.Year
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (IsBluRayDirectory(filename))
|
||||||
|
{
|
||||||
|
videoInfo = parser.ResolveDirectory(args.Path);
|
||||||
|
|
||||||
|
if (videoInfo == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
video = new TVideoType
|
||||||
|
{
|
||||||
|
Path = args.Path,
|
||||||
|
VideoType = VideoType.BluRay,
|
||||||
|
ProductionYear = videoInfo.Year
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (video != null)
|
||||||
|
{
|
||||||
|
if (parseName)
|
||||||
|
{
|
||||||
|
video.Name = videoInfo.Name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
video.Name = Path.GetFileName(args.Path);
|
||||||
|
}
|
||||||
|
|
||||||
|
Set3DFormat(video, videoInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return video;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
var videoInfo = parser.ResolveFile(args.Path);
|
var videoInfo = parser.ResolveFile(args.Path);
|
||||||
|
|
||||||
if (videoInfo == null)
|
if (videoInfo == null)
|
||||||
@ -97,6 +164,17 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set3DFormat(video, videoInfo);
|
||||||
|
|
||||||
|
return video;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Set3DFormat(Video video, VideoFileInfo videoInfo)
|
||||||
|
{
|
||||||
if (videoInfo.Is3D)
|
if (videoInfo.Is3D)
|
||||||
{
|
{
|
||||||
if (string.Equals(videoInfo.Format3D, "fsbs", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(videoInfo.Format3D, "fsbs", StringComparison.OrdinalIgnoreCase))
|
||||||
@ -128,12 +206,26 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
|||||||
video.Video3DFormat = Video3DFormat.HalfTopAndBottom;
|
video.Video3DFormat = Video3DFormat.HalfTopAndBottom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return video;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
/// <summary>
|
||||||
|
/// Determines whether [is DVD directory] [the specified directory name].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="directoryName">Name of the directory.</param>
|
||||||
|
/// <returns><c>true</c> if [is DVD directory] [the specified directory name]; otherwise, <c>false</c>.</returns>
|
||||||
|
protected bool IsDvdDirectory(string directoryName)
|
||||||
|
{
|
||||||
|
return string.Equals(directoryName, "video_ts", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether [is blu ray directory] [the specified directory name].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="directoryName">Name of the directory.</param>
|
||||||
|
/// <returns><c>true</c> if [is blu ray directory] [the specified directory name]; otherwise, <c>false</c>.</returns>
|
||||||
|
protected bool IsBluRayDirectory(string directoryName)
|
||||||
|
{
|
||||||
|
return string.Equals(directoryName, "bdmv", StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Library;
|
|
||||||
using MediaBrowser.Controller.Resolvers;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class LocalTrailerResolver
|
|
||||||
/// </summary>
|
|
||||||
public class LocalTrailerResolver : BaseVideoResolver<Trailer>
|
|
||||||
{
|
|
||||||
private readonly IFileSystem _fileSystem;
|
|
||||||
|
|
||||||
public LocalTrailerResolver(ILibraryManager libraryManager, IFileSystem fileSystem) : base(libraryManager)
|
|
||||||
{
|
|
||||||
_fileSystem = fileSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Resolves the specified args.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">The args.</param>
|
|
||||||
/// <returns>Trailer.</returns>
|
|
||||||
protected override Trailer Resolve(ItemResolveArgs args)
|
|
||||||
{
|
|
||||||
// Trailers are not Children, therefore this can never happen
|
|
||||||
if (args.Parent != null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the file is within a trailers folder, see if the VideoResolver returns something
|
|
||||||
if (!args.IsDirectory)
|
|
||||||
{
|
|
||||||
if (string.Equals(Path.GetFileName(Path.GetDirectoryName(args.Path)), BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return base.Resolve(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Support xbmc local trailer convention, but only when looking for local trailers (hence the parent == null check)
|
|
||||||
if (args.Parent == null)
|
|
||||||
{
|
|
||||||
var nameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(args.Path);
|
|
||||||
var suffix = BaseItem.ExtraSuffixes.First(i => i.Value == ExtraType.Trailer);
|
|
||||||
|
|
||||||
if (nameWithoutExtension.EndsWith(suffix.Key, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return base.Resolve(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
@ -64,42 +63,42 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var isDirectory = args.IsDirectory;
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
if (isDirectory)
|
// Find movies with their own folders
|
||||||
|
if (args.IsDirectory)
|
||||||
{
|
{
|
||||||
|
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return FindMovie<MusicVideo>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, collectionType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, collectionType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(collectionType))
|
||||||
|
{
|
||||||
|
// Owned items should just use the plain video type
|
||||||
|
if (args.Parent == null)
|
||||||
|
{
|
||||||
|
return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, collectionType);
|
||||||
|
}
|
||||||
|
|
||||||
// Since the looping is expensive, this is an optimization to help us avoid it
|
// Since the looping is expensive, this is an optimization to help us avoid it
|
||||||
if (args.ContainsMetaFileByName("series.xml"))
|
if (args.ContainsMetaFileByName("series.xml"))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, collectionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
var collectionType = args.GetCollectionType();
|
if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
|
||||||
// Find movies with their own folders
|
|
||||||
if (isDirectory)
|
|
||||||
{
|
|
||||||
if (string.Equals(collectionType, CollectionType.Trailers, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return FindMovie<Trailer>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, false, collectionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return FindMovie<MusicVideo>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, false, collectionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, false, collectionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(collectionType) ||
|
|
||||||
string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
|
string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, true, collectionType);
|
return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, collectionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -112,12 +111,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find movies that are mixed in the same folder
|
|
||||||
if (string.Equals(collectionType, CollectionType.Trailers, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return ResolveVideo<Trailer>(args, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Video item = null;
|
Video item = null;
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
||||||
@ -126,8 +119,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To find a movie file, the collection type must be movies or boxsets
|
// To find a movie file, the collection type must be movies or boxsets
|
||||||
// Otherwise we'll consider it a plain video and let the video resolver handle it
|
else if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
|
||||||
if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
|
string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
item = ResolveVideo<Movie>(args, true);
|
item = ResolveVideo<Movie>(args, true);
|
||||||
@ -178,11 +170,10 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
/// <param name="parent">The parent.</param>
|
/// <param name="parent">The parent.</param>
|
||||||
/// <param name="fileSystemEntries">The file system entries.</param>
|
/// <param name="fileSystemEntries">The file system entries.</param>
|
||||||
/// <param name="directoryService">The directory service.</param>
|
/// <param name="directoryService">The directory service.</param>
|
||||||
/// <param name="supportMultiFileItems">if set to <c>true</c> [support multi file items].</param>
|
|
||||||
/// <param name="supportsMultipleSources">if set to <c>true</c> [supports multiple sources].</param>
|
/// <param name="supportsMultipleSources">if set to <c>true</c> [supports multiple sources].</param>
|
||||||
/// <param name="collectionType">Type of the collection.</param>
|
/// <param name="collectionType">Type of the collection.</param>
|
||||||
/// <returns>Movie.</returns>
|
/// <returns>Movie.</returns>
|
||||||
private T FindMovie<T>(string path, Folder parent, IEnumerable<FileSystemInfo> fileSystemEntries, IDirectoryService directoryService, bool supportMultiFileItems, bool supportsMultipleSources, string collectionType)
|
private T FindMovie<T>(string path, Folder parent, IEnumerable<FileSystemInfo> fileSystemEntries, IDirectoryService directoryService, bool supportsMultipleSources, string collectionType)
|
||||||
where T : Video, new()
|
where T : Video, new()
|
||||||
{
|
{
|
||||||
var movies = new List<T>();
|
var movies = new List<T>();
|
||||||
@ -243,15 +234,13 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
|
|
||||||
if (movies.Count > 1)
|
if (movies.Count > 1)
|
||||||
{
|
{
|
||||||
if (supportMultiFileItems)
|
var multiFileResult = GetMultiFileMovie(movies);
|
||||||
{
|
|
||||||
var result = GetMultiFileMovie(movies);
|
|
||||||
|
|
||||||
if (result != null)
|
if (multiFileResult != null)
|
||||||
{
|
{
|
||||||
return result;
|
return multiFileResult;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportsMultipleSources)
|
if (supportsMultipleSources)
|
||||||
{
|
{
|
||||||
var result = GetMovieWithMultipleSources(movies);
|
var result = GetMovieWithMultipleSources(movies);
|
||||||
@ -334,7 +323,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
{
|
{
|
||||||
Path = folderPaths[0],
|
Path = folderPaths[0],
|
||||||
|
|
||||||
IsMultiPart = true,
|
AdditionalParts = folderPaths.Skip(1).ToList(),
|
||||||
|
|
||||||
VideoType = videoTypes[0],
|
VideoType = videoTypes[0],
|
||||||
|
|
||||||
@ -366,7 +355,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
firstMovie.IsMultiPart = true;
|
firstMovie.AdditionalParts = result.Stacks[0].Files.Skip(1).ToList();
|
||||||
firstMovie.Name = result.Stacks[0].Name;
|
firstMovie.Name = result.Stacks[0].Name;
|
||||||
|
|
||||||
// They must all be part of the sequence if we're going to consider it a multi-part movie
|
// They must all be part of the sequence if we're going to consider it a multi-part movie
|
||||||
@ -392,7 +381,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
{
|
{
|
||||||
if (sortedMovies.All(i => _fileSystem.GetFileNameWithoutExtension(i.Path).StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase)))
|
if (sortedMovies.All(i => _fileSystem.GetFileNameWithoutExtension(i.Path).StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
firstMovie.HasLocalAlternateVersions = true;
|
firstMovie.LocalAlternateVersions = sortedMovies.Skip(1).Select(i => i.Path).ToList();
|
||||||
|
|
||||||
_logger.Debug("Multi-version video found: " + firstMovie.Path);
|
_logger.Debug("Multi-version video found: " + firstMovie.Path);
|
||||||
|
|
||||||
@ -402,25 +391,5 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether [is DVD directory] [the specified directory name].
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="directoryName">Name of the directory.</param>
|
|
||||||
/// <returns><c>true</c> if [is DVD directory] [the specified directory name]; otherwise, <c>false</c>.</returns>
|
|
||||||
private bool IsDvdDirectory(string directoryName)
|
|
||||||
{
|
|
||||||
return string.Equals(directoryName, "video_ts", StringComparison.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether [is blu ray directory] [the specified directory name].
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="directoryName">Name of the directory.</param>
|
|
||||||
/// <returns><c>true</c> if [is blu ray directory] [the specified directory name]; otherwise, <c>false</c>.</returns>
|
|
||||||
private bool IsBluRayDirectory(string directoryName)
|
|
||||||
{
|
|
||||||
return string.Equals(directoryName, "bdmv", StringComparison.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using MediaBrowser.Controller.Entities.TV;
|
using System;
|
||||||
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
@ -41,39 +42,14 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||||||
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
||||||
if (season != null || parent is Series || parent.Parents.OfType<Series>().Any())
|
if (season != null || parent is Series || parent.Parents.OfType<Series>().Any())
|
||||||
{
|
{
|
||||||
Episode episode = null;
|
if (args.IsDirectory && args.Path.IndexOf("dead like me", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
|
||||||
if (args.IsDirectory)
|
|
||||||
{
|
{
|
||||||
if (args.ContainsFileSystemEntryByName("video_ts"))
|
var b = true;
|
||||||
{
|
|
||||||
episode = new Episode
|
|
||||||
{
|
|
||||||
Path = args.Path,
|
|
||||||
VideoType = VideoType.Dvd
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (args.ContainsFileSystemEntryByName("bdmv"))
|
|
||||||
{
|
|
||||||
episode = new Episode
|
|
||||||
{
|
|
||||||
Path = args.Path,
|
|
||||||
VideoType = VideoType.BluRay
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (episode == null)
|
|
||||||
{
|
|
||||||
episode = base.Resolve(args);
|
|
||||||
}
|
}
|
||||||
|
var episode = ResolveVideo<Episode>(args, false);
|
||||||
|
|
||||||
if (episode != null)
|
if (episode != null)
|
||||||
{
|
{
|
||||||
// The base video resolver is going to fill these in, so null them out
|
|
||||||
episode.ProductionYear = null;
|
|
||||||
episode.Name = null;
|
|
||||||
|
|
||||||
if (season != null)
|
if (season != null)
|
||||||
{
|
{
|
||||||
episode.ParentIndexNumber = season.IndexNumber;
|
episode.ParentIndexNumber = season.IndexNumber;
|
||||||
|
@ -21,6 +21,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
|||||||
{
|
{
|
||||||
if (args.Parent != null)
|
if (args.Parent != null)
|
||||||
{
|
{
|
||||||
|
// The movie resolver will handle this
|
||||||
|
if (args.IsDirectory)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var collectionType = args.GetCollectionType() ?? string.Empty;
|
var collectionType = args.GetCollectionType() ?? string.Empty;
|
||||||
var accepted = new[]
|
var accepted = new[]
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MediaBrowser.Naming, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MediaBrowser.Naming, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.12\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.13\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Mono.Nat, Version=1.2.21.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Mono.Nat, Version=1.2.21.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
@ -194,7 +194,6 @@
|
|||||||
<Compile Include="Library\Resolvers\Audio\MusicArtistResolver.cs" />
|
<Compile Include="Library\Resolvers\Audio\MusicArtistResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\ItemResolver.cs" />
|
<Compile Include="Library\Resolvers\ItemResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\FolderResolver.cs" />
|
<Compile Include="Library\Resolvers\FolderResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\LocalTrailerResolver.cs" />
|
|
||||||
<Compile Include="Library\Resolvers\Movies\BoxSetResolver.cs" />
|
<Compile Include="Library\Resolvers\Movies\BoxSetResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\Movies\MovieResolver.cs" />
|
<Compile Include="Library\Resolvers\Movies\MovieResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\TV\EpisodeResolver.cs" />
|
<Compile Include="Library\Resolvers\TV\EpisodeResolver.cs" />
|
||||||
|
@ -189,7 +189,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video.IsMultiPart)
|
if (video.IsStacked)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.Naming" version="1.0.0.12" targetFramework="net45" />
|
<package id="MediaBrowser.Naming" version="1.0.0.13" targetFramework="net45" />
|
||||||
<package id="Mono.Nat" version="1.2.21.0" targetFramework="net45" />
|
<package id="Mono.Nat" version="1.2.21.0" targetFramework="net45" />
|
||||||
<package id="morelinq" version="1.1.0" targetFramework="net45" />
|
<package id="morelinq" version="1.1.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
@ -950,11 +950,6 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
var localAddresses = NetworkManager.GetLocalIpAddresses()
|
var localAddresses = NetworkManager.GetLocalIpAddresses()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (localAddresses.Count < 2)
|
|
||||||
{
|
|
||||||
return localAddresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
var httpServerAddresses = HttpServer.LocalEndPoints
|
var httpServerAddresses = HttpServer.LocalEndPoints
|
||||||
.Select(i => i.Split(':').FirstOrDefault())
|
.Select(i => i.Split(':').FirstOrDefault())
|
||||||
.Where(i => !string.IsNullOrEmpty(i))
|
.Where(i => !string.IsNullOrEmpty(i))
|
||||||
@ -967,7 +962,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
|
|
||||||
if (matchedAddresses.Count == 0)
|
if (matchedAddresses.Count == 0)
|
||||||
{
|
{
|
||||||
return localAddresses.Take(1);
|
return localAddresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
return matchedAddresses;
|
return matchedAddresses;
|
||||||
|
@ -26,13 +26,4 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrailerNfoProvider : BaseVideoNfoProvider<Trailer>
|
|
||||||
{
|
|
||||||
public TrailerNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config)
|
|
||||||
: base(fileSystem, logger, config)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.511</version>
|
<version>3.0.517</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.511" />
|
<dependency id="MediaBrowser.Common" version="3.0.517" />
|
||||||
<dependency id="NLog" version="3.1.0.0" />
|
<dependency id="NLog" version="3.1.0.0" />
|
||||||
<dependency id="SimpleInjector" version="2.6.1" />
|
<dependency id="SimpleInjector" version="2.6.1" />
|
||||||
<dependency id="sharpcompress" version="0.10.2" />
|
<dependency id="sharpcompress" version="0.10.2" />
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.511</version>
|
<version>3.0.517</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Model.Signed</id>
|
<id>MediaBrowser.Model.Signed</id>
|
||||||
<version>3.0.511</version>
|
<version>3.0.517</version>
|
||||||
<title>MediaBrowser.Model - Signed Edition</title>
|
<title>MediaBrowser.Model - Signed Edition</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.511</version>
|
<version>3.0.517</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.511" />
|
<dependency id="MediaBrowser.Common" version="3.0.517" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user