aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/LiveTv
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-19 16:51:32 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-19 16:51:32 -0500
commitcd859ac2e6d499ce2cdf531058e64a4c3402910f (patch)
treee453d21e99ef2d6aee7f5e4af668a69147b31dfd /MediaBrowser.Controller/LiveTv
parente1e5d354345008e8d4ddc2dbbb99a68df4133280 (diff)
added IHasImages and IHasUserData
Diffstat (limited to 'MediaBrowser.Controller/LiveTv')
-rw-r--r--MediaBrowser.Controller/LiveTv/Channel.cs75
-rw-r--r--MediaBrowser.Controller/LiveTv/ChannelInfo.cs12
-rw-r--r--MediaBrowser.Controller/LiveTv/ILiveTvManager.cs10
-rw-r--r--MediaBrowser.Controller/LiveTv/ILiveTvService.cs6
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvChannel.cs57
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvProgram.cs33
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvRecording.cs43
-rw-r--r--MediaBrowser.Controller/LiveTv/ProgramInfo.cs20
-rw-r--r--MediaBrowser.Controller/LiveTv/RecordingInfo.cs12
9 files changed, 179 insertions, 89 deletions
diff --git a/MediaBrowser.Controller/LiveTv/Channel.cs b/MediaBrowser.Controller/LiveTv/Channel.cs
deleted file mode 100644
index 7186cfaf30..0000000000
--- a/MediaBrowser.Controller/LiveTv/Channel.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Model.Dto;
-using MediaBrowser.Model.LiveTv;
-using System;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace MediaBrowser.Controller.LiveTv
-{
- public class Channel : BaseItem, IItemByName
- {
- public Channel()
- {
- UserItemCountList = new List<ItemByNameCounts>();
- }
-
- /// <summary>
- /// Gets the user data key.
- /// </summary>
- /// <returns>System.String.</returns>
- public override string GetUserDataKey()
- {
- return "Channel-" + Name;
- }
-
- [IgnoreDataMember]
- public List<ItemByNameCounts> UserItemCountList { get; set; }
-
- /// <summary>
- /// Gets or sets the number.
- /// </summary>
- /// <value>The number.</value>
- public string ChannelNumber { get; set; }
-
- /// <summary>
- /// Get or sets the Id.
- /// </summary>
- /// <value>The id of the channel.</value>
- public string ChannelId { get; set; }
-
- /// <summary>
- /// Gets or sets the name of the service.
- /// </summary>
- /// <value>The name of the service.</value>
- public string ServiceName { get; set; }
-
- /// <summary>
- /// Gets or sets the type of the channel.
- /// </summary>
- /// <value>The type of the channel.</value>
- public ChannelType ChannelType { get; set; }
-
- public bool? HasProviderImage { get; set; }
-
- protected override string CreateSortName()
- {
- double number = 0;
-
- if (!string.IsNullOrEmpty(ChannelNumber))
- {
- double.TryParse(ChannelNumber, out number);
- }
-
- return number.ToString("000-") + (Name ?? string.Empty);
- }
-
- public override string MediaType
- {
- get
- {
- return ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video;
- }
- }
- }
-}
diff --git a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs
index bb06366739..9bc37fcc0b 100644
--- a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs
@@ -32,9 +32,15 @@ namespace MediaBrowser.Controller.LiveTv
public ChannelType ChannelType { get; set; }
/// <summary>
- /// Set this value to true or false if it is known via channel info whether there is an image or not.
- /// Leave it null if the only way to determine is by requesting the image and handling the failure.
+ /// Supply the image path if it can be accessed directly from the file system
/// </summary>
- public bool? HasImage { get; set; }
+ /// <value>The image path.</value>
+ public string ImagePath { get; set; }
+
+ /// <summary>
+ /// Supply the image url if it can be downloaded
+ /// </summary>
+ /// <value>The image URL.</value>
+ public string ImageUrl { get; set; }
}
}
diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs
index 8e711d28c9..e7226e9b5a 100644
--- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs
+++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs
@@ -144,9 +144,17 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>Channel.</returns>
- Channel GetChannel(string id);
+ LiveTvChannel GetInternalChannel(string id);
/// <summary>
+ /// Gets the recording.
+ /// </summary>
+ /// <param name="id">The identifier.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>LiveTvRecording.</returns>
+ Task<LiveTvRecording> GetInternalRecording(string id, CancellationToken cancellationToken);
+
+ /// <summary>
/// Gets the program.
/// </summary>
/// <param name="id">The identifier.</param>
diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs
index 2cd768a937..1c88629f09 100644
--- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs
+++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs
@@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.LiveTv
Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken);
/// <summary>
- /// Gets the channel image asynchronous.
+ /// Gets the channel image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to ChannelInfo
/// </summary>
/// <param name="channelId">The channel identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
@@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.LiveTv
Task<ImageResponseInfo> GetChannelImageAsync(string channelId, CancellationToken cancellationToken);
/// <summary>
- /// Gets the recording image asynchronous.
+ /// Gets the recording image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to RecordingInfo
/// </summary>
/// <param name="recordingId">The recording identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
@@ -95,7 +95,7 @@ namespace MediaBrowser.Controller.LiveTv
Task<ImageResponseInfo> GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken);
/// <summary>
- /// Gets the program image asynchronous.
+ /// Gets the program image asynchronous. This only needs to be implemented if an image path or url cannot be supplied to ProgramInfo
/// </summary>
/// <param name="programId">The program identifier.</param>
/// <param name="channelId">The channel identifier.</param>
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
new file mode 100644
index 0000000000..1e6d74ce82
--- /dev/null
+++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
@@ -0,0 +1,57 @@
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Model.Dto;
+using MediaBrowser.Model.LiveTv;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace MediaBrowser.Controller.LiveTv
+{
+ public class LiveTvChannel : BaseItem, IItemByName
+ {
+ public LiveTvChannel()
+ {
+ UserItemCountList = new List<ItemByNameCounts>();
+ }
+
+ /// <summary>
+ /// Gets the user data key.
+ /// </summary>
+ /// <returns>System.String.</returns>
+ public override string GetUserDataKey()
+ {
+ return GetClientTypeName() + "-" + Name;
+ }
+
+ [IgnoreDataMember]
+ public List<ItemByNameCounts> UserItemCountList { get; set; }
+
+ public ChannelInfo ChannelInfo { get; set; }
+
+ public string ServiceName { get; set; }
+
+ protected override string CreateSortName()
+ {
+ double number = 0;
+
+ if (!string.IsNullOrEmpty(ChannelInfo.Number))
+ {
+ double.TryParse(ChannelInfo.Number, out number);
+ }
+
+ return number.ToString("000-") + (Name ?? string.Empty);
+ }
+
+ public override string MediaType
+ {
+ get
+ {
+ return ChannelInfo.ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video;
+ }
+ }
+
+ public override string GetClientTypeName()
+ {
+ return "Channel";
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
new file mode 100644
index 0000000000..babd9f54c5
--- /dev/null
+++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
@@ -0,0 +1,33 @@
+using MediaBrowser.Controller.Entities;
+
+namespace MediaBrowser.Controller.LiveTv
+{
+ public class LiveTvProgram : BaseItem
+ {
+ /// <summary>
+ /// Gets the user data key.
+ /// </summary>
+ /// <returns>System.String.</returns>
+ public override string GetUserDataKey()
+ {
+ return GetClientTypeName() + "-" + Name;
+ }
+
+ public ProgramInfo ProgramInfo { get; set; }
+
+ public string ServiceName { get; set; }
+
+ public override string MediaType
+ {
+ get
+ {
+ return ProgramInfo.IsVideo ? Model.Entities.MediaType.Video : Model.Entities.MediaType.Audio;
+ }
+ }
+
+ public override string GetClientTypeName()
+ {
+ return "Program";
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvRecording.cs
new file mode 100644
index 0000000000..1c453ab5a1
--- /dev/null
+++ b/MediaBrowser.Controller/LiveTv/LiveTvRecording.cs
@@ -0,0 +1,43 @@
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.LiveTv;
+
+namespace MediaBrowser.Controller.LiveTv
+{
+ public class LiveTvRecording : BaseItem
+ {
+ /// <summary>
+ /// Gets the user data key.
+ /// </summary>
+ /// <returns>System.String.</returns>
+ public override string GetUserDataKey()
+ {
+ return GetClientTypeName() + "-" + Name;
+ }
+
+ public RecordingInfo RecordingInfo { get; set; }
+
+ public string ServiceName { get; set; }
+
+ public override string MediaType
+ {
+ get
+ {
+ return RecordingInfo.ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video;
+ }
+ }
+
+ public override LocationType LocationType
+ {
+ get
+ {
+ return LocationType.Remote;
+ }
+ }
+
+ public override string GetClientTypeName()
+ {
+ return "Recording";
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs
index 15b55f50eb..959f677403 100644
--- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs
@@ -98,10 +98,16 @@ namespace MediaBrowser.Controller.LiveTv
public string EpisodeTitle { get; set; }
/// <summary>
- /// Set this value to true or false if it is known via program info whether there is an image or not.
- /// Leave it null if the only way to determine is by requesting the image and handling the failure.
+ /// Supply the image path if it can be accessed directly from the file system
/// </summary>
- public bool? HasImage { get; set; }
+ /// <value>The image path.</value>
+ public string ImagePath { get; set; }
+
+ /// <summary>
+ /// Supply the image url if it can be downloaded
+ /// </summary>
+ /// <value>The image URL.</value>
+ public string ImageUrl { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is movie.
@@ -120,7 +126,13 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value><c>true</c> if this instance is series; otherwise, <c>false</c>.</value>
public bool IsSeries { get; set; }
-
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is video.
+ /// </summary>
+ /// <value><c>true</c> if this instance is video; otherwise, <c>false</c>.</value>
+ public bool IsVideo { get; set; }
+
public ProgramInfo()
{
Genres = new List<string>();
diff --git a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs
index 40a53e6591..ee3d945942 100644
--- a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs
@@ -114,10 +114,16 @@ namespace MediaBrowser.Controller.LiveTv
public float? CommunityRating { get; set; }
/// <summary>
- /// Set this value to true or false if it is known via recording info whether there is an image or not.
- /// Leave it null if the only way to determine is by requesting the image and handling the failure.
+ /// Supply the image path if it can be accessed directly from the file system
/// </summary>
- public bool? HasImage { get; set; }
+ /// <value>The image path.</value>
+ public string ImagePath { get; set; }
+
+ /// <summary>
+ /// Supply the image url if it can be downloaded
+ /// </summary>
+ /// <value>The image URL.</value>
+ public string ImageUrl { get; set; }
public RecordingInfo()
{