aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Library')
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs26
-rw-r--r--Emby.Server.Implementations/Library/LocalTrailerPostScanTask.cs7
-rw-r--r--Emby.Server.Implementations/Library/MediaSourceManager.cs16
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs10
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs72
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs49
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs33
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs4
-rw-r--r--Emby.Server.Implementations/Library/UserViewManager.cs26
9 files changed, 155 insertions, 88 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index 85b91ac25..cac1cb3b4 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -738,8 +738,7 @@ namespace Emby.Server.Implementations.Library
if (folder.ParentId != rootFolder.Id)
{
folder.ParentId = rootFolder.Id;
- var task = folder.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
- Task.WaitAll(task);
+ folder.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
}
rootFolder.AddVirtualChild(folder);
@@ -1827,6 +1826,13 @@ namespace Emby.Server.Implementations.Library
}
}
+ public void UpdateImages(BaseItem item)
+ {
+ ItemRepository.SaveImages(item);
+
+ RegisterItem(item);
+ }
+
/// <summary>
/// Updates the item.
/// </summary>
@@ -1834,12 +1840,12 @@ namespace Emby.Server.Implementations.Library
/// <param name="updateReason">The update reason.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- public async Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken)
+ public void UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken)
{
var locationType = item.LocationType;
if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
{
- await _providerManagerFactory().SaveMetadata(item, updateReason).ConfigureAwait(false);
+ _providerManagerFactory().SaveMetadata(item, updateReason);
}
item.DateLastSaved = DateTime.UtcNow;
@@ -2053,7 +2059,7 @@ namespace Emby.Server.Implementations.Library
return GetNamedView(user, name, null, viewType, sortName, cancellationToken);
}
- public async Task<UserView> GetNamedView(string name,
+ public UserView GetNamedView(string name,
string viewType,
string sortName,
CancellationToken cancellationToken)
@@ -2100,7 +2106,7 @@ namespace Emby.Server.Implementations.Library
if (refresh)
{
- await item.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None).ConfigureAwait(false);
+ item.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
{
// Not sure why this is necessary but need to figure it out
@@ -2241,7 +2247,7 @@ namespace Emby.Server.Implementations.Library
return item;
}
- public async Task<UserView> GetNamedView(string name,
+ public UserView GetNamedView(string name,
string parentId,
string viewType,
string sortName,
@@ -2294,7 +2300,7 @@ namespace Emby.Server.Implementations.Library
if (!string.Equals(viewType, item.ViewType, StringComparison.OrdinalIgnoreCase))
{
item.ViewType = viewType;
- await item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
+ item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken);
}
var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval;
@@ -2822,7 +2828,7 @@ namespace Emby.Server.Implementations.Library
await _providerManagerFactory().SaveImage(item, url, image.Type, imageIndex, CancellationToken.None).ConfigureAwait(false);
- await item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false);
+ item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
return item.GetImageInfo(image.Type, imageIndex);
}
@@ -2838,7 +2844,7 @@ namespace Emby.Server.Implementations.Library
// Remove this image to prevent it from retrying over and over
item.RemoveImage(image);
- await item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false);
+ item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
throw new InvalidOperationException();
}
diff --git a/Emby.Server.Implementations/Library/LocalTrailerPostScanTask.cs b/Emby.Server.Implementations/Library/LocalTrailerPostScanTask.cs
index 757e67eb4..4830da8fc 100644
--- a/Emby.Server.Implementations/Library/LocalTrailerPostScanTask.cs
+++ b/Emby.Server.Implementations/Library/LocalTrailerPostScanTask.cs
@@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.Library
{
cancellationToken.ThrowIfCancellationRequested();
- await AssignTrailers(item, trailers).ConfigureAwait(false);
+ AssignTrailers(item, trailers);
numComplete++;
double percent = numComplete;
@@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.Library
progress.Report(100);
}
- private async Task AssignTrailers(IHasTrailers item, IEnumerable<BaseItem> channelTrailers)
+ private void AssignTrailers(IHasTrailers item, IEnumerable<BaseItem> channelTrailers)
{
if (item is Game)
{
@@ -98,8 +98,7 @@ namespace Emby.Server.Implementations.Library
item.RemoteTrailerIds = trailerIds;
var baseItem = (BaseItem)item;
- await baseItem.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None)
- .ConfigureAwait(false);
+ baseItem.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
}
}
}
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs
index d60a04353..688da5764 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -96,23 +96,17 @@ namespace Emby.Server.Implementations.Library
return GetMediaStreamsForItem(list);
}
- private List<MediaStream> GetMediaStreamsForItem(IEnumerable<MediaStream> streams)
+ private List<MediaStream> GetMediaStreamsForItem(List<MediaStream> streams)
{
- var list = streams.ToList();
-
- var subtitleStreams = list
- .Where(i => i.Type == MediaStreamType.Subtitle)
- .ToList();
-
- if (subtitleStreams.Count > 0)
+ foreach (var stream in streams)
{
- foreach (var subStream in subtitleStreams)
+ if (stream.Type == MediaStreamType.Subtitle)
{
- subStream.SupportsExternalStream = StreamSupportsExternalStream(subStream);
+ stream.SupportsExternalStream = StreamSupportsExternalStream(stream);
}
}
- return list;
+ return streams;
}
public async Task<IEnumerable<MediaSourceInfo>> GetPlayackMediaSources(string id, string userId, bool enablePathSubstitution, string[] supportedLiveMediaTypes, CancellationToken cancellationToken)
diff --git a/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs
index 4852c3c6a..7aa4c299f 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs
@@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
/// </summary>
public class BookResolver : MediaBrowser.Controller.Resolvers.ItemResolver<Book>
{
- private readonly string[] _validExtensions = {".pdf", ".epub", ".mobi", ".cbr", ".cbz"};
+ private readonly string[] _validExtensions = { ".pdf", ".epub", ".mobi", ".cbr", ".cbz", ".azw3" };
/// <summary>
///
@@ -26,7 +26,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
// Only process items that are in a collection folder containing books
if (!string.Equals(collectionType, CollectionType.Books, StringComparison.OrdinalIgnoreCase))
return null;
-
+
if (args.IsDirectory)
{
return GetBook(args);
@@ -69,9 +69,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
return null;
return new Book
- {
- Path = bookFiles[0].FullName
- };
+ {
+ Path = bookFiles[0].FullName
+ };
}
}
}
diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index cd1264754..94cafa3e2 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -11,7 +11,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-
+using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
@@ -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>();
@@ -147,7 +147,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
Items = videos
};
- var isInMixedFolder = resolverResult.Count > 1;
+ var isInMixedFolder = resolverResult.Count > 1 || (parent != null && parent.IsTopParent);
foreach (var video in resolverResult)
{
@@ -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, args.Path, args.Parent, files, args.DirectoryService, collectionType, 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, args.Path, args.Parent, files, args.DirectoryService, collectionType, 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, args.Path, args.Parent, files, args.DirectoryService, collectionType, 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, args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
}
return null;
@@ -359,11 +361,15 @@ 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>(ItemResolveArgs args, string path, Folder parent, List<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, string collectionType, bool parseName)
where T : Video, new()
{
var multiDiscFolders = new List<FileSystemMetadata>();
+ var libraryOptions = args.GetLibraryOptions();
+ var supportPhotos = string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && libraryOptions.EnablePhotos;
+ var photos = new List<FileSystemMetadata>();
+
// Search for a folder rip
foreach (var child in fileSystemEntries)
{
@@ -404,30 +410,37 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
Set3DFormat(movie);
return movie;
}
+ else if (supportPhotos && !child.IsHidden && PhotoResolver.IsImageFile(child.FullName, _imageProcessor))
+ {
+ photos.Add(child);
+ }
}
- if (allowFilesAsFolders)
- {
- // TODO: Allow GetMultiDiscMovie in here
- var supportsMultiVersion = !string.Equals(collectionType, CollectionType.HomeVideos) &&
- !string.Equals(collectionType, CollectionType.Photos) &&
- !string.Equals(collectionType, CollectionType.MusicVideos);
+ // 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, collectionType, parseName) ??
+ new MultiItemResolverResult();
- var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion, collectionType) ??
- new MultiItemResolverResult();
+ if (result.Items.Count == 1)
+ {
+ var videoPath = result.Items[0].Path;
+ var hasPhotos = photos.Any(i => !PhotoResolver.IsOwnedByResolvedMedia(LibraryManager, libraryOptions, videoPath, i.Name));
- if (result.Items.Count == 1)
+ if (!hasPhotos)
{
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;
@@ -542,8 +555,11 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
return !validCollectionTypes.Contains(collectionType, StringComparer.OrdinalIgnoreCase);
}
- public MovieResolver(ILibraryManager libraryManager, IFileSystem fileSystem) : base(libraryManager, fileSystem)
+ private IImageProcessor _imageProcessor;
+
+ public MovieResolver(ILibraryManager libraryManager, IFileSystem fileSystem, IImageProcessor imageProcessor) : base(libraryManager, fileSystem)
{
+ _imageProcessor = imageProcessor;
}
}
}
diff --git a/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs b/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs
index 3d7ede879..311abf14e 100644
--- a/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs
@@ -12,9 +12,12 @@ namespace Emby.Server.Implementations.Library.Resolvers
public class PhotoAlbumResolver : FolderResolver<PhotoAlbum>
{
private readonly IImageProcessor _imageProcessor;
- public PhotoAlbumResolver(IImageProcessor imageProcessor)
+ private ILibraryManager _libraryManager;
+
+ public PhotoAlbumResolver(IImageProcessor imageProcessor, ILibraryManager libraryManager)
{
_imageProcessor = imageProcessor;
+ _libraryManager = libraryManager;
}
/// <summary>
@@ -25,14 +28,21 @@ namespace Emby.Server.Implementations.Library.Resolvers
protected override PhotoAlbum Resolve(ItemResolveArgs args)
{
// Must be an image file within a photo collection
- if (args.IsDirectory && string.Equals(args.GetCollectionType(), CollectionType.Photos, StringComparison.OrdinalIgnoreCase))
+ if (args.IsDirectory)
{
- if (HasPhotos(args))
+ // Must be an image file within a photo collection
+ var collectionType = args.GetCollectionType();
+
+ if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase) ||
+ (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.GetLibraryOptions().EnablePhotos))
{
- return new PhotoAlbum
+ if (HasPhotos(args))
{
- Path = args.Path
- };
+ return new PhotoAlbum
+ {
+ Path = args.Path
+ };
+ }
}
}
@@ -41,7 +51,32 @@ namespace Emby.Server.Implementations.Library.Resolvers
private bool HasPhotos(ItemResolveArgs args)
{
- return args.FileSystemChildren.Any(i => (!i.IsDirectory) && PhotoResolver.IsImageFile(i.FullName, _imageProcessor));
+ var files = args.FileSystemChildren;
+
+ foreach (var file in files)
+ {
+ if (!file.IsDirectory && PhotoResolver.IsImageFile(file.FullName, _imageProcessor))
+ {
+ var libraryOptions = args.GetLibraryOptions();
+ var filename = file.Name;
+ var ownedByMedia = false;
+
+ foreach (var siblingFile in files)
+ {
+ if (PhotoResolver.IsOwnedByMedia(_libraryManager, libraryOptions, siblingFile.FullName, filename))
+ {
+ ownedByMedia = true;
+ break;
+ }
+ }
+
+ if (!ownedByMedia)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
}
public override ResolverPriority Priority
diff --git a/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs b/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs
index 04312f277..48f5802a9 100644
--- a/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs
@@ -35,7 +35,6 @@ namespace Emby.Server.Implementations.Library.Resolvers
// Must be an image file within a photo collection
var collectionType = args.GetCollectionType();
-
if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase) ||
(string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.GetLibraryOptions().EnablePhotos))
{
@@ -44,9 +43,15 @@ namespace Emby.Server.Implementations.Library.Resolvers
var filename = Path.GetFileNameWithoutExtension(args.Path);
// Make sure the image doesn't belong to a video file
- if (_fileSystem.GetFilePaths(_fileSystem.GetDirectoryName(args.Path)).Any(i => IsOwnedByMedia(args.GetLibraryOptions(), i, filename)))
+ var files = args.DirectoryService.GetFiles(_fileSystem.GetDirectoryName(args.Path));
+ var libraryOptions = args.GetLibraryOptions();
+
+ foreach (var file in files)
{
- return null;
+ if (IsOwnedByMedia(_libraryManager, libraryOptions, file.FullName, filename))
+ {
+ return null;
+ }
}
return new Photo
@@ -60,14 +65,21 @@ namespace Emby.Server.Implementations.Library.Resolvers
return null;
}
- private bool IsOwnedByMedia(LibraryOptions libraryOptions, string file, string imageFilename)
+ internal static bool IsOwnedByMedia(ILibraryManager libraryManager, LibraryOptions libraryOptions, string file, string imageFilename)
{
- if (_libraryManager.IsVideoFile(file, libraryOptions))
+ if (libraryManager.IsVideoFile(file, libraryOptions))
{
- if (imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase))
- {
- return true;
- }
+ return IsOwnedByResolvedMedia(libraryManager, libraryOptions, file, imageFilename);
+ }
+
+ return false;
+ }
+
+ internal static bool IsOwnedByResolvedMedia(ILibraryManager libraryManager, LibraryOptions libraryOptions, string file, string imageFilename)
+ {
+ if (imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
}
return false;
@@ -81,7 +93,8 @@ namespace Emby.Server.Implementations.Library.Resolvers
"fanart",
"backdrop",
"poster",
- "cover"
+ "cover",
+ "logo"
};
internal static bool IsImageFile(string path, IImageProcessor imageProcessor)
diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
index a859d8ec8..a0ff29482 100644
--- a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
@@ -55,10 +55,10 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
if (season.IndexNumber.HasValue)
{
var seasonNumber = season.IndexNumber.Value;
-
+
season.Name = seasonNumber == 0 ?
args.LibraryOptions.SeasonZeroDisplayName :
- string.Format(_localization.GetLocalizedString("NameSeasonNumber"), seasonNumber.ToString(UsCulture));
+ string.Format(_localization.GetLocalizedString("NameSeasonNumber"), seasonNumber.ToString(UsCulture), args.GetLibraryOptions().PreferredMetadataLanguage);
}
return season;
diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs
index 8c9377291..e97bf11c3 100644
--- a/Emby.Server.Implementations/Library/UserViewManager.cs
+++ b/Emby.Server.Implementations/Library/UserViewManager.cs
@@ -95,14 +95,18 @@ namespace Emby.Server.Implementations.Library
if (parents.Count > 0)
{
- list.Add(GetUserView(parents, viewType, string.Empty, user, query.PresetViews, cancellationToken));
+ var localizationKey = string.Equals(viewType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ?
+ "TvShows" :
+ "Movies";
+
+ list.Add(GetUserView(parents, viewType, localizationKey, string.Empty, user, query.PresetViews, cancellationToken));
}
}
if (_config.Configuration.EnableFolderView)
{
- var name = _localizationManager.GetLocalizedString("ViewType" + CollectionType.Folders);
- list.Add(await _libraryManager.GetNamedView(name, CollectionType.Folders, string.Empty, cancellationToken).ConfigureAwait(false));
+ var name = _localizationManager.GetLocalizedString("Folders");
+ list.Add(_libraryManager.GetNamedView(name, CollectionType.Folders, string.Empty, cancellationToken));
}
if (query.IncludeExternalContent)
@@ -117,7 +121,7 @@ namespace Emby.Server.Implementations.Library
if (_config.Configuration.EnableChannelView && channels.Length > 0)
{
- list.Add(await _channelManager.GetInternalChannelFolder(cancellationToken).ConfigureAwait(false));
+ list.Add(_channelManager.GetInternalChannelFolder(cancellationToken));
}
else
{
@@ -126,7 +130,7 @@ namespace Emby.Server.Implementations.Library
if (_liveTvManager.GetEnabledUsers().Select(i => i.Id.ToString("N")).Contains(query.UserId))
{
- list.Add(await _liveTvManager.GetInternalLiveTvFolder(CancellationToken.None).ConfigureAwait(false));
+ list.Add(_liveTvManager.GetInternalLiveTvFolder(CancellationToken.None));
}
}
@@ -158,21 +162,21 @@ namespace Emby.Server.Implementations.Library
.ToArray();
}
- public Task<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 Task<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 +188,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);
}