aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-10-13 01:47:50 -0400
committerGitHub <noreply@github.com>2017-10-13 01:47:50 -0400
commit7619ff7db543df3d8228aa87aa82a544e8dda54f (patch)
tree79aba09ffadbaefc52986b45eeaae78d1b883771 /Emby.Server.Implementations/Library
parent526dea4f6fad60626aa4eb6b8560a4f00ec52351 (diff)
parent2f06bb5bf52dc4dfc3d1763488d215a7e352a1fc (diff)
Merge pull request #2951 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/Library')
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs28
-rw-r--r--Emby.Server.Implementations/Library/UserViewManager.cs18
2 files changed, 25 insertions, 21 deletions
diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index 82f42c745..fc5cab0a0 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -69,13 +69,13 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
{
- return ResolveVideos<MusicVideo>(parent, files, directoryService, true, collectionType);
+ return ResolveVideos<MusicVideo>(parent, files, directoryService, true, collectionType, false);
}
if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) ||
string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase))
{
- return ResolveVideos<Video>(parent, files, directoryService, false, collectionType);
+ return ResolveVideos<Video>(parent, files, directoryService, false, collectionType, false);
}
if (string.IsNullOrWhiteSpace(collectionType))
@@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
// Owned items should just use the plain video type
if (parent == null)
{
- return ResolveVideos<Video>(parent, files, directoryService, false, collectionType);
+ return ResolveVideos<Video>(parent, files, directoryService, false, collectionType, false);
}
if (parent is Series || parent.GetParents().OfType<Series>().Any())
@@ -91,18 +91,18 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
return null;
}
- return ResolveVideos<Movie>(parent, files, directoryService, false, collectionType);
+ return ResolveVideos<Movie>(parent, files, directoryService, false, collectionType, true);
}
if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
{
- return ResolveVideos<Movie>(parent, files, directoryService, true, collectionType);
+ return ResolveVideos<Movie>(parent, files, directoryService, true, collectionType, true);
}
return null;
}
- private MultiItemResolverResult ResolveVideos<T>(Folder parent, IEnumerable<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, bool suppportMultiEditions, string collectionType)
+ private MultiItemResolverResult ResolveVideos<T>(Folder parent, IEnumerable<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, bool suppportMultiEditions, string collectionType, bool parseName)
where T : Video, new()
{
var files = new List<FileSystemMetadata>();
@@ -158,7 +158,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
Path = video.Files[0].Path,
IsInMixedFolder = isInMixedFolder,
ProductionYear = video.Year,
- Name = video.Name,
+ Name = parseName ?
+ video.Name :
+ Path.GetFileName(video.Files[0].Path),
AdditionalParts = video.Files.Skip(1).Select(i => i.Path).ToArray(),
LocalAlternateVersions = video.AlternateVersions.Select(i => i.Path).ToArray()
};
@@ -214,12 +216,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
{
- return FindMovie<MusicVideo>(args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
+ return FindMovie<MusicVideo>(args.Path, args.Parent, files, args.DirectoryService, collectionType, true, false);
}
if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
{
- return FindMovie<Video>(args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
+ return FindMovie<Video>(args.Path, args.Parent, files, args.DirectoryService, collectionType, false, false);
}
if (string.IsNullOrEmpty(collectionType))
@@ -237,13 +239,13 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
}
{
- return FindMovie<Movie>(args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
+ return FindMovie<Movie>(args.Path, args.Parent, files, args.DirectoryService, collectionType, true, true);
}
}
if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
{
- return FindMovie<Movie>(args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
+ return FindMovie<Movie>(args.Path, args.Parent, files, args.DirectoryService, collectionType, true, true);
}
return null;
@@ -359,7 +361,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns>Movie.</returns>
- private T FindMovie<T>(string path, Folder parent, List<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, string collectionType, bool allowFilesAsFolders)
+ private T FindMovie<T>(string path, Folder parent, List<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, string collectionType, bool allowFilesAsFolders, bool parseName)
where T : Video, new()
{
var multiDiscFolders = new List<FileSystemMetadata>();
@@ -413,7 +415,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
!string.Equals(collectionType, CollectionType.Photos) &&
!string.Equals(collectionType, CollectionType.MusicVideos);
- var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion, collectionType) ??
+ var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion, collectionType, parseName) ??
new MultiItemResolverResult();
if (result.Items.Count == 1)
diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs
index 4ee0f553f..ddab3caa5 100644
--- a/Emby.Server.Implementations/Library/UserViewManager.cs
+++ b/Emby.Server.Implementations/Library/UserViewManager.cs
@@ -95,13 +95,15 @@ namespace Emby.Server.Implementations.Library
if (parents.Count > 0)
{
- list.Add(GetUserView(parents, viewType, string.Empty, user, query.PresetViews, cancellationToken));
+ var localizationKey = viewType.Replace("Tv", string.Empty);
+
+ list.Add(GetUserView(parents, viewType, localizationKey, string.Empty, user, query.PresetViews, cancellationToken));
}
}
if (_config.Configuration.EnableFolderView)
{
- var name = _localizationManager.GetLocalizedString("ViewType" + CollectionType.Folders);
+ var name = _localizationManager.GetLocalizedString("Folders");
list.Add(_libraryManager.GetNamedView(name, CollectionType.Folders, string.Empty, cancellationToken));
}
@@ -158,21 +160,21 @@ namespace Emby.Server.Implementations.Library
.ToArray();
}
- public UserView GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken)
+ public UserView GetUserSubViewWithName(string name, string parentId, string type, string sortName, CancellationToken cancellationToken)
{
var uniqueId = parentId + "subview" + type;
return _libraryManager.GetNamedView(name, parentId, type, sortName, uniqueId, cancellationToken);
}
- public UserView GetUserSubView(string parentId, string type, string sortName, CancellationToken cancellationToken)
+ public UserView GetUserSubView(string parentId, string type, string localizationKey, string sortName, CancellationToken cancellationToken)
{
- var name = _localizationManager.GetLocalizedString("ViewType" + type);
+ var name = _localizationManager.GetLocalizedString(localizationKey);
- return GetUserSubView(name, parentId, type, sortName, cancellationToken);
+ return GetUserSubViewWithName(name, parentId, type, sortName, cancellationToken);
}
- private Folder GetUserView(List<ICollectionFolder> parents, string viewType, string sortName, User user, string[] presetViews, CancellationToken cancellationToken)
+ private Folder GetUserView(List<ICollectionFolder> parents, string viewType, string localizationKey, string sortName, User user, string[] presetViews, CancellationToken cancellationToken)
{
if (parents.Count == 1 && parents.All(i => string.Equals(i.CollectionType, viewType, StringComparison.OrdinalIgnoreCase)))
{
@@ -184,7 +186,7 @@ namespace Emby.Server.Implementations.Library
return GetUserView((Folder)parents[0], viewType, string.Empty, cancellationToken);
}
- var name = _localizationManager.GetLocalizedString("ViewType" + viewType);
+ var name = _localizationManager.GetLocalizedString(localizationKey);
return _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken);
}