From bba0c564c7f9db6a6d5d2b16b1c8ae453eeaed34 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 17 Oct 2016 12:35:29 -0400 Subject: remove dead interface objects --- .../Library/LibraryManager.cs | 2 +- .../LiveTv/EmbyTV/EmbyTV.cs | 18 +----------------- .../LiveTv/LiveTvDtoService.cs | 6 +++++- .../Photos/BaseDynamicImageProvider.cs | 2 +- .../Sorting/CriticRatingComparer.cs | 4 +--- 5 files changed, 9 insertions(+), 23 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index b2302cf86..a45d7ae5f 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -2838,7 +2838,7 @@ 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); } diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 9b69b84d3..0939d1c6b 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1854,23 +1854,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV ParentIndexNumber = program.SeasonNumber.Value, IndexNumber = program.EpisodeNumber.Value, AncestorIds = seriesIds, - ExcludeLocationTypes = new[] { LocationType.Virtual } - }); - - if (result.TotalRecordCount > 0) - { - return true; - } - } - - if (!string.IsNullOrWhiteSpace(program.EpisodeTitle)) - { - var result = _libraryManager.GetItemsResult(new InternalItemsQuery - { - IncludeItemTypes = new[] { typeof(Episode).Name }, - Name = program.EpisodeTitle, - AncestorIds = seriesIds, - ExcludeLocationTypes = new[] { LocationType.Virtual } + IsVirtualItem = false }); if (result.TotalRecordCount > 0) diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs index 8c46b4597..c7a2d295d 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -72,7 +72,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv { dto.ProgramInfo = _dtoService.GetBaseItemDto(program, new DtoOptions()); - dto.ProgramInfo.TimerId = dto.Id; + if (info.Status != RecordingStatus.Cancelled && info.Status != RecordingStatus.Error) + { + dto.ProgramInfo.TimerId = dto.Id; + dto.ProgramInfo.Status = info.Status.ToString(); + } dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId; } diff --git a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs index abf0f3425..22d7ba3be 100644 --- a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs @@ -144,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.Photos return ItemUpdateType.None; } - await ProviderManager.SaveImage(item, outputPath, "image/png", imageType, null, Guid.NewGuid().ToString("N"), cancellationToken).ConfigureAwait(false); + await ProviderManager.SaveImage(item, outputPath, "image/png", imageType, null, false, cancellationToken).ConfigureAwait(false); return ItemUpdateType.ImageUpdate; } diff --git a/MediaBrowser.Server.Implementations/Sorting/CriticRatingComparer.cs b/MediaBrowser.Server.Implementations/Sorting/CriticRatingComparer.cs index d01f7ed1b..9484130cb 100644 --- a/MediaBrowser.Server.Implementations/Sorting/CriticRatingComparer.cs +++ b/MediaBrowser.Server.Implementations/Sorting/CriticRatingComparer.cs @@ -22,9 +22,7 @@ namespace MediaBrowser.Server.Implementations.Sorting private float GetValue(BaseItem x) { - var hasCriticRating = x as IHasCriticRating; - - return hasCriticRating == null ? 0 : hasCriticRating.CriticRating ?? 0; + return x.CriticRating ?? 0; } /// -- cgit v1.2.3 From 716aef7e47fea61a003240d9df7f2575658eaea6 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 17 Oct 2016 12:40:43 -0400 Subject: update video resolver --- .../Library/Resolvers/Movies/MovieResolver.cs | 60 ++++++++++------------ 1 file changed, 28 insertions(+), 32 deletions(-) (limited to 'MediaBrowser.Server.Implementations') 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(args.Path, args.Parent, files, args.DirectoryService, collectionType, false); } if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase)) { - return null; + return FindMovie /// - /// The path. - /// The parent. - /// The file system entries. - /// The directory service. - /// Type of the collection. /// Movie. - private T FindMovie(string path, Folder parent, List fileSystemEntries, IDirectoryService directoryService, string collectionType) + private T FindMovie(string path, Folder parent, List fileSystemEntries, IDirectoryService directoryService, string collectionType, bool allowFilesAsFolders) where T : Video, new() { var multiDiscFolders = new List(); @@ -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(parent, fileSystemEntries, directoryService, supportsMultiVersion); + var result = ResolveVideos(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(multiDiscFolders, directoryService); + if (result.Items.Count == 0 && multiDiscFolders.Count > 0) + { + return GetMultiDiscMovie(multiDiscFolders, directoryService); + } } return null; -- cgit v1.2.3 From 9fb7bd1367a9fe85689d33860ed44a998cb54d3a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 17 Oct 2016 12:41:08 -0400 Subject: try to fix unhandled exception in file refresher --- MediaBrowser.Server.Implementations/IO/FileRefresher.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/IO/FileRefresher.cs b/MediaBrowser.Server.Implementations/IO/FileRefresher.cs index 3df7a03d4..c2c776c2b 100644 --- a/MediaBrowser.Server.Implementations/IO/FileRefresher.cs +++ b/MediaBrowser.Server.Implementations/IO/FileRefresher.cs @@ -45,6 +45,11 @@ namespace MediaBrowser.Server.Implementations.IO private void AddAffectedPath(string path) { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + if (!_affectedPaths.Contains(path, StringComparer.Ordinal)) { _affectedPaths.Add(path); @@ -53,6 +58,11 @@ namespace MediaBrowser.Server.Implementations.IO public void AddPath(string path) { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + lock (_timerLock) { AddAffectedPath(path); -- cgit v1.2.3