浏览代码

fix video probing

Luke Pulverenti 10 年之前
父节点
当前提交
84ec2aab95

+ 8 - 3
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -1624,14 +1624,19 @@ namespace MediaBrowser.Api.Playback
             var archivable = item as IArchivable;
             state.IsInputArchive = archivable != null && archivable.IsArchive;
 
-            MediaSourceInfo mediaSource = null;
+            MediaSourceInfo mediaSource;
             if (string.IsNullOrWhiteSpace(request.LiveStreamId))
             {
-                var mediaSources = await MediaSourceManager.GetPlayackMediaSources(request.Id, false, cancellationToken).ConfigureAwait(false);
+                var mediaSources = (await MediaSourceManager.GetPlayackMediaSources(request.Id, false, cancellationToken).ConfigureAwait(false)).ToList();
 
                 mediaSource = string.IsNullOrEmpty(request.MediaSourceId)
                    ? mediaSources.First()
-                   : mediaSources.First(i => string.Equals(i.Id, request.MediaSourceId));
+                   : mediaSources.FirstOrDefault(i => string.Equals(i.Id, request.MediaSourceId));
+
+                if (mediaSource == null && string.Equals(request.Id, request.MediaSourceId, StringComparison.OrdinalIgnoreCase))
+                {
+                    mediaSource = mediaSources.First();
+                }
             }
             else
             {

+ 1 - 1
MediaBrowser.Api/Playback/TranscodingThrottler.cs

@@ -42,7 +42,7 @@ namespace MediaBrowser.Api.Playback
 
             var options = GetOptions();
 
-            if (/*options.EnableThrottling &&*/ IsThrottleAllowed(_job, options.ThrottleThresholdSeconds))
+            if (options.EnableThrottling && IsThrottleAllowed(_job, options.ThrottleThresholdSeconds))
             {
                 PauseTranscoding();
             }

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

@@ -63,6 +63,11 @@ namespace MediaBrowser.MediaEncoding.Probing
             }
             else
             {
+                if (data.format != null && !string.IsNullOrEmpty(data.format.duration))
+                {
+                    info.RunTimeTicks = TimeSpan.FromSeconds(double.Parse(data.format.duration, _usCulture)).Ticks;
+                }
+
                 FetchWtvInfo(info, data);
 
                 if (data.Chapters != null)

+ 1 - 0
MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json

@@ -199,6 +199,7 @@
     "HeaderSplitMedia": "Split Media Apart",
     "MessageConfirmSplitMedia": "Are you sure you wish to split the media sources into separate items?",
     "HeaderError": "Error",
+    "MessageChromecastConnectionError": "Your Chromecast receiver is unable to connect to your Emby Server. Please check their connections and try again.",
     "MessagePleaseSelectOneItem": "Please select at least one item.",
     "MessagePleaseSelectTwoItems": "Please select at least two items.",
     "MessageTheFollowingItemsWillBeGrouped": "The following titles will be grouped into one item:",

+ 4 - 2
OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs

@@ -51,8 +51,10 @@ namespace XmlRpcHandler
             XmlWriterSettings sett = new XmlWriterSettings();
             sett.Indent = true;
 
+            var requestXmlPath = Path.Combine(Path.GetTempPath(), "request.xml");
+
             sett.Encoding = Encoding.UTF8;
-            FileStream str = new FileStream(Path.GetTempPath() + "\\request.xml", FileMode.Create, FileAccess.Write);
+            FileStream str = new FileStream(requestXmlPath, FileMode.Create, FileAccess.Write);
 
             XmlWriter XMLwrt = XmlWriter.Create(str, sett);
             // Let's write the methods
@@ -88,7 +90,7 @@ namespace XmlRpcHandler
             XMLwrt.Flush();
             XMLwrt.Close();
             str.Close();
-            string requestContent = File.ReadAllText(Path.GetTempPath() + "\\request.xml");
+            string requestContent = File.ReadAllText(requestXmlPath);
             return Encoding.UTF8.GetBytes(requestContent);
         }
         /// <summary>