live tv updates

This commit is contained in:
Luke Pulverenti 2013-12-22 22:46:03 -05:00
parent fc3b78c056
commit c0bbf8945f
10 changed files with 56 additions and 50 deletions

View File

@ -22,11 +22,6 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
public string ChannelId { get; set; }
/// <summary>
/// ChannelName of the recording.
/// </summary>
public string ChannelName { get; set; }
/// <summary>
/// Gets or sets the type of the channel.
/// </summary>

View File

@ -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
/// </summary>
public string ChannelId { get; set; }
/// <summary>
/// ChannelName of the recording.
/// </summary>
public string ChannelName { get; set; }
/// <summary>
/// Gets or sets the program identifier.
/// </summary>

View File

@ -21,11 +21,6 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
public string ChannelId { get; set; }
/// <summary>
/// ChannelName of the recording.
/// </summary>
public string ChannelName { get; set; }
/// <summary>
/// Gets or sets the program identifier.
/// </summary>

View File

@ -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,

View File

@ -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;

View File

@ -117,8 +117,6 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<ITaskTrigger> 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";
}
}

View File

@ -547,6 +547,7 @@ namespace MediaBrowser.WebDashboard.Api
"userprofilespage.js",
"usersettings.js",
"wizardfinishpage.js",
"wizardimagesettings.js",
"wizardservice.js",
"wizardstartpage.js",
"wizardsettings.js",

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.289</version>
<version>3.0.290</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.289" />
<dependency id="MediaBrowser.Common" version="3.0.290" />
<dependency id="NLog" version="2.1.0" />
<dependency id="SimpleInjector" version="2.4.0" />
<dependency id="sharpcompress" version="0.10.2" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.289</version>
<version>3.0.290</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.289</version>
<version>3.0.290</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.289" />
<dependency id="MediaBrowser.Common" version="3.0.290" />
</dependencies>
</metadata>
<files>