瀏覽代碼

Merge branch 'master' into release-10.1.0

Joshua M. Boniface 6 年之前
父節點
當前提交
3518400b22
共有 2 個文件被更改,包括 9 次插入3 次删除
  1. 2 1
      CONTRIBUTORS.md
  2. 7 2
      MediaBrowser.Api/Subtitles/SubtitleService.cs

+ 2 - 1
CONTRIBUTORS.md

@@ -14,7 +14,8 @@
  - [grafixeyehero](https://github.com/grafixeyehero)
  - [grafixeyehero](https://github.com/grafixeyehero)
  - [cvium](https://github.com/cvium)
  - [cvium](https://github.com/cvium)
  - [wtayl0r](https://github.com/wtayl0r)
  - [wtayl0r](https://github.com/wtayl0r)
- 
+ - [TtheCreator](https://github.com/Tthecreator)
+
 # Emby Contributors
 # Emby Contributors
 
 
  - [LukePulverenti](https://github.com/LukePulverenti)
  - [LukePulverenti](https://github.com/LukePulverenti)

+ 7 - 2
MediaBrowser.Api/Subtitles/SubtitleService.cs

@@ -156,14 +156,19 @@ namespace MediaBrowser.Api.Subtitles
                 throw new ArgumentException("HLS Subtitles are not supported for this media.");
                 throw new ArgumentException("HLS Subtitles are not supported for this media.");
             }
             }
 
 
+            var segmentLengthTicks = TimeSpan.FromSeconds(request.SegmentLength).Ticks;
+            if (segmentLengthTicks <= 0)
+            {
+                throw new ArgumentException("segmentLength was not given, or it was given incorrectly. (It should be bigger than 0)");
+            }
+
             builder.AppendLine("#EXTM3U");
             builder.AppendLine("#EXTM3U");
             builder.AppendLine("#EXT-X-TARGETDURATION:" + request.SegmentLength.ToString(CultureInfo.InvariantCulture));
             builder.AppendLine("#EXT-X-TARGETDURATION:" + request.SegmentLength.ToString(CultureInfo.InvariantCulture));
             builder.AppendLine("#EXT-X-VERSION:3");
             builder.AppendLine("#EXT-X-VERSION:3");
             builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0");
             builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0");
             builder.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD");
             builder.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD");
 
 
-            long positionTicks = 0;
-            var segmentLengthTicks = TimeSpan.FromSeconds(request.SegmentLength).Ticks;
+            long positionTicks = 0; 
 
 
             var accessToken = _authContext.GetAuthorizationInfo(Request).Token;
             var accessToken = _authContext.GetAuthorizationInfo(Request).Token;