The Free Software Media System - Server Backend & API
live tv + nuget updates
Luke Pulverenti98d53c7838f8
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.csindex 979088ee00..24d76c0d2b 100644--- a/MediaBrowser.Api/LiveTv/LiveTvService.cs+++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs@@ -114,7 +114,7 @@ namespace MediaBrowser.Api.LiveTv{}- [Route("/LiveTv/Timers/{Id}", "GET")]+ [Route("/LiveTv/SeriesTimers/{Id}", "GET")][Api(Description = "Gets a live tv series timer")]public class GetSeriesTimer : IReturn<TimerInfoDto>{@@ -128,6 +128,20 @@ namespace MediaBrowser.Api.LiveTv{}+ [Route("/LiveTv/SeriesTimers/{Id}", "DELETE")]+ [Api(Description = "Cancels a live tv series timer")]+ public class CancelSeriesTimer : IReturnVoid+ {+ [ApiMember(Name = "Id", Description = "Timer Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]+ public string Id { get; set; }+ }++ [Route("/LiveTv/SeriesTimers/{Id}", "POST")]+ [Api(Description = "Updates a live tv series timer")]+ public class UpdateSeriesTimer : SeriesTimerInfoDto, IReturnVoid+ {+ }+public class LiveTvService : BaseApiService{private readonly ILiveTvManager _liveTvManager;@@ -265,5 +279,19 @@ namespace MediaBrowser.Api.LiveTvreturn ToOptimizedResult(result);}++ public void Delete(CancelSeriesTimer request)+ {+ var task = _liveTvManager.CancelSeriesTimer(request.Id);++ Task.WaitAll(task);+ }++ public void Post(UpdateSeriesTimer request)+ {+ var task = _liveTvManager.UpdateSeriesTimer(request, CancellationToken.None);++ Task.WaitAll(task);+ }}}\ No newline at end of filediff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.csindex 9ed7b633d9..d9e9298cec 100644--- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs+++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs@@ -45,6 +45,13 @@ namespace MediaBrowser.Controller.LiveTv/// <returns>Task.</returns>Task CancelTimer(string id);+ /// <summary>+ /// Cancels the series timer.+ /// </summary>+ /// <param name="id">The identifier.</param>+ /// <returns>Task.</returns>+ Task CancelSeriesTimer(string id);+/// <summary>/// Adds the parts./// </summary>diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.csindex 8b1801f9e8..a5c91663ee 100644--- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs+++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs@@ -30,6 +30,14 @@ namespace MediaBrowser.Controller.LiveTv/// <returns>Task.</returns>Task CancelTimerAsync(string timerId, CancellationToken cancellationToken);+ /// <summary>+ /// Cancels the series timer asynchronous.+ /// </summary>+ /// <param name="timerId">The timer identifier.</param>+ /// <param name="cancellationToken">The cancellation token.</param>+ /// <returns>Task.</returns>+ Task CancelSeriesTimerAsync(string timerId, CancellationToken cancellationToken);+/// <summary>/// Deletes the recording asynchronous./// </summary>diff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.csindex d17ebee6dc..501e3b6210 100644--- a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs@@ -33,6 +33,12 @@ namespace MediaBrowser.Model.LiveTv/// </summary>public string ChannelName { 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>/// Name of the recording./// </summary>diff --git a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.csindex 3862c07450..0853400135 100644--- a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs@@ -21,6 +21,12 @@ namespace MediaBrowser.Model.LiveTv/// </summary>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 external channel identifier./// </summary>diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.csindex 6b7ab42d3c..d962f784f1 100644--- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs@@ -31,6 +31,12 @@ namespace MediaBrowser.Model.LiveTv/// </summary>public string ChannelName { 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 program identifier./// </summary>diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.csindex f93821cc97..fc030dbf8d 100644--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs@@ -46,7 +46,8 @@ namespace MediaBrowser.Server.Implementations.LiveTvRequiredPostPaddingSeconds = info.RequiredPostPaddingSeconds,RequiredPrePaddingSeconds = info.RequiredPrePaddingSeconds,ExternalChannelId = info.ChannelId,- ExternalSeriesTimerId = info.SeriesTimerId+ ExternalSeriesTimerId = info.SeriesTimerId,+ ServiceName = service.Name};var duration = info.EndDate - info.StartDate;@@ -71,7 +72,6 @@ namespace MediaBrowser.Server.Implementations.LiveTvName = info.Name,StartDate = info.StartDate,ExternalId = info.Id,- ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"),RequestedPostPaddingSeconds = info.RequestedPostPaddingSeconds,RequestedPrePaddingSeconds = info.RequestedPrePaddingSeconds,RequiredPostPaddingSeconds = info.RequiredPostPaddingSeconds,@@ -80,9 +80,15 @@ namespace MediaBrowser.Server.Implementations.LiveTvPriority = info.Priority,RecurrenceType = info.RecurrenceType,ExternalChannelId = info.ChannelId,- ExternalProgramId = info.ProgramId+ ExternalProgramId = info.ProgramId,+ ServiceName = service.Name};+ if (!string.IsNullOrEmpty(info.ChannelId))+ {+ dto.ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N");+ }+if (!string.IsNullOrEmpty(info.ProgramId)){dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N");@@ -139,7 +145,8 @@ namespace MediaBrowser.Server.Implementations.LiveTvCommunityRating = info.CommunityRating,OfficialRating = info.OfficialRating,Audio = info.Audio,- IsHD = info.IsHD+ IsHD = info.IsHD,+ ServiceName = service.Name};if (user != null)diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.csindex 318f450f12..37794cb3da 100644--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs@@ -348,22 +348,14 @@ namespace MediaBrowser.Server.Implementations.LiveTvpublic async Task DeleteRecording(string recordingId){- var recordings = await GetRecordings(new RecordingQuery- {-- }, CancellationToken.None).ConfigureAwait(false);-- var recording = recordings.Items- .FirstOrDefault(i => string.Equals(recordingId, i.Id, StringComparison.OrdinalIgnoreCase));+ var recording = await GetRecording(recordingId, CancellationToken.None).ConfigureAwait(false);if (recording == null){throw new ResourceNotFoundException(string.Format("Recording with Id {0} not found", recordingId));}- var channel = GetChannel(recording.ChannelId);-- var service = GetServices(channel.ServiceName, null)+ var service = GetServices(recording.ServiceName, null).First();await service.DeleteRecordingAsync(recording.ExternalId, CancellationToken.None).ConfigureAwait(false);@@ -371,25 +363,32 @@ namespace MediaBrowser.Server.Implementations.LiveTvpublic async Task CancelTimer(string id){- var timers = await GetTimers(new TimerQuery+ var timer = await GetTimer(id, CancellationToken.None).ConfigureAwait(false);++ if (timer == null){+ throw new ResourceNotFoundException(string.Format("Timer with Id {0} not found", id));+ }- }, CancellationToken.None).ConfigureAwait(false);+ var service = GetServices(timer.ServiceName, null)+ .First();++ await service.CancelTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false);+ }- var timer = timers.Items- .FirstOrDefault(i => string.Equals(id, i.Id, StringComparison.OrdinalIgnoreCase));+ public async Task CancelSeriesTimer(string id)+ {+ var timer = await GetSeriesTimer(id, CancellationToken.None).ConfigureAwait(false);if (timer == null){throw new ResourceNotFoundException(string.Format("Timer with Id {0} not found", id));}- var channel = GetChannel(timer.ChannelId);-- var service = GetServices(channel.ServiceName, null)+ var service = GetServices(timer.ServiceName, null).First();- await service.CancelTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false);+ await service.CancelSeriesTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false);}public async Task<RecordingInfoDto> GetRecording(string id, CancellationToken cancellationToken, User user = null)@@ -416,7 +415,7 @@ namespace MediaBrowser.Server.Implementations.LiveTvreturn results.Items.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.CurrentCulture));}-+public Task UpdateTimer(TimerInfoDto timer, CancellationToken cancellationToken){var info = _tvDtoService.GetTimerInfo(timer);diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspecindex 116671f44a..d453d67573 100644--- a/Nuget/MediaBrowser.Common.Internal.nuspec+++ b/Nuget/MediaBrowser.Common.Internal.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common.Internal</id>- <version>3.0.271</version>+ <version>3.0.273</version><title>MediaBrowser.Common.Internal</title><authors>Luke</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.271" />+ <dependency id="MediaBrowser.Common" version="3.0.273" /><dependency id="NLog" version="2.1.0" /><dependency id="SimpleInjector" version="2.4.0" /><dependency id="sharpcompress" version="0.10.2" />diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspecindex 126ddf4ca1..16ebaa8a80 100644--- a/Nuget/MediaBrowser.Common.nuspec+++ b/Nuget/MediaBrowser.Common.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common</id>- <version>3.0.271</version>+ <version>3.0.273</version><title>MediaBrowser.Common</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspecindex 7de6b9e00a..33470aa627 100644--- a/Nuget/MediaBrowser.Server.Core.nuspec+++ b/Nuget/MediaBrowser.Server.Core.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"><metadata><id>MediaBrowser.Server.Core</id>- <version>3.0.271</version>+ <version>3.0.273</version><title>Media Browser.Server.Core</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains core components required to build plugins for Media Browser Server.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.271" />+ <dependency id="MediaBrowser.Common" version="3.0.273" /></dependencies></metadata><files>