Browse Source

Added EpgFullInfo & EpgInfo
Modified RecordingInfo & ChannelInfo

Changed LiveTvService

Sven Van den brande 11 năm trước cách đây
mục cha
commit
8f7021eb42

+ 26 - 1
MediaBrowser.Api/LiveTv/LiveTvService.cs

@@ -27,6 +27,13 @@ namespace MediaBrowser.Api.LiveTv
     {
     {
         // Add filter by service if needed, and/or other filters
         // Add filter by service if needed, and/or other filters
     }
     }
+
+    [Route("/LiveTv/EPG", "GET")]
+    [Api(Description = "Gets available live tv epgs..")]
+    public class GetEpg : IReturn<List<EpgFullInfo>>
+    {
+        // Add filter by service if needed, and/or other filters
+    }
     
     
     public class LiveTvService : BaseApiService
     public class LiveTvService : BaseApiService
     {
     {
@@ -92,5 +99,23 @@ namespace MediaBrowser.Api.LiveTv
 
 
             return recordings.SelectMany(i => i);
             return recordings.SelectMany(i => i);
         }
         }
+
+        public object Get(GetEpg request)
+        {
+            var result = GetEpgAsync(request).Result;
+
+            return ToOptimizedResult(result);
+        }
+
+        private async Task<IEnumerable<EpgFullInfo>> GetEpgAsync(GetEpg request)
+        {
+            var services = _liveTvManager.Services;
+
+            var tasks = services.Select(i => i.GetEpgAsync(CancellationToken.None));
+
+            var epg = await Task.WhenAll(tasks).ConfigureAwait(false);
+
+            return epg.SelectMany(i => i);
+        }
     }
     }
-}
+}

+ 4 - 0
MediaBrowser.Controller/LiveTv/ChannelInfo.cs

@@ -13,6 +13,10 @@ namespace MediaBrowser.Controller.LiveTv
         /// <value>The name.</value>
         /// <value>The name.</value>
         public string Name { get; set; }
         public string Name { get; set; }
 
 
+        /// <summary>
+        /// Get or sets the Id.
+        /// </summary>
+        /// <value>The id of the channel.</value>
         public string Id { get; set; }
         public string Id { get; set; }
 
 
         /// <summary>
         /// <summary>

+ 2 - 0
MediaBrowser.Controller/LiveTv/ILiveTvService.cs

@@ -24,5 +24,7 @@ namespace MediaBrowser.Controller.LiveTv
         Task<IEnumerable<ChannelInfo>> GetChannelsAsync(CancellationToken cancellationToken);
         Task<IEnumerable<ChannelInfo>> GetChannelsAsync(CancellationToken cancellationToken);
 
 
         Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken);
         Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken);
+
+        Task<IEnumerable<EpgFullInfo>> GetEpgAsync(CancellationToken cancellationToken);
     }
     }
 }
 }

+ 6 - 0
MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj

@@ -230,6 +230,12 @@
     <Compile Include="..\MediaBrowser.Model\LiveTv\ChannelType.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\ChannelType.cs">
       <Link>LiveTv\ChannelType.cs</Link>
       <Link>LiveTv\ChannelType.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\LiveTv\EpgFullInfo.cs">
+      <Link>LiveTv\EpgFullInfo.cs</Link>
+    </Compile>
+    <Compile Include="..\MediaBrowser.Model\LiveTv\EpgInfo.cs">
+      <Link>LiveTv\EpgInfo.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
     </Compile>
     </Compile>

+ 6 - 0
MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj

@@ -217,6 +217,12 @@
     <Compile Include="..\MediaBrowser.Model\LiveTv\ChannelType.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\ChannelType.cs">
       <Link>LiveTv\ChannelType.cs</Link>
       <Link>LiveTv\ChannelType.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\LiveTv\EpgFullInfo.cs">
+      <Link>LiveTv\EpgFullInfo.cs</Link>
+    </Compile>
+    <Compile Include="..\MediaBrowser.Model\LiveTv\EpgInfo.cs">
+      <Link>LiveTv\EpgInfo.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
     <Compile Include="..\MediaBrowser.Model\LiveTv\LiveTvServiceInfo.cs">
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
       <Link>LiveTv\LiveTvServiceInfo.cs</Link>
     </Compile>
     </Compile>

+ 17 - 0
MediaBrowser.Model/LiveTv/EpgFullInfo.cs

@@ -0,0 +1,17 @@
+using System.Collections.Generic;
+
+namespace MediaBrowser.Model.LiveTv
+{
+    public class EpgFullInfo
+    {
+        /// <summary>
+        /// ChannelId for the EPG.
+        /// </summary>
+        public string ChannelId { get; set; }
+
+        /// <summary>
+        /// List of all the programs for a specific channel
+        /// </summary>
+        public List<EpgInfo> EpgInfos { get; set; } 
+    }
+}

+ 32 - 0
MediaBrowser.Model/LiveTv/EpgInfo.cs

@@ -0,0 +1,32 @@
+using System;
+
+namespace MediaBrowser.Model.LiveTv
+{
+    public class EpgInfo
+    {
+        /// <summary>
+        /// Id of the program.
+        /// </summary>
+        public string Id { get; set; }
+
+        /// <summary>
+        /// Description of the progam.
+        /// </summary>
+        public string Description { get; set; }
+
+        /// <summary>
+        /// The start date of the program, in UTC.
+        /// </summary>
+        public DateTime StartDate { get; set; }
+
+        /// <summary>
+        /// The end date of the program, in UTC.
+        /// </summary>
+        public DateTime EndDate { get; set; }
+
+        /// <summary>
+        /// Genre of the program.
+        /// </summary>
+        public string Genre { get; set; }
+    }
+}

+ 56 - 5
MediaBrowser.Model/LiveTv/RecordingInfo.cs

@@ -1,27 +1,78 @@
 using System;
 using System;
+using System.Collections.Generic;
 
 
 namespace MediaBrowser.Model.LiveTv
 namespace MediaBrowser.Model.LiveTv
 {
 {
     public class RecordingInfo
     public class RecordingInfo
     {
     {
+        /// <summary>
+        /// Id of the recording.
+        /// </summary>
+        public string Id { get; set; }
+
+        /// <summary>
+        /// ChannelId of the recording.
+        /// </summary>
         public string ChannelId { get; set; }
         public string ChannelId { get; set; }
 
 
+        /// <summary>
+        /// ChannelName of the recording.
+        /// </summary>
         public string ChannelName { get; set; }
         public string ChannelName { get; set; }
 
 
-        public string Id { get; set; }
-
+        /// <summary>
+        /// Name of the recording.
+        /// </summary>
         public string Name { get; set; }
         public string Name { get; set; }
 
 
+        /// <summary>
+        /// Description of the recording.
+        /// </summary>
         public string Description { get; set; }
         public string Description { get; set; }
 
 
         /// <summary>
         /// <summary>
-        /// The start date of the recording, in UTC
+        /// The start date of the recording, in UTC.
         /// </summary>
         /// </summary>
         public DateTime StartDate { get; set; }
         public DateTime StartDate { get; set; }
 
 
         /// <summary>
         /// <summary>
-        /// The end date of the recording, in UTC
+        /// The end date of the recording, in UTC.
         /// </summary>
         /// </summary>
         public DateTime EndDate { get; set; }
         public DateTime EndDate { get; set; }
+
+        /// <summary>
+        /// Status of the recording.
+        /// </summary>
+        public string Status { get; set; } //TODO: Enum for status?? Difference NextPvr,Argus,...
+
+        /// <summary>
+        /// Quality of the Recording.
+        /// </summary>
+        public string Quality { get; set; } // TODO: Enum for quality?? Difference NextPvr,Argus,...
+
+        /// <summary>
+        /// Recurring recording?
+        /// </summary>
+        public bool Recurring { get; set; }
+
+        /// <summary>
+        /// Parent recurring.
+        /// </summary>
+        public string RecurringParent { get; set; }
+
+        /// <summary>
+        /// Start date for the recurring, in UTC.
+        /// </summary>
+        public DateTime RecurrringStartDate { get; set; }
+
+        /// <summary>
+        /// End date for the recurring, in UTC
+        /// </summary>
+        public DateTime RecurringEndDate { get; set; }
+
+        /// <summary>
+        /// When do we need the recording?
+        /// </summary>
+        public List<string> DayMask { get; set; }
     }
     }
-}
+}

+ 2 - 0
MediaBrowser.Model/MediaBrowser.Model.csproj

@@ -59,6 +59,8 @@
     <Compile Include="Dto\ItemByNameCounts.cs" />
     <Compile Include="Dto\ItemByNameCounts.cs" />
     <Compile Include="Dto\ItemCounts.cs" />
     <Compile Include="Dto\ItemCounts.cs" />
     <Compile Include="Dto\ItemIndex.cs" />
     <Compile Include="Dto\ItemIndex.cs" />
+    <Compile Include="LiveTv\EpgFullInfo.cs" />
+    <Compile Include="LiveTv\EpgInfo.cs" />
     <Compile Include="Providers\RemoteImageInfo.cs" />
     <Compile Include="Providers\RemoteImageInfo.cs" />
     <Compile Include="Dto\StudioDto.cs" />
     <Compile Include="Dto\StudioDto.cs" />
     <Compile Include="Entities\CollectionType.cs" />
     <Compile Include="Entities\CollectionType.cs" />