diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index dc811812a..87fa3d46c 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -126,9 +126,10 @@ namespace MediaBrowser.Api /// true to release both managed and unmanaged resources; false to release only unmanaged resources. protected virtual void Dispose(bool dispose) { - var jobCount = _activeTranscodingJobs.Count; + var list = _activeTranscodingJobs.ToList(); + var jobCount = list.Count; - Parallel.ForEach(_activeTranscodingJobs.ToList(), j => KillTranscodingJob(j, false, path => true)); + Parallel.ForEach(list, j => KillTranscodingJob(j, false, path => true)); // Try to allow for some time to kill the ffmpeg processes and delete the partial stream files if (jobCount > 0) diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index d75b8947a..449100fc4 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -175,7 +175,9 @@ namespace MediaBrowser.Api.Playback.Progressive ResponseHeaders = responseHeaders, ContentType = contentType, IsHeadRequest = isHeadRequest, - Path = outputPath + Path = outputPath, + FileShare = FileShare.ReadWrite + }).ConfigureAwait(false); } finally @@ -187,8 +189,7 @@ namespace MediaBrowser.Api.Playback.Progressive // Need to start ffmpeg try { - return await GetStreamResult(state, responseHeaders, isHeadRequest, cancellationTokenSource) - .ConfigureAwait(false); + return await GetStreamResult(state, responseHeaders, isHeadRequest, cancellationTokenSource).ConfigureAwait(false); } catch { diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index da6be97b6..d97169fa5 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -208,7 +208,7 @@ namespace MediaBrowser.Api.Playback private async void DisposeLiveStream() { - if (MediaSource.RequiresClosing && string.IsNullOrWhiteSpace(Request.LiveStreamId)) + if (MediaSource.RequiresClosing && string.IsNullOrWhiteSpace(Request.LiveStreamId) && !string.IsNullOrWhiteSpace(MediaSource.LiveStreamId)) { try { diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs index 465677efb..3de330557 100644 --- a/MediaBrowser.Providers/Manager/ImageSaver.cs +++ b/MediaBrowser.Providers/Manager/ImageSaver.cs @@ -133,6 +133,9 @@ namespace MediaBrowser.Providers.Manager source = memoryStream; var currentImage = GetCurrentImage(item, type, index); + var currentImageIsLocalFile = currentImage != null && currentImage.IsLocalFile; + var currentImagePath = currentImage == null ? null : currentImage.Path; + var savedPaths = new List(); using (source) @@ -157,9 +160,9 @@ namespace MediaBrowser.Providers.Manager SetImagePath(item, type, imageIndex, savedPaths[0]); // Delete the current path - if (currentImage != null && currentImage.IsLocalFile && !savedPaths.Contains(currentImage.Path, StringComparer.OrdinalIgnoreCase)) + if (currentImageIsLocalFile && !savedPaths.Contains(currentImagePath, StringComparer.OrdinalIgnoreCase)) { - var currentPath = currentImage.Path; + var currentPath = currentImagePath; _logger.Debug("Deleting previous image {0}", currentPath); diff --git a/MediaBrowser.Providers/TV/EpisodeMetadataService.cs b/MediaBrowser.Providers/TV/EpisodeMetadataService.cs index b51b11380..90a185ce0 100644 --- a/MediaBrowser.Providers/TV/EpisodeMetadataService.cs +++ b/MediaBrowser.Providers/TV/EpisodeMetadataService.cs @@ -39,6 +39,20 @@ namespace MediaBrowser.Providers.TV updateType |= ItemUpdateType.MetadataImport; } } + if (updateType <= ItemUpdateType.None) + { + if (item.SeriesId != item.FindSeriesId()) + { + updateType |= ItemUpdateType.MetadataImport; + } + } + if (updateType <= ItemUpdateType.None) + { + if (item.SeasonId != item.FindSeasonId()) + { + updateType |= ItemUpdateType.MetadataImport; + } + } return updateType; } diff --git a/MediaBrowser.Providers/TV/SeasonMetadataService.cs b/MediaBrowser.Providers/TV/SeasonMetadataService.cs index f3e6f8e9c..addab3918 100644 --- a/MediaBrowser.Providers/TV/SeasonMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeasonMetadataService.cs @@ -49,6 +49,13 @@ namespace MediaBrowser.Providers.TV updateType |= ItemUpdateType.MetadataImport; } } + if (updateType <= ItemUpdateType.None) + { + if (item.SeriesId != item.FindSeriesId()) + { + updateType |= ItemUpdateType.MetadataImport; + } + } return updateType; } diff --git a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs index 4f3fe1bf3..696bd0f4d 100644 --- a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs +++ b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs @@ -446,8 +446,31 @@ namespace MediaBrowser.Server.Implementations.Library } } + private async Task CloseLiveStreamWithProvider(IMediaSourceProvider provider, string streamId, CancellationToken cancellationToken) + { + _logger.Info("Closing live stream {0} with provider {1}", streamId, provider.GetType().Name); + + try + { + await provider.CloseMediaSource(streamId, cancellationToken).ConfigureAwait(false); + } + catch (NotImplementedException) + { + + } + catch (Exception ex) + { + _logger.ErrorException("Error closing live stream {0}", ex, streamId); + } + } + public async Task CloseLiveStream(string id, CancellationToken cancellationToken) { + if (string.IsNullOrWhiteSpace(id)) + { + throw new ArgumentNullException("id"); + } + await _liveStreamSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false); try @@ -459,7 +482,7 @@ namespace MediaBrowser.Server.Implementations.Library { var tuple = GetProvider(id); - await tuple.Item1.CloseMediaSource(tuple.Item2, cancellationToken).ConfigureAwait(false); + await CloseLiveStreamWithProvider(tuple.Item1, tuple.Item2, cancellationToken).ConfigureAwait(false); } } diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 5c520afcf..46178dd9a 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -242,12 +242,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -386,6 +380,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -785,9 +782,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -1347,11 +1341,6 @@ PreserveNewest - - - PreserveNewest - - PreserveNewest @@ -1405,11 +1394,6 @@ PreserveNewest - - - PreserveNewest - - PreserveNewest @@ -1425,24 +1409,6 @@ PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - PreserveNewest - - - - - PreserveNewest - - PreserveNewest @@ -1487,9 +1453,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest diff --git a/SharedVersion.cs b/SharedVersion.cs index 3b18c027e..8de20ebed 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; -//[assembly: AssemblyVersion("3.1.*")] -[assembly: AssemblyVersion("3.1.80")] +[assembly: AssemblyVersion("3.1.*")] +//[assembly: AssemblyVersion("3.1.80")]