diff options
| -rw-r--r-- | MediaBrowser.Api/LiveTv/LiveTvService.cs | 30 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 7 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/ILiveTvService.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/RecordingInfoDto.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/TimerInfoDto.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs | 15 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs | 37 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.Internal.nuspec | 4 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.nuspec | 2 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Server.Core.nuspec | 4 | ||||
| -rw-r--r-- | README.md | 2 |
12 files changed, 97 insertions, 30 deletions
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 979088ee0..24d76c0d2 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.LiveTv return 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 file diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 9ed7b633d..d9e9298ce 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -46,6 +46,13 @@ namespace MediaBrowser.Controller.LiveTv 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> /// <param name="services">The services.</param> diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index 8b1801f9e..a5c91663e 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -31,6 +31,14 @@ namespace MediaBrowser.Controller.LiveTv 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> /// <param name="recordingId">The recording identifier.</param> diff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs index d17ebee6d..501e3b621 100644 --- a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs @@ -34,6 +34,12 @@ namespace MediaBrowser.Model.LiveTv 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> public string Name { get; set; } diff --git a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs index 3862c0745..085340013 100644 --- a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs @@ -22,6 +22,12 @@ namespace MediaBrowser.Model.LiveTv 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> /// <value>The external channel identifier.</value> diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs index 6b7ab42d3..d962f784f 100644 --- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs @@ -32,6 +32,12 @@ namespace MediaBrowser.Model.LiveTv 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> /// <value>The program identifier.</value> diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs index f93821cc9..fc030dbf8 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -46,7 +46,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv RequiredPostPaddingSeconds = 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.LiveTv Name = 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.LiveTv Priority = 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.LiveTv CommunityRating = 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.cs index 318f450f1..37794cb3d 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -348,22 +348,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv public 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.LiveTv public 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.LiveTv return 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.nuspec index 116671f44..d453d6757 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.nuspec index 126ddf4ca..16ebaa8a8 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.nuspec index 7de6b9e00..33470aa62 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> @@ -37,7 +37,7 @@ http://mediabrowser3.com/community ## Current Versions ## Release: 3.0.4999.38224<br/> -Beta: 3.0.5028.39800<br/> +Beta: 3.0.5097.16641<br/> ## Images |
