From c0bbf8945ff0cf7cd0af99c50e47ad7980091ab8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 22 Dec 2013 22:46:03 -0500 Subject: [PATCH] live tv updates --- .../LiveTv/RecordingInfo.cs | 5 --- .../LiveTv/SeriesTimerInfo.cs | 8 +--- MediaBrowser.Controller/LiveTv/TimerInfo.cs | 5 --- .../LiveTv/LiveTvDtoService.cs | 38 +++++++++++-------- .../LiveTv/LiveTvManager.cs | 36 +++++++++++++----- .../ScheduledTasks/ChapterImagesTask.cs | 3 -- .../Api/DashboardService.cs | 1 + Nuget/MediaBrowser.Common.Internal.nuspec | 4 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +- 10 files changed, 56 insertions(+), 50 deletions(-) diff --git a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs index 2004536af..6a0d135c8 100644 --- a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs +++ b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs @@ -22,11 +22,6 @@ namespace MediaBrowser.Controller.LiveTv /// public string ChannelId { get; set; } - /// - /// ChannelName of the recording. - /// - public string ChannelName { get; set; } - /// /// Gets or sets the type of the channel. /// diff --git a/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs b/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs index 6801cd7f9..1be6549ff 100644 --- a/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Model.LiveTv; -using System; +using System; using System.Collections.Generic; namespace MediaBrowser.Controller.LiveTv @@ -16,11 +15,6 @@ namespace MediaBrowser.Controller.LiveTv /// public string ChannelId { get; set; } - /// - /// ChannelName of the recording. - /// - public string ChannelName { get; set; } - /// /// Gets or sets the program identifier. /// diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index 499b217b5..5d92a212f 100644 --- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs @@ -21,11 +21,6 @@ namespace MediaBrowser.Controller.LiveTv /// public string ChannelId { get; set; } - /// - /// ChannelName of the recording. - /// - public string ChannelName { get; set; } - /// /// Gets or sets the program identifier. /// diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs index b493fd15a..dad0c915d 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -30,18 +30,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv _logger = logger; } - public TimerInfoDto GetTimerInfoDto(TimerInfo info, ILiveTvService service, LiveTvProgram program) + public TimerInfoDto GetTimerInfoDto(TimerInfo info, ILiveTvService service, LiveTvProgram program, LiveTvChannel channel) { var dto = new TimerInfoDto { Id = GetInternalTimerId(service.Name, info.Id).ToString("N"), - ChannelName = info.ChannelName, Overview = info.Overview, EndDate = info.EndDate, Name = info.Name, StartDate = info.StartDate, ExternalId = info.Id, - ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"), + ChannelId = GetInternalChannelId(service.Name, info.ChannelId).ToString("N"), Status = info.Status, SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(service.Name, info.SeriesTimerId).ToString("N"), PrePaddingSeconds = info.PrePaddingSeconds, @@ -69,15 +68,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId; } + if (channel != null) + { + dto.ChannelName = channel.ChannelInfo.Name; + } + return dto; } - public SeriesTimerInfoDto GetSeriesTimerInfoDto(SeriesTimerInfo info, ILiveTvService service) + public SeriesTimerInfoDto GetSeriesTimerInfoDto(SeriesTimerInfo info, ILiveTvService service, string channelName) { var dto = new SeriesTimerInfoDto { Id = GetInternalSeriesTimerId(service.Name, info.Id).ToString("N"), - ChannelName = info.ChannelName, Overview = info.Overview, EndDate = info.EndDate, Name = info.Name, @@ -94,12 +97,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv RecordNewOnly = info.RecordNewOnly, ExternalChannelId = info.ChannelId, ExternalProgramId = info.ProgramId, - ServiceName = service.Name + ServiceName = service.Name, + ChannelName = channelName }; if (!string.IsNullOrEmpty(info.ChannelId)) { - dto.ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"); + dto.ChannelId = GetInternalChannelId(service.Name, info.ChannelId).ToString("N"); } if (!string.IsNullOrEmpty(info.ProgramId)) @@ -156,22 +160,21 @@ namespace MediaBrowser.Server.Implementations.LiveTv return val.Value * 2; } - public RecordingInfoDto GetRecordingInfoDto(LiveTvRecording recording, ILiveTvService service, User user = null) + public RecordingInfoDto GetRecordingInfoDto(LiveTvRecording recording, LiveTvChannel channel, ILiveTvService service, User user = null) { var info = recording.RecordingInfo; - + var dto = new RecordingInfoDto { Id = GetInternalRecordingId(service.Name, info.Id).ToString("N"), SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(service.Name, info.SeriesTimerId).ToString("N"), Type = recording.GetClientTypeName(), - ChannelName = info.ChannelName, Overview = info.Overview, EndDate = info.EndDate, Name = info.Name, StartDate = info.StartDate, ExternalId = info.Id, - ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"), + ChannelId = GetInternalChannelId(service.Name, info.ChannelId).ToString("N"), Status = info.Status, Path = info.Path, Genres = info.Genres, @@ -212,6 +215,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N"); } + if (channel != null) + { + dto.ChannelName = channel.ChannelInfo.Name; + } + return dto; } @@ -259,7 +267,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv var dto = new ProgramInfoDto { Id = GetInternalProgramId(item.ServiceName, program.Id).ToString("N"), - ChannelId = GetInternalChannelId(item.ServiceName, program.ChannelId, program.ChannelName).ToString("N"), + ChannelId = GetInternalChannelId(item.ServiceName, program.ChannelId).ToString("N"), Overview = program.Overview, EndDate = program.EndDate, Genres = program.Genres, @@ -315,9 +323,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv return null; } - public Guid GetInternalChannelId(string serviceName, string externalId, string channelName) + public Guid GetInternalChannelId(string serviceName, string externalId) { - var name = serviceName + externalId + channelName; + var name = serviceName + externalId; return name.ToLower().GetMBId(typeof(LiveTvChannel)); } @@ -354,7 +362,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv { var info = new TimerInfo { - ChannelName = dto.ChannelName, Overview = dto.Overview, EndDate = dto.EndDate, Name = dto.Name, @@ -416,7 +423,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv { var info = new SeriesTimerInfo { - ChannelName = dto.ChannelName, Overview = dto.Overview, EndDate = dto.EndDate, Name = dto.Name, diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index d800b9948..281f38e87 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -184,7 +184,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv isNew = true; } - var id = _tvDtoService.GetInternalChannelId(serviceName, channelInfo.Id, channelInfo.Name); + var id = _tvDtoService.GetInternalChannelId(serviceName, channelInfo.Id); var item = _itemRepo.RetrieveItem(id) as LiveTvChannel; @@ -295,8 +295,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv programs = programs.Where(i => { var programChannelId = i.ProgramInfo.ChannelId; - - var internalProgramChannelId = _tvDtoService.GetInternalChannelId(serviceName, programChannelId, i.ProgramInfo.ChannelName); + + var internalProgramChannelId = _tvDtoService.GetInternalChannelId(serviceName, programChannelId); return guids.Contains(internalProgramChannelId); }); @@ -426,7 +426,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv if (!string.IsNullOrEmpty(query.ChannelId)) { list = list - .Where(i => _tvDtoService.GetInternalChannelId(service.Name, i.ChannelId, i.ChannelName) == new Guid(query.ChannelId)) + .Where(i => _tvDtoService.GetInternalChannelId(service.Name, i.ChannelId) == new Guid(query.ChannelId)) .ToList(); } @@ -445,7 +445,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv } var returnArray = entities - .Select(i => _tvDtoService.GetRecordingInfoDto(i, service, user)) + .Select(i => + { + var channel = string.IsNullOrEmpty(i.RecordingInfo.ChannelId) ? null : GetInternalChannel(_tvDtoService.GetInternalChannelId(service.Name, i.RecordingInfo.ChannelId).ToString("N")); + return _tvDtoService.GetRecordingInfoDto(i, channel, service, user); + }) .OrderByDescending(i => i.StartDate) .ToArray(); @@ -493,15 +497,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv if (!string.IsNullOrEmpty(query.ChannelId)) { var guid = new Guid(query.ChannelId); - timers = timers.Where(i => guid == _tvDtoService.GetInternalChannelId(service.Name, i.ChannelId, i.ChannelName)); + timers = timers.Where(i => guid == _tvDtoService.GetInternalChannelId(service.Name, i.ChannelId)); } var returnArray = timers .Select(i => { var program = string.IsNullOrEmpty(i.ProgramId) ? null : GetInternalProgram(_tvDtoService.GetInternalProgramId(service.Name, i.ProgramId).ToString("N")); + var channel = string.IsNullOrEmpty(i.ChannelId) ? null : GetInternalChannel(_tvDtoService.GetInternalChannelId(service.Name, i.ChannelId).ToString("N")); - return _tvDtoService.GetTimerInfoDto(i, service, program); + return _tvDtoService.GetTimerInfoDto(i, service, program, channel); }) .OrderBy(i => i.StartDate) .ToArray(); @@ -591,7 +596,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv var timers = await service.GetSeriesTimersAsync(cancellationToken).ConfigureAwait(false); var returnArray = timers - .Select(i => _tvDtoService.GetSeriesTimerInfoDto(i, service)) + .Select(i => + { + string channelName = null; + + if (!string.IsNullOrEmpty(i.ChannelId)) + { + var internalChannelId = _tvDtoService.GetInternalChannelId(service.Name, i.ChannelId); + var channel = GetInternalChannel(internalChannelId.ToString("N")); + channelName = channel == null ? null : channel.ChannelInfo.Name; + } + + return _tvDtoService.GetSeriesTimerInfoDto(i, service, channelName); + + }) .OrderByDescending(i => i.StartDate) .ToArray(); @@ -617,7 +635,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv var info = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false); - var obj = _tvDtoService.GetSeriesTimerInfoDto(info, service); + var obj = _tvDtoService.GetSeriesTimerInfoDto(info, service, null); obj.Id = obj.ExternalId = string.Empty; diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs index 32df5fe13..2608ac172 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs @@ -117,8 +117,6 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks /// IEnumerable{BaseTaskTrigger}. public IEnumerable GetDefaultTriggers() { - // IMPORTANT: Make sure to update the dashboard "wizardsettings" page if this default ever changes - return new ITaskTrigger[] { new DailyTrigger { TimeOfDay = TimeSpan.FromHours(4) } @@ -197,7 +195,6 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks { get { - // IMPORTANT: Make sure to update the dashboard "wizardsettings" page if this name ever changes return "Chapter image extraction"; } } diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index d3850017c..dafa63f9a 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -547,6 +547,7 @@ namespace MediaBrowser.WebDashboard.Api "userprofilespage.js", "usersettings.js", "wizardfinishpage.js", + "wizardimagesettings.js", "wizardservice.js", "wizardstartpage.js", "wizardsettings.js", diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index bdf347607..c6177969d 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.289 + 3.0.290 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 7f5f64904..87411f959 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.289 + 3.0.290 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index d99d6be97..fc944e2f2 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.289 + 3.0.290 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +