浏览代码

remove hardcoded stream params

Luke Pulverenti 11 年之前
父节点
当前提交
60bf0edbde

+ 53 - 2
MediaBrowser.Api/Library/FileOrganizationService.cs

@@ -25,9 +25,15 @@ namespace MediaBrowser.Api.Library
         public int? Limit { get; set; }
     }
 
+    [Route("/Library/FileOrganizations", "DELETE")]
+    [Api(Description = "Clears the activity log")]
+    public class ClearOrganizationLog : IReturnVoid
+    {
+    }
+
     [Route("/Library/FileOrganizations/{Id}/File", "DELETE")]
     [Api(Description = "Deletes the original file of a organizer result")]
-    public class DeleteOriginalFile : IReturn<QueryResult<FileOrganizationResult>>
+    public class DeleteOriginalFile : IReturnVoid
     {
         /// <summary>
         /// Gets or sets the id.
@@ -48,7 +54,30 @@ namespace MediaBrowser.Api.Library
         [ApiMember(Name = "Id", Description = "Result Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
         public string Id { get; set; }
     }
-    
+
+    [Route("/Library/FileOrganizations/{Id}/Episode/Organize", "POST")]
+    [Api(Description = "Performs an organization")]
+    public class OrganizeEpisode
+    {
+        [ApiMember(Name = "Id", Description = "Result Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
+        public string Id { get; set; }
+
+        [ApiMember(Name = "SeriesId", Description = "Series Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
+        public string SeriesId { get; set; }
+
+        [ApiMember(Name = "SeasonNumber", IsRequired = true, DataType = "int", ParameterType = "query", Verb = "POST")]
+        public int SeasonNumber { get; set; }
+
+        [ApiMember(Name = "EpisodeNumber", IsRequired = true, DataType = "int", ParameterType = "query", Verb = "POST")]
+        public int EpisodeNumber { get; set; }
+
+        [ApiMember(Name = "EndingEpisodeNumber", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
+        public int? EndingEpisodeNumber { get; set; }
+
+        [ApiMember(Name = "RememberCorrection", Description = "Whether or not to apply the same correction to future episodes of the same series.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "POST")]
+        public bool RememberCorrection { get; set; }
+    }
+
     public class FileOrganizationService : BaseApiService
     {
         private readonly IFileOrganizationService _iFileOrganizationService;
@@ -76,11 +105,33 @@ namespace MediaBrowser.Api.Library
             Task.WaitAll(task);
         }
 
+        public void Delete(ClearOrganizationLog request)
+        {
+            var task = _iFileOrganizationService.ClearLog();
+
+            Task.WaitAll(task);
+        }
+
         public void Post(PerformOrganization request)
         {
             var task = _iFileOrganizationService.PerformOrganization(request.Id);
 
             Task.WaitAll(task);
         }
+
+        public void Post(OrganizeEpisode request)
+        {
+            var task = _iFileOrganizationService.PerformEpisodeOrganization(new EpisodeFileOrganizationRequest
+            {
+                EndingEpisodeNumber = request.EndingEpisodeNumber,
+                EpisodeNumber = request.EpisodeNumber,
+                RememberCorrection = request.RememberCorrection,
+                ResultId = request.Id,
+                SeasonNumber = request.SeasonNumber,
+                SeriesId = request.SeriesId
+            });
+
+            Task.WaitAll(task);
+        }
     }
 }

+ 0 - 4
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -1062,7 +1062,6 @@ namespace MediaBrowser.Api.Playback
                 state.ReadInputAtNativeFramerate = recording.RecordingInfo.Status == RecordingStatus.InProgress;
                 state.AudioSync = 1000;
                 state.DeInterlace = true;
-                state.InputFormat = "mpegts";
             }
             else if (item is LiveTvChannel)
             {
@@ -1091,9 +1090,6 @@ namespace MediaBrowser.Api.Playback
                 state.ReadInputAtNativeFramerate = true;
                 state.AudioSync = 1000;
                 state.DeInterlace = true;
-                state.InputFormat = "mpegts";
-
-                await Task.Delay(1000, cancellationToken).ConfigureAwait(false);
             }
             else
             {

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

@@ -14,7 +14,7 @@ namespace MediaBrowser.Api.Playback
 
         public VideoStreamRequest VideoRequest
         {
-            get { return (VideoStreamRequest) Request; }
+            get { return Request as VideoStreamRequest; }
         }
         
         /// <summary>