Sfoglia il codice sorgente

Merge pull request #2045 from MediaBrowser/beta

Beta
Luke 9 anni fa
parent
commit
69ae84d504

+ 10 - 1
MediaBrowser.Api/ApiEntryPoint.cs

@@ -63,6 +63,15 @@ namespace MediaBrowser.Api
 
             Instance = this;
             _sessionManager.PlaybackProgress += _sessionManager_PlaybackProgress;
+            _sessionManager.PlaybackStart += _sessionManager_PlaybackStart;
+        }
+
+        private void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e)
+        {
+            if (!string.IsNullOrWhiteSpace(e.PlaySessionId))
+            {
+                PingTranscodingJob(e.PlaySessionId, e.IsPaused);
+            }
         }
 
         void _sessionManager_PlaybackProgress(object sender, PlaybackProgressEventArgs e)
@@ -401,7 +410,7 @@ namespace MediaBrowser.Api
                 }
             }
 
-            Logger.Debug("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
+            Logger.Info("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
 
             KillTranscodingJob(job, true, path => true);
         }

+ 34 - 34
MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs

@@ -165,40 +165,40 @@ namespace MediaBrowser.Api.Playback.Progressive
                 }
             }
 
-            // Not static but transcode cache file exists
-            if (isTranscodeCached)
-            {
-                var contentType = state.GetMimeType(outputPath);
-
-                try
-                {
-                    if (transcodingJob != null)
-                    {
-                        ApiEntryPoint.Instance.OnTranscodeBeginRequest(transcodingJob);
-                    }
-
-                    return await ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
-                    {
-                        ResponseHeaders = responseHeaders,
-                        ContentType = contentType,
-                        IsHeadRequest = isHeadRequest,
-                        Path = outputPath,
-                        FileShare = FileShare.ReadWrite,
-                        OnComplete = () =>
-                        {
-                            if (transcodingJob != null)
-                            {
-                                ApiEntryPoint.Instance.OnTranscodeEndRequest(transcodingJob);
-                            }
-                        }
-
-                    }).ConfigureAwait(false);
-                }
-                finally
-                {
-                    state.Dispose();
-                }
-            }
+            //// Not static but transcode cache file exists
+            //if (isTranscodeCached && state.VideoRequest == null)
+            //{
+            //    var contentType = state.GetMimeType(outputPath);
+
+            //    try
+            //    {
+            //        if (transcodingJob != null)
+            //        {
+            //            ApiEntryPoint.Instance.OnTranscodeBeginRequest(transcodingJob);
+            //        }
+
+            //        return await ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
+            //        {
+            //            ResponseHeaders = responseHeaders,
+            //            ContentType = contentType,
+            //            IsHeadRequest = isHeadRequest,
+            //            Path = outputPath,
+            //            FileShare = FileShare.ReadWrite,
+            //            OnComplete = () =>
+            //            {
+            //                if (transcodingJob != null)
+            //                {
+            //                    ApiEntryPoint.Instance.OnTranscodeEndRequest(transcodingJob);
+            //                }
+            //            }
+
+            //        }).ConfigureAwait(false);
+            //    }
+            //    finally
+            //    {
+            //        state.Dispose();
+            //    }
+            //}
 
             // Need to start ffmpeg
             try

+ 13 - 3
MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs

@@ -1,6 +1,7 @@
 using MediaBrowser.Model.Serialization;
 using System;
 using System.Collections.Concurrent;
+using System.Collections.Generic;
 using System.IO;
 using System.Xml;
 using CommonIO;
@@ -24,13 +25,22 @@ namespace MediaBrowser.Common.Implementations.Serialization
 
         // Need to cache these
         // http://dotnetcodebox.blogspot.com/2013/01/xmlserializer-class-may-result-in.html
-        private readonly ConcurrentDictionary<string, System.Xml.Serialization.XmlSerializer> _serializers =
-            new ConcurrentDictionary<string, System.Xml.Serialization.XmlSerializer>();
+        private readonly Dictionary<string, System.Xml.Serialization.XmlSerializer> _serializers =
+            new Dictionary<string, System.Xml.Serialization.XmlSerializer>();
 
         private System.Xml.Serialization.XmlSerializer GetSerializer(Type type)
         {
             var key = type.FullName;
-            return _serializers.GetOrAdd(key, k => new System.Xml.Serialization.XmlSerializer(type));
+            lock (_serializers)
+            {
+                System.Xml.Serialization.XmlSerializer serializer;
+                if (!_serializers.TryGetValue(key, out serializer))
+                {
+                    serializer = new System.Xml.Serialization.XmlSerializer(type);
+                    _serializers[key] = serializer;
+                }
+                return serializer;
+            }
         }
 
         /// <summary>

+ 10 - 0
MediaBrowser.Controller/Entities/Folder.cs

@@ -13,6 +13,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using CommonIO;
 using MediaBrowser.Controller.Channels;
+using MediaBrowser.Controller.Entities.TV;
 using MediaBrowser.Model.Channels;
 
 namespace MediaBrowser.Controller.Entities
@@ -882,6 +883,15 @@ namespace MediaBrowser.Controller.Entities
                 return true;
             }
 
+            if (query.IsPlayed.HasValue)
+            {
+                if (query.IncludeItemTypes.Length == 1 && query.IncludeItemTypes.Contains(typeof(Series).Name))
+                {
+                    Logger.Debug("Query requires post-filtering due to IsPlayed");
+                    return true;
+                }
+            }
+
             return false;
         }
 

+ 6 - 0
MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs

@@ -168,6 +168,12 @@ namespace MediaBrowser.MediaEncoding.Probing
                 }
 
                 ExtractTimestamp(info);
+
+                var stereoMode = GetDictionaryValue(tags, "stereo_mode");
+                if (string.Equals(stereoMode, "left_right", StringComparison.OrdinalIgnoreCase))
+                {
+                    info.Video3DFormat = Video3DFormat.FullSideBySide;
+                }
             }
 
             return info;

+ 2 - 0
MediaBrowser.Model/ApiClient/IApiClient.cs

@@ -302,6 +302,8 @@ namespace MediaBrowser.Model.ApiClient
         /// <returns>Task{ItemsResult}.</returns>
         Task<ItemsResult> GetSeasonsAsync(SeasonQuery query, CancellationToken cancellationToken = default(CancellationToken));
 
+        Task<PluginSecurityInfo> GetRegistrationInfo();
+
         /// <summary>
         /// Queries for items
         /// </summary>

+ 2 - 0
MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

@@ -231,6 +231,8 @@ namespace MediaBrowser.Providers.MediaInfo
             video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle);
             video.Timestamp = mediaInfo.Timestamp;
 
+            video.Video3DFormat = video.Video3DFormat ?? mediaInfo.Video3DFormat;
+
             await _itemRepo.SaveMediaStreams(video.Id, mediaStreams, cancellationToken).ConfigureAwait(false);
 
             if (options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh ||

+ 1 - 0
MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -81,6 +81,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
                 {typeof (ApplicationException), 500}
             };
 
+            HostConfig.Instance.GlobalResponseHeaders = new Dictionary<string, string>();
             HostConfig.Instance.DebugMode = false;
 
             HostConfig.Instance.LogFactory = LogManager.LogFactory;

+ 4 - 2
MediaBrowser.Server.Implementations/Library/Validators/PeopleValidator.cs

@@ -115,6 +115,8 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
 
             _logger.Debug("Will refresh {0} people", dict.Count);
 
+            var numPeople = dict.Count;
+
             foreach (var person in dict)
             {
                 cancellationToken.ThrowIfCancellationRequested();
@@ -124,7 +126,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
                     var item = _libraryManager.GetPerson(person.Key);
 
                     var hasMetdata = !string.IsNullOrWhiteSpace(item.Overview);
-                    var performFullRefresh = !hasMetdata && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= 90;
+                    var performFullRefresh = !hasMetdata && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= 60;
 
                     var defaultMetadataRefreshMode = performFullRefresh
                         ? MetadataRefreshMode.FullRefresh
@@ -155,7 +157,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
                 // Update progress
                 numComplete++;
                 double percent = numComplete;
-                percent /= people.Count;
+                percent /= numPeople;
 
                 progress.Report(100 * percent);
             }

+ 1 - 1
MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs

@@ -72,7 +72,7 @@ namespace MediaBrowser.Server.Implementations.UserViews
                 User = view.UserId.HasValue ? _userManager.GetUserById(view.UserId.Value) : null,
                 CollapseBoxSetItems = false,
                 Recursive = recursive,
-                ExcludeItemTypes = new[] { "UserView", "CollectionFolder" }
+                ExcludeItemTypes = new[] { "UserView", "CollectionFolder", "Person" },
 
             }).ConfigureAwait(false);