1.0.0.4 - Update due to changes in ILiveTvService

Update due to changes in ILiveTvService
This commit is contained in:
CompoUK
2015-03-20 15:47:46 +00:00
parent f062710abe
commit 595f362979
+47 -40
View File
@@ -1,8 +1,10 @@
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
@@ -42,7 +44,7 @@ namespace MediaBrowser.Plugins.VuPlus
List<ChannelInfo> tvChannelInfos = new List<ChannelInfo>(); List<ChannelInfo> tvChannelInfos = new List<ChannelInfo>();
public LiveTvService(IHttpClient httpClient, IJsonSerializer jsonSerializer,ILogger logger) public LiveTvService(IHttpClient httpClient, IJsonSerializer jsonSerializer, ILogger logger)
{ {
_httpClient = httpClient; _httpClient = httpClient;
_logger = logger; _logger = logger;
@@ -124,7 +126,8 @@ namespace MediaBrowser.Plugins.VuPlus
{ {
// connect to VuPlus box to test connectivity and at same time get sRef for TV Bouquet. // connect to VuPlus box to test connectivity and at same time get sRef for TV Bouquet.
tvBouquetSRef = await InitiateSession(cancellationToken, config.TVBouquet).ConfigureAwait(false); tvBouquetSRef = await InitiateSession(cancellationToken, config.TVBouquet).ConfigureAwait(false);
} else }
else
{ {
// connect to VuPlus box to test connectivity. // connect to VuPlus box to test connectivity.
String resultNotRequired = await InitiateSession(cancellationToken, null).ConfigureAwait(false); String resultNotRequired = await InitiateSession(cancellationToken, null).ConfigureAwait(false);
@@ -263,8 +266,8 @@ namespace MediaBrowser.Plugins.VuPlus
var options = new HttpRequestOptions var options = new HttpRequestOptions
{ {
CancellationToken = cancellationToken, CancellationToken = cancellationToken,
Url = url, Url = url,
UserAgent = "vuplus-pvraddon-agent/1.0" UserAgent = "vuplus-pvraddon-agent/1.0"
}; };
if (!string.IsNullOrEmpty(Plugin.Instance.Configuration.WebInterfaceUsername)) if (!string.IsNullOrEmpty(Plugin.Instance.Configuration.WebInterfaceUsername))
@@ -327,7 +330,6 @@ namespace MediaBrowser.Plugins.VuPlus
else else
{ {
// Load channels for specified TV Bouquet only // Load channels for specified TV Bouquet only
_logger.Info("[VuPlus] GetChannelsAsync for specified TV Bouquets");
int count = 1; int count = 1;
XmlNodeList e2services = xml.GetElementsByTagName("e2service"); XmlNodeList e2services = xml.GetElementsByTagName("e2service");
@@ -681,6 +683,7 @@ namespace MediaBrowser.Plugins.VuPlus
edate = edate.AddSeconds(edated); //add seconds edate = edate.AddSeconds(edated); //add seconds
recordingInfo.EndDate = edate.ToUniversalTime(); recordingInfo.EndDate = edate.ToUniversalTime();
//recordingInfo.EpisodeTitle = e2title;
recordingInfo.EpisodeTitle = null; recordingInfo.EpisodeTitle = null;
recordingInfo.Overview = e2description; recordingInfo.Overview = e2description;
@@ -732,14 +735,14 @@ namespace MediaBrowser.Plugins.VuPlus
/// <returns></returns> /// <returns></returns>
public async Task DeleteRecordingAsync(string recordingId, CancellationToken cancellationToken) public async Task DeleteRecordingAsync(string recordingId, CancellationToken cancellationToken)
{ {
_logger.Info(string.Format("[VuPlus] Start Delete Recording Async for recordingId: {0}",recordingId)); _logger.Info(string.Format("[VuPlus] Start Delete Recording Async for recordingId: {0}", recordingId));
await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false); await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false);
var protocol = "http"; var protocol = "http";
if (Plugin.Instance.Configuration.UseSecureHTTPS) if (Plugin.Instance.Configuration.UseSecureHTTPS)
protocol = "https"; protocol = "https";
var baseUrl =protocol + "://" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.WebInterfacePort; var baseUrl = protocol + "://" + Plugin.Instance.Configuration.HostName + ":" + Plugin.Instance.Configuration.WebInterfacePort;
var url = string.Format("{0}/web/moviedelete?sRef={1}", baseUrl, recordingId); var url = string.Format("{0}/web/moviedelete?sRef={1}", baseUrl, recordingId);
UtilsHelper.DebugInformation(_logger, string.Format("[VuPlus] DeleteRecordingAsync url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[VuPlus] DeleteRecordingAsync url: {0}", url));
@@ -907,7 +910,7 @@ namespace MediaBrowser.Plugins.VuPlus
/// <returns></returns> /// <returns></returns>
public async Task CreateTimerAsync(TimerInfo info, CancellationToken cancellationToken) public async Task CreateTimerAsync(TimerInfo info, CancellationToken cancellationToken)
{ {
_logger.Info(string.Format("[VuPlus] Start CreateTimerAsync for ChannelId: {0} & Name: {1}",info.ChannelId, info.Name)); _logger.Info(string.Format("[VuPlus] Start CreateTimerAsync for ChannelId: {0} & Name: {1}", info.ChannelId, info.Name));
await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false); await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false);
// extract eventid from info.ProgramId // extract eventid from info.ProgramId
@@ -924,7 +927,7 @@ namespace MediaBrowser.Plugins.VuPlus
if (!string.IsNullOrEmpty(Plugin.Instance.Configuration.RecordingPath)) if (!string.IsNullOrEmpty(Plugin.Instance.Configuration.RecordingPath))
{ {
url = url + string.Format("&dirname={0}", WebUtility.UrlEncode(Plugin.Instance.Configuration.RecordingPath)); url = url + string.Format("&dirname={0}", WebUtility.UrlEncode(Plugin.Instance.Configuration.RecordingPath));
} }
UtilsHelper.DebugInformation(_logger, string.Format("[VuPlus] CreateTimerAsync url: {0}", url)); UtilsHelper.DebugInformation(_logger, string.Format("[VuPlus] CreateTimerAsync url: {0}", url));
@@ -1044,7 +1047,7 @@ namespace MediaBrowser.Plugins.VuPlus
XmlNodeList e2timer = xml.GetElementsByTagName("e2timer"); XmlNodeList e2timer = xml.GetElementsByTagName("e2timer");
foreach (XmlNode xmlNode in e2timer) foreach (XmlNode xmlNode in e2timer)
{ {
var timerInfo = new TimerInfo(); var timerInfo = new TimerInfo();
var e2servicereference = "?"; var e2servicereference = "?";
var e2name = "?"; var e2name = "?";
@@ -1138,13 +1141,22 @@ namespace MediaBrowser.Plugins.VuPlus
} }
} }
public Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public Task<List<MediaSourceInfo>> GetRecordingStreamMediaSources(string recordingId, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
/// <summary> /// <summary>
/// Get the live channel stream, zap to channel if required. /// Get the live channel stream, zap to channel if required.
/// </summary> /// </summary>
/// <param name="cancellationToken">The CancellationToken</param> /// <param name="cancellationToken">The CancellationToken</param>
/// <returns>ChannelMediaInfo</returns> /// <returns>MediaSourceInfo</returns>
public async Task<ChannelMediaInfo> GetChannelStream(string channelOid, CancellationToken cancellationToken) public async Task<MediaSourceInfo> GetChannelStream(string channelOid, string mediaSourceId, CancellationToken cancellationToken)
{ {
_logger.Info("[VuPlus] Start GetChannelStream"); _logger.Info("[VuPlus] Start GetChannelStream");
@@ -1164,7 +1176,7 @@ namespace MediaBrowser.Plugins.VuPlus
string streamUrl = string.Format("{0}/{1}", baseUrl, channelOid); string streamUrl = string.Format("{0}/{1}", baseUrl, channelOid);
UtilsHelper.DebugInformation(_logger, string.Format("[VuPlus] GetChannelStream url: {0}", streamUrl)); UtilsHelper.DebugInformation(_logger, string.Format("[VuPlus] GetChannelStream url: {0}", streamUrl));
return new ChannelMediaInfo return new MediaSourceInfo
{ {
Id = _liveStreams.ToString(CultureInfo.InvariantCulture), Id = _liveStreams.ToString(CultureInfo.InvariantCulture),
Path = streamUrl, Path = streamUrl,
@@ -1286,7 +1298,7 @@ namespace MediaBrowser.Plugins.VuPlus
/// <returns>IEnumerable<ProgramInfo></returns> /// <returns>IEnumerable<ProgramInfo></returns>
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken) public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
{ {
_logger.Info(string.Format("[VuPlus] Start GetProgramsAsync for channelId: {0}",channelId)); _logger.Info("[VuPlus] Start GetProgramsAsync");
await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false); await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false);
Random rnd = new Random(); Random rnd = new Random();
@@ -1305,7 +1317,7 @@ namespace MediaBrowser.Plugins.VuPlus
var options = new HttpRequestOptions() var options = new HttpRequestOptions()
{ {
CancellationToken = cancellationToken, CancellationToken = cancellationToken,
Url = url Url = url
}; };
@@ -1317,7 +1329,7 @@ namespace MediaBrowser.Plugins.VuPlus
} }
using (var stream = await _httpClient.Get(options).ConfigureAwait(false)) using (var stream = await _httpClient.Get(options).ConfigureAwait(false))
{ {
using (StreamReader reader = new StreamReader(stream)) using (StreamReader reader = new StreamReader(stream))
{ {
string xmlResponse = reader.ReadToEnd(); string xmlResponse = reader.ReadToEnd();
@@ -1375,7 +1387,7 @@ namespace MediaBrowser.Plugins.VuPlus
} }
else if (node.Name == "e2eventdescriptionextended") else if (node.Name == "e2eventdescriptionextended")
{ {
e2eventdescriptionextended = node.InnerText; e2eventdescriptionextended = node.InnerText;
} }
else if (node.Name == "e2eventservicereference") else if (node.Name == "e2eventservicereference")
{ {
@@ -1400,7 +1412,9 @@ namespace MediaBrowser.Plugins.VuPlus
else else
{ {
UtilsHelper.DebugInformation(_logger, string.Format("[VuPlus] GetProgramsAsync adding program for channel name : {0} program : {1}", e2eventservicename, e2eventtitle)); UtilsHelper.DebugInformation(_logger, string.Format("[VuPlus] GetProgramsAsync adding program for channel name : {0} program : {1}", e2eventservicename, e2eventtitle));
programInfo.HasImage = false; //programInfo.HasImage = false;
//programInfo.ImagePath = null;
//programInfo.ImageUrl = null;
if (count == 1) if (count == 1)
{ {
foreach (ChannelInfo channelInfo in tvChannelInfos) foreach (ChannelInfo channelInfo in tvChannelInfos)
@@ -1424,7 +1438,7 @@ namespace MediaBrowser.Plugins.VuPlus
programInfo.ChannelId = e2eventservicereference; programInfo.ChannelId = e2eventservicereference;
// the Id appears to have to be unique so will try to make it so // for some reason the Id appears to have to be unique so will make it so
programInfo.Id = e2eventservicereference + "~" + e2eventid + "~" + count + "~" + rnd.Next(); programInfo.Id = e2eventservicereference + "~" + e2eventid + "~" + count + "~" + rnd.Next();
programInfo.Overview = e2eventdescriptionextended; programInfo.Overview = e2eventdescriptionextended;
@@ -1440,19 +1454,19 @@ namespace MediaBrowser.Plugins.VuPlus
genre.Add("Unknown"); genre.Add("Unknown");
programInfo.Genres = genre; programInfo.Genres = genre;
programInfo.OriginalAirDate = null; //programInfo.OriginalAirDate = null;
programInfo.Name = e2eventtitle; programInfo.Name = e2eventtitle;
programInfo.OfficialRating = null; //programInfo.OfficialRating = null;
programInfo.CommunityRating = null; //programInfo.CommunityRating = null;
programInfo.EpisodeTitle = null; //programInfo.EpisodeTitle = null;
programInfo.Audio = null; //programInfo.Audio = null;
programInfo.IsHD = false; //programInfo.IsHD = false;
programInfo.IsRepeat = false; //programInfo.IsRepeat = false;
programInfo.IsSeries = false; //programInfo.IsSeries = false;
programInfo.IsNews = false; //programInfo.IsNews = false;
programInfo.IsMovie = false; //programInfo.IsMovie = false;
programInfo.IsKids = false; //programInfo.IsKids = false;
programInfo.IsSports = false; //programInfo.IsSports = false;
programInfos.Add(programInfo); programInfos.Add(programInfo);
count = count + 1; count = count + 1;
@@ -1589,7 +1603,7 @@ namespace MediaBrowser.Plugins.VuPlus
} }
public async Task<ChannelMediaInfo> GetRecordingStream(string recordingId, CancellationToken cancellationToken) public async Task<MediaSourceInfo> GetRecordingStream(string recordingId, string mediaSourceId, CancellationToken cancellationToken)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@@ -1724,12 +1738,5 @@ namespace MediaBrowser.Plugins.VuPlus
throw new NotImplementedException(); throw new NotImplementedException();
} }
public Task<ImageStream> GetLiveTvChannelsAsync(string recordingId, CancellationToken cancellationToken)
{
// Leave as is. This is handled by supplying image url to RecordingInfo
throw new NotImplementedException();
}
} }
} }