aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Library
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-10-20 15:27:40 -0400
committerGitHub <noreply@github.com>2016-10-20 15:27:40 -0400
commit367e17826eb49d855d9ae30462072c5e295f5b33 (patch)
tree39e06e3c38bbd4933ed3aeb100f8f2a22a25f211 /MediaBrowser.Server.Implementations/Library
parentd2d49b6b760ad3d74712c0839c66296476ab858e (diff)
parent3c1114228ba3b6a19cb73fa7f9aaa4e3ce3cab80 (diff)
Merge pull request #2250 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library')
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs8
-rw-r--r--MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs1
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs60
3 files changed, 34 insertions, 35 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index b2302cf86..64abcc044 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -2838,9 +2838,13 @@ namespace MediaBrowser.Server.Implementations.Library
private bool ValidateNetworkPath(string path)
{
- if (Environment.OSVersion.Platform == PlatformID.Win32NT || !path.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase))
+ if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
- return Directory.Exists(path);
+ // We can't validate protocol-based paths, so just allow them
+ if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) == -1)
+ {
+ return Directory.Exists(path);
+ }
}
// Without native support for unc, we cannot validate this when running under mono
diff --git a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs
index 716d627a9..e7bfe56f2 100644
--- a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs
@@ -360,7 +360,6 @@ namespace MediaBrowser.Server.Implementations.Library
public async Task<LiveStreamResponse> OpenLiveStream(LiveStreamRequest request, bool enableAutoClose, CancellationToken cancellationToken)
{
- enableAutoClose = false;
await _liveStreamSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
try
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index c3d5f3441..5f4199564 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -207,14 +207,18 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
// Find movies with their own folders
if (args.IsDirectory)
{
+ var files = args.FileSystemChildren
+ .Where(i => !LibraryManager.IgnoreFile(i, args.Parent))
+ .ToList();
+
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
{
- return null;
+ return FindMovie<MusicVideo>(args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
}
if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
{
- return null;
+ return FindMovie<Video>(args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
}
if (string.IsNullOrEmpty(collectionType))
@@ -222,6 +226,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
// Owned items will be caught by the plain video resolver
if (args.Parent == null)
{
+ //return FindMovie<Video>(args.Path, args.Parent, files, args.DirectoryService, collectionType);
return null;
}
@@ -231,21 +236,13 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
}
{
- var files = args.FileSystemChildren
- .Where(i => !LibraryManager.IgnoreFile(i, args.Parent))
- .ToList();
-
- return FindMovie<Movie>(args.Path, args.Parent, files, args.DirectoryService, collectionType);
+ return FindMovie<Movie>(args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
}
}
if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
{
- var files = args.FileSystemChildren
- .Where(i => !LibraryManager.IgnoreFile(i, args.Parent))
- .ToList();
-
- return FindMovie<Movie>(args.Path, args.Parent, files, args.DirectoryService, collectionType);
+ return FindMovie<Movie>(args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
}
return null;
@@ -360,13 +357,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
/// Finds a movie based on a child file system entries
/// </summary>
/// <typeparam name="T"></typeparam>
- /// <param name="path">The path.</param>
- /// <param name="parent">The parent.</param>
- /// <param name="fileSystemEntries">The file system entries.</param>
- /// <param name="directoryService">The directory service.</param>
- /// <param name="collectionType">Type of the collection.</param>
/// <returns>Movie.</returns>
- private T FindMovie<T>(string path, Folder parent, List<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, string collectionType)
+ private T FindMovie<T>(string path, Folder parent, List<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, string collectionType, bool allowFilesAsFolders)
where T : Video, new()
{
var multiDiscFolders = new List<FileSystemMetadata>();
@@ -413,23 +405,27 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
}
}
- var supportsMultiVersion = !string.Equals(collectionType, CollectionType.HomeVideos) &&
- !string.Equals(collectionType, CollectionType.Photos) &&
- !string.Equals(collectionType, CollectionType.MusicVideos);
+ if (allowFilesAsFolders)
+ {
+ // TODO: Allow GetMultiDiscMovie in here
+ var supportsMultiVersion = !string.Equals(collectionType, CollectionType.HomeVideos) &&
+ !string.Equals(collectionType, CollectionType.Photos) &&
+ !string.Equals(collectionType, CollectionType.MusicVideos);
- var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion);
+ var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion);
- if (result.Items.Count == 1)
- {
- var movie = (T)result.Items[0];
- movie.IsInMixedFolder = false;
- movie.Name = Path.GetFileName(movie.ContainingFolderPath);
- return movie;
- }
+ if (result.Items.Count == 1)
+ {
+ var movie = (T)result.Items[0];
+ movie.IsInMixedFolder = false;
+ movie.Name = Path.GetFileName(movie.ContainingFolderPath);
+ return movie;
+ }
- if (result.Items.Count == 0 && multiDiscFolders.Count > 0)
- {
- return GetMultiDiscMovie<T>(multiDiscFolders, directoryService);
+ if (result.Items.Count == 0 && multiDiscFolders.Count > 0)
+ {
+ return GetMultiDiscMovie<T>(multiDiscFolders, directoryService);
+ }
}
return null;