From 858be5d7885587320b389328484bbdf102fc9363 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 29 Dec 2013 21:41:22 -0500 Subject: [PATCH] update built in studio images --- .../Playback/Hls/HlsSegmentService.cs | 9 ++-- MediaBrowser.Controller/Entities/BaseItem.cs | 5 ++ MediaBrowser.Controller/Entities/Folder.cs | 1 + MediaBrowser.Mono.userprefs | 2 +- .../Studios/StudioImageProvider.cs | 2 +- MediaBrowser.Providers/Studios/thumbs.txt | 2 - .../IO/DirectoryWatchers.cs | 13 +++-- .../Library/CoreResolutionIgnoreRule.cs | 6 +++ .../Library/Resolvers/Movies/MovieResolver.cs | 16 +++--- .../LiveTv/LiveTvManager.cs | 2 +- .../Providers/ProviderManager.cs | 52 +++++++++++-------- .../ServerManager/ServerManager.cs | 2 +- .../Session/SessionManager.cs | 4 +- 13 files changed, 67 insertions(+), 49 deletions(-) diff --git a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs index 02a6326945..93e1a06a00 100644 --- a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs +++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs @@ -145,16 +145,13 @@ namespace MediaBrowser.Api.Playback.Hls } } - private void ExtendPlaylistTimer(string playlist) + private async void ExtendPlaylistTimer(string playlist) { ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlist, TranscodingJobType.Hls); - Task.Run(async () => - { - await Task.Delay(20000).ConfigureAwait(false); + await Task.Delay(20000).ConfigureAwait(false); - ApiEntryPoint.Instance.OnTranscodeEndRequest(playlist, TranscodingJobType.Hls); - }); + ApiEntryPoint.Instance.OnTranscodeEndRequest(playlist, TranscodingJobType.Hls); } } } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index a02369b2cb..11562b3d72 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1135,6 +1135,11 @@ namespace MediaBrowser.Controller.Entities { throw new ArgumentNullException(); } + if (IsInMixedFolder != copy.IsInMixedFolder) + { + Logger.Debug(Name + " changed due to different value for IsInMixedFolder."); + return true; + } var changed = copy.DateModified != DateModified; if (changed) diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index fed206a305..912b8fa93c 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -413,6 +413,7 @@ namespace MediaBrowser.Controller.Entities EntityResolutionHelper.EnsureDates(FileSystem, currentChild, child.ResolveArgs, false); } + currentChild.IsInMixedFolder = child.IsInMixedFolder; validChildren.Add(new Tuple(currentChild, true)); } else diff --git a/MediaBrowser.Mono.userprefs b/MediaBrowser.Mono.userprefs index d303a7993e..1815e61ca3 100644 --- a/MediaBrowser.Mono.userprefs +++ b/MediaBrowser.Mono.userprefs @@ -2,7 +2,7 @@ - + diff --git a/MediaBrowser.Providers/Studios/StudioImageProvider.cs b/MediaBrowser.Providers/Studios/StudioImageProvider.cs index 6a351b6886..6d8d023dbd 100644 --- a/MediaBrowser.Providers/Studios/StudioImageProvider.cs +++ b/MediaBrowser.Providers/Studios/StudioImageProvider.cs @@ -69,7 +69,7 @@ namespace MediaBrowser.Providers.Studios { get { - return "3"; + return "5"; } } diff --git a/MediaBrowser.Providers/Studios/thumbs.txt b/MediaBrowser.Providers/Studios/thumbs.txt index 0d3ad46119..95fed18f1a 100644 --- a/MediaBrowser.Providers/Studios/thumbs.txt +++ b/MediaBrowser.Providers/Studios/thumbs.txt @@ -29,7 +29,6 @@ Animal Planet Animation Domination High-Def Anime Network Aniplex -Anyone But Me, LLC Artists Den Entertainment Asian Crush Atlantic Records @@ -164,7 +163,6 @@ Food Network FORA.tv Ford FOX -Fox Business Fox College Sports Fox Movie Channel Fox News diff --git a/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs b/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs index a2240f52da..1efc3bc70f 100644 --- a/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs +++ b/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs @@ -529,27 +529,26 @@ namespace MediaBrowser.Server.Implementations.IO return; } - await Task.WhenAll(itemsToRefresh.Select(i => Task.Run(async () => + foreach (var item in itemsToRefresh) { - Logger.Info(i.Name + " (" + i.Path + ") will be refreshed."); + Logger.Info(item.Name + " (" + item.Path + ") will be refreshed."); try { - await i.ChangedExternally().ConfigureAwait(false); + await item.ChangedExternally().ConfigureAwait(false); } catch (IOException ex) { // For now swallow and log. // Research item: If an IOException occurs, the item may be in a disconnected state (media unavailable) // Should we remove it from it's parent? - Logger.ErrorException("Error refreshing {0}", ex, i.Name); + Logger.ErrorException("Error refreshing {0}", ex, item.Name); } catch (Exception ex) { - Logger.ErrorException("Error refreshing {0}", ex, i.Name); + Logger.ErrorException("Error refreshing {0}", ex, item.Name); } - - }))).ConfigureAwait(false); + } } /// diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs index 95ec416b67..5268faa4fe 100644 --- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs +++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs @@ -114,6 +114,12 @@ namespace MediaBrowser.Server.Implementations.Library { return true; } + + // Don't misidentify xbmc trailers as a movie + if (filename.IndexOf(BaseItem.XbmcTrailerFileSuffix, StringComparison.OrdinalIgnoreCase) != -1) + { + return true; + } } } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index 9b095a1564..3d6f7e66a5 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -91,31 +91,31 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies if (args.Path.IndexOf("[trailers]", StringComparison.OrdinalIgnoreCase) != -1 || string.Equals(collectionType, CollectionType.Trailers, StringComparison.OrdinalIgnoreCase)) { - return FindMovie(args.Path, args.FileSystemChildren); + return FindMovie(args.Path, args.Parent, args.FileSystemChildren); } if (args.Path.IndexOf("[musicvideos]", StringComparison.OrdinalIgnoreCase) != -1 || string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase)) { - return FindMovie(args.Path, args.FileSystemChildren); + return FindMovie(args.Path, args.Parent, args.FileSystemChildren); } if (args.Path.IndexOf("[adultvideos]", StringComparison.OrdinalIgnoreCase) != -1 || string.Equals(collectionType, CollectionType.AdultVideos, StringComparison.OrdinalIgnoreCase)) { - return FindMovie(args.Path, args.FileSystemChildren); + return FindMovie(args.Path, args.Parent, args.FileSystemChildren); } if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase)) { - return FindMovie /// /// The path. + /// The parent. /// The file system entries. /// Movie. - private T FindMovie(string path, IEnumerable fileSystemEntries) + private T FindMovie(string path, Folder parent, IEnumerable fileSystemEntries) where T : Video, new() { var movies = new List(); @@ -249,7 +250,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies var childArgs = new ItemResolveArgs(_applicationPaths, _libraryManager) { FileInfo = child, - Path = child.FullName + Path = child.FullName, + Parent = parent }; var item = ResolveVideo(childArgs); diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index a3790b097a..218c930df8 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -172,7 +172,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv var channel = GetInternalChannel(id); - return await service.GetRecordingStream(channel.ChannelInfo.Id, cancellationToken).ConfigureAwait(false); + return await service.GetChannelStream(channel.ChannelInfo.Id, cancellationToken).ConfigureAwait(false); } private async Task GetChannel(ChannelInfo channelInfo, string serviceName, CancellationToken cancellationToken) diff --git a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs index e9c6721518..cbfd7d74d3 100644 --- a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs +++ b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs @@ -380,33 +380,43 @@ namespace MediaBrowser.Server.Implementations.Providers var preferredLanguage = item.GetPreferredMetadataLanguage(); - var tasks = providers.Select(i => Task.Run(async () => + var tasks = providers.Select(i => GetImages(item, cancellationToken, i, preferredLanguage, type)); + + var results = await Task.WhenAll(tasks).ConfigureAwait(false); + + return results.SelectMany(i => i); + } + + /// + /// Gets the images. + /// + /// The item. + /// The cancellation token. + /// The i. + /// The preferred language. + /// The type. + /// Task{IEnumerable{RemoteImageInfo}}. + private async Task> GetImages(BaseItem item, CancellationToken cancellationToken, IImageProvider i, string preferredLanguage, ImageType? type = null) + { + try { - try + if (type.HasValue) { - if (type.HasValue) - { - var result = await i.GetImages(item, type.Value, cancellationToken).ConfigureAwait(false); + var result = await i.GetImages(item, type.Value, cancellationToken).ConfigureAwait(false); - return FilterImages(result, preferredLanguage); - } - else - { - var result = await i.GetAllImages(item, cancellationToken).ConfigureAwait(false); - return FilterImages(result, preferredLanguage); - } + return FilterImages(result, preferredLanguage); } - catch (Exception ex) + else { - _logger.ErrorException("{0} failed in GetImages for type {1}", ex, i.GetType().Name, item.GetType().Name); - return new List(); + var result = await i.GetAllImages(item, cancellationToken).ConfigureAwait(false); + return FilterImages(result, preferredLanguage); } - - }, cancellationToken)); - - var results = await Task.WhenAll(tasks).ConfigureAwait(false); - - return results.SelectMany(i => i); + } + catch (Exception ex) + { + _logger.ErrorException("{0} failed in GetImages for type {1}", ex, i.GetType().Name, item.GetType().Name); + return new List(); + } } private IEnumerable FilterImages(IEnumerable images, string preferredLanguage) diff --git a/MediaBrowser.Server.Implementations/ServerManager/ServerManager.cs b/MediaBrowser.Server.Implementations/ServerManager/ServerManager.cs index 553aae285d..a2dfb51d2f 100644 --- a/MediaBrowser.Server.Implementations/ServerManager/ServerManager.cs +++ b/MediaBrowser.Server.Implementations/ServerManager/ServerManager.cs @@ -243,7 +243,7 @@ namespace MediaBrowser.Server.Implementations.ServerManager /// The function that generates the data to send, if there are any connected clients public void SendWebSocketMessage(string messageType, Func dataFunction) { - Task.Run(async () => await SendWebSocketMessageAsync(messageType, dataFunction, CancellationToken.None).ConfigureAwait(false)); + SendWebSocketMessageAsync(messageType, dataFunction, CancellationToken.None); } /// diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 1a94b9c79b..c42f33ec3b 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -608,7 +608,7 @@ namespace MediaBrowser.Server.Implementations.Session _logger.ErrorException("Error in SendServerShutdownNotification.", ex); } - })); + }, cancellationToken)); return Task.WhenAll(tasks); } @@ -633,7 +633,7 @@ namespace MediaBrowser.Server.Implementations.Session _logger.ErrorException("Error in SendServerRestartNotification.", ex); } - })); + }, cancellationToken)); return Task.WhenAll(tasks); }