aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Library
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library')
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs150
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs160
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs61
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs101
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs34
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs6
6 files changed, 237 insertions, 275 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index dfddae24d..9c3255833 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -17,6 +17,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Naming.Audio;
using MediaBrowser.Naming.Common;
+using MediaBrowser.Naming.IO;
using MediaBrowser.Naming.Video;
using MediaBrowser.Server.Implementations.Library.Resolvers.TV;
using MediaBrowser.Server.Implementations.Library.Validators;
@@ -1700,82 +1701,40 @@ namespace MediaBrowser.Server.Implementations.Library
};
}
- public IEnumerable<FileSystemInfo> GetAdditionalParts(string file,
- 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)
+ public IEnumerable<Video> FindTrailers(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
{
var files = fileSystemChildren.OfType<DirectoryInfo>()
.Where(i => string.Equals(i.Name, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
.SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
.ToList();
- var extraTypes = new List<ExtraType> { ExtraType.Trailer };
- var suffixes = BaseItem.ExtraSuffixes.Where(i => extraTypes.Contains(i.Value))
- .Select(i => i.Key)
- .ToList();
+ var videoListResolver = new VideoListResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
- files.AddRange(fileSystemChildren.OfType<FileInfo>()
- .Where(i =>
- {
- var nameEithoutExtension = _fileSystem.GetFileNameWithoutExtension(i);
+ var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new PortableFileInfo
+ {
+ FullName = i.FullName,
+ Type = GetFileType(i)
- if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
- {
- return false;
- }
+ }).ToList());
- return !string.Equals(owner.Path, i.FullName, StringComparison.OrdinalIgnoreCase);
- }));
+ var currentVideo = videos.FirstOrDefault(i => string.Equals(owner.Path, i.Files.First().Path, StringComparison.OrdinalIgnoreCase));
- return ResolvePaths<Trailer>(files, directoryService, null).Select(video =>
+ 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 Trailer;
+ var dbItem = GetItemById(video.Id) as Video;
if (dbItem != null)
{
video = dbItem;
}
- if (video != null)
- {
- video.ExtraType = ExtraType.Trailer;
- }
+ video.ExtraType = ExtraType.Trailer;
return video;
@@ -1783,6 +1742,16 @@ namespace MediaBrowser.Server.Implementations.Library
}).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>()
@@ -1790,23 +1759,21 @@ namespace MediaBrowser.Server.Implementations.Library
.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();
+ var videoListResolver = new VideoListResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
- files.AddRange(fileSystemChildren.OfType<FileInfo>()
- .Where(i =>
- {
- var nameEithoutExtension = _fileSystem.GetFileNameWithoutExtension(i);
+ var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new PortableFileInfo
+ {
+ FullName = i.FullName,
+ Type = GetFileType(i)
- if (!suffixes.Any(s => nameEithoutExtension.EndsWith(s, StringComparison.OrdinalIgnoreCase)))
- {
- return false;
- }
+ }).ToList());
- return !string.Equals(owner.Path, i.FullName, StringComparison.OrdinalIgnoreCase);
- }));
+ 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 =>
{
@@ -1818,10 +1785,7 @@ namespace MediaBrowser.Server.Implementations.Library
video = dbItem;
}
- if (video != null)
- {
- SetExtraTypeFromFilename(video);
- }
+ SetExtraTypeFromFilename(video);
return video;
@@ -1831,18 +1795,34 @@ namespace MediaBrowser.Server.Implementations.Library
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 (string.Equals(result.ExtraType, "deletedscene", StringComparison.OrdinalIgnoreCase))
{
- if (name.EndsWith(suffix.Key, StringComparison.OrdinalIgnoreCase))
- {
- item.ExtraType = suffix.Value;
- return;
- }
+ 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;
}
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
index 35519b932..f8cd209a1 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using MediaBrowser.Naming.Common;
+using MediaBrowser.Naming.Video;
using System;
using System.IO;
@@ -42,9 +43,75 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
where TVideoType : Video, new()
{
// 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());
+
+ 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 parser = new Naming.Video.VideoResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
var videoInfo = parser.ResolveFile(args.Path);
if (videoInfo == null)
@@ -57,7 +124,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
if (LibraryManager.IsVideoFile(args.Path) || videoInfo.IsStub || isShortcut)
{
var type = string.Equals(videoInfo.Container, "iso", StringComparison.OrdinalIgnoreCase) || string.Equals(videoInfo.Container, "img", StringComparison.OrdinalIgnoreCase) ?
- VideoType.Iso :
+ VideoType.Iso :
VideoType.VideoFile;
var path = args.Path;
@@ -97,37 +164,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
}
}
- if (videoInfo.Is3D)
- {
- if (string.Equals(videoInfo.Format3D, "fsbs", StringComparison.OrdinalIgnoreCase))
- {
- video.Video3DFormat = Video3DFormat.FullSideBySide;
- }
- else if (string.Equals(videoInfo.Format3D, "ftab", StringComparison.OrdinalIgnoreCase))
- {
- video.Video3DFormat = Video3DFormat.FullTopAndBottom;
- }
- else if (string.Equals(videoInfo.Format3D, "hsbs", StringComparison.OrdinalIgnoreCase))
- {
- video.Video3DFormat = Video3DFormat.HalfSideBySide;
- }
- else if (string.Equals(videoInfo.Format3D, "htab", StringComparison.OrdinalIgnoreCase))
- {
- video.Video3DFormat = Video3DFormat.HalfTopAndBottom;
- }
- else if (string.Equals(videoInfo.Format3D, "sbs", StringComparison.OrdinalIgnoreCase))
- {
- video.Video3DFormat = Video3DFormat.HalfSideBySide;
- }
- else if (string.Equals(videoInfo.Format3D, "sbs3d", StringComparison.OrdinalIgnoreCase))
- {
- video.Video3DFormat = Video3DFormat.HalfSideBySide;
- }
- else if (string.Equals(videoInfo.Format3D, "tab", StringComparison.OrdinalIgnoreCase))
- {
- video.Video3DFormat = Video3DFormat.HalfTopAndBottom;
- }
- }
+ Set3DFormat(video, videoInfo);
return video;
}
@@ -135,5 +172,60 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
return null;
}
+
+ private void Set3DFormat(Video video, VideoFileInfo videoInfo)
+ {
+ if (videoInfo.Is3D)
+ {
+ if (string.Equals(videoInfo.Format3D, "fsbs", StringComparison.OrdinalIgnoreCase))
+ {
+ video.Video3DFormat = Video3DFormat.FullSideBySide;
+ }
+ else if (string.Equals(videoInfo.Format3D, "ftab", StringComparison.OrdinalIgnoreCase))
+ {
+ video.Video3DFormat = Video3DFormat.FullTopAndBottom;
+ }
+ else if (string.Equals(videoInfo.Format3D, "hsbs", StringComparison.OrdinalIgnoreCase))
+ {
+ video.Video3DFormat = Video3DFormat.HalfSideBySide;
+ }
+ else if (string.Equals(videoInfo.Format3D, "htab", StringComparison.OrdinalIgnoreCase))
+ {
+ video.Video3DFormat = Video3DFormat.HalfTopAndBottom;
+ }
+ else if (string.Equals(videoInfo.Format3D, "sbs", StringComparison.OrdinalIgnoreCase))
+ {
+ video.Video3DFormat = Video3DFormat.HalfSideBySide;
+ }
+ else if (string.Equals(videoInfo.Format3D, "sbs3d", StringComparison.OrdinalIgnoreCase))
+ {
+ video.Video3DFormat = Video3DFormat.HalfSideBySide;
+ }
+ else if (string.Equals(videoInfo.Format3D, "tab", StringComparison.OrdinalIgnoreCase))
+ {
+ video.Video3DFormat = Video3DFormat.HalfTopAndBottom;
+ }
+ }
+ }
+
+ /// <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);
+ }
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs
deleted file mode 100644
index dfeefb74f..000000000
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs
+++ /dev/null
@@ -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;
- }
- }
-}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index c928c5e65..6d396ad9c 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -1,5 +1,4 @@
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.IO;
+using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
@@ -64,44 +63,44 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
}
}
- var isDirectory = args.IsDirectory;
-
- if (isDirectory)
- {
- // Since the looping is expensive, this is an optimization to help us avoid it
- if (args.ContainsMetaFileByName("series.xml"))
- {
- return null;
- }
- }
-
var collectionType = args.GetCollectionType();
// Find movies with their own folders
- if (isDirectory)
+ if (args.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);
+ 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, true, false, collectionType);
+ return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, collectionType);
}
- if (string.IsNullOrEmpty(collectionType) ||
- string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
- string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
+ if (string.IsNullOrEmpty(collectionType))
{
- return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, true, 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
+ if (args.ContainsMetaFileByName("series.xml"))
+ {
+ return null;
+ }
+
+ return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, collectionType);
}
+ if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
+ {
+ return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, collectionType);
+ }
+
return null;
}
@@ -112,12 +111,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
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;
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
@@ -126,13 +119,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
}
// 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
- if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
+ else if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
{
item = ResolveVideo<Movie>(args, true);
}
-
+
if (item != null)
{
item.IsInMixedFolder = true;
@@ -178,11 +170,10 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
/// <param name="parent">The parent.</param>
/// <param name="fileSystemEntries">The file system entries.</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="collectionType">Type of the collection.</param>
/// <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()
{
var movies = new List<T>();
@@ -243,15 +234,13 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
if (movies.Count > 1)
{
- if (supportMultiFileItems)
- {
- var result = GetMultiFileMovie(movies);
+ var multiFileResult = GetMultiFileMovie(movies);
- if (result != null)
- {
- return result;
- }
+ if (multiFileResult != null)
+ {
+ return multiFileResult;
}
+
if (supportsMultipleSources)
{
var result = GetMovieWithMultipleSources(movies);
@@ -334,7 +323,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
{
Path = folderPaths[0],
- IsMultiPart = true,
+ AdditionalParts = folderPaths.Skip(1).ToList(),
VideoType = videoTypes[0],
@@ -366,7 +355,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
return null;
}
- firstMovie.IsMultiPart = true;
+ firstMovie.AdditionalParts = result.Stacks[0].Files.Skip(1).ToList();
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
@@ -392,7 +381,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
{
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);
@@ -402,25 +391,5 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
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);
- }
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
index 839b14a9e..112490ccd 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller.Entities.TV;
+using System;
+using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
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 (season != null || parent is Series || parent.Parents.OfType<Series>().Any())
{
- Episode episode = null;
-
- if (args.IsDirectory)
+ if (args.IsDirectory && args.Path.IndexOf("dead like me", StringComparison.OrdinalIgnoreCase) != -1)
{
- if (args.ContainsFileSystemEntryByName("video_ts"))
- {
- 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 b = true;
}
+ var episode = ResolveVideo<Episode>(args, false);
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)
{
episode.ParentIndexNumber = season.IndexNumber;
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs
index cde75aea2..cecf2d699 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs
@@ -21,6 +21,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
{
if (args.Parent != null)
{
+ // The movie resolver will handle this
+ if (args.IsDirectory)
+ {
+ return null;
+ }
+
var collectionType = args.GetCollectionType() ?? string.Empty;
var accepted = new[]
{