live tv updates

pull/702/head
Luke Pulverenti 11 years ago
parent fc3b78c056
commit c0bbf8945f

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

@ -1,5 +1,4 @@
using MediaBrowser.Model.LiveTv; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace MediaBrowser.Controller.LiveTv namespace MediaBrowser.Controller.LiveTv
@ -16,11 +15,6 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary> /// </summary>
public string ChannelId { get; set; } public string ChannelId { get; set; }
/// <summary>
/// ChannelName of the recording.
/// </summary>
public string ChannelName { get; set; }
/// <summary> /// <summary>
/// Gets or sets the program identifier. /// Gets or sets the program identifier.
/// </summary> /// </summary>

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

@ -30,18 +30,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv
_logger = logger; _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 var dto = new TimerInfoDto
{ {
Id = GetInternalTimerId(service.Name, info.Id).ToString("N"), Id = GetInternalTimerId(service.Name, info.Id).ToString("N"),
ChannelName = info.ChannelName,
Overview = info.Overview, Overview = info.Overview,
EndDate = info.EndDate, EndDate = info.EndDate,
Name = info.Name, Name = info.Name,
StartDate = info.StartDate, StartDate = info.StartDate,
ExternalId = info.Id, ExternalId = info.Id,
ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"), ChannelId = GetInternalChannelId(service.Name, info.ChannelId).ToString("N"),
Status = info.Status, Status = info.Status,
SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(service.Name, info.SeriesTimerId).ToString("N"), SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(service.Name, info.SeriesTimerId).ToString("N"),
PrePaddingSeconds = info.PrePaddingSeconds, PrePaddingSeconds = info.PrePaddingSeconds,
@ -69,15 +68,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv
dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId; dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId;
} }
if (channel != null)
{
dto.ChannelName = channel.ChannelInfo.Name;
}
return dto; return dto;
} }
public SeriesTimerInfoDto GetSeriesTimerInfoDto(SeriesTimerInfo info, ILiveTvService service) public SeriesTimerInfoDto GetSeriesTimerInfoDto(SeriesTimerInfo info, ILiveTvService service, string channelName)
{ {
var dto = new SeriesTimerInfoDto var dto = new SeriesTimerInfoDto
{ {
Id = GetInternalSeriesTimerId(service.Name, info.Id).ToString("N"), Id = GetInternalSeriesTimerId(service.Name, info.Id).ToString("N"),
ChannelName = info.ChannelName,
Overview = info.Overview, Overview = info.Overview,
EndDate = info.EndDate, EndDate = info.EndDate,
Name = info.Name, Name = info.Name,
@ -94,12 +97,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv
RecordNewOnly = info.RecordNewOnly, RecordNewOnly = info.RecordNewOnly,
ExternalChannelId = info.ChannelId, ExternalChannelId = info.ChannelId,
ExternalProgramId = info.ProgramId, ExternalProgramId = info.ProgramId,
ServiceName = service.Name ServiceName = service.Name,
ChannelName = channelName
}; };
if (!string.IsNullOrEmpty(info.ChannelId)) 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)) if (!string.IsNullOrEmpty(info.ProgramId))
@ -156,22 +160,21 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return val.Value * 2; 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 info = recording.RecordingInfo;
var dto = new RecordingInfoDto var dto = new RecordingInfoDto
{ {
Id = GetInternalRecordingId(service.Name, info.Id).ToString("N"), Id = GetInternalRecordingId(service.Name, info.Id).ToString("N"),
SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(service.Name, info.SeriesTimerId).ToString("N"), SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(service.Name, info.SeriesTimerId).ToString("N"),
Type = recording.GetClientTypeName(), Type = recording.GetClientTypeName(),
ChannelName = info.ChannelName,
Overview = info.Overview, Overview = info.Overview,
EndDate = info.EndDate, EndDate = info.EndDate,
Name = info.Name, Name = info.Name,
StartDate = info.StartDate, StartDate = info.StartDate,
ExternalId = info.Id, ExternalId = info.Id,
ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"), ChannelId = GetInternalChannelId(service.Name, info.ChannelId).ToString("N"),
Status = info.Status, Status = info.Status,
Path = info.Path, Path = info.Path,
Genres = info.Genres, Genres = info.Genres,
@ -212,6 +215,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N"); dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N");
} }
if (channel != null)
{
dto.ChannelName = channel.ChannelInfo.Name;
}
return dto; return dto;
} }
@ -259,7 +267,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var dto = new ProgramInfoDto var dto = new ProgramInfoDto
{ {
Id = GetInternalProgramId(item.ServiceName, program.Id).ToString("N"), 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, Overview = program.Overview,
EndDate = program.EndDate, EndDate = program.EndDate,
Genres = program.Genres, Genres = program.Genres,
@ -315,9 +323,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return null; 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)); return name.ToLower().GetMBId(typeof(LiveTvChannel));
} }
@ -354,7 +362,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{ {
var info = new TimerInfo var info = new TimerInfo
{ {
ChannelName = dto.ChannelName,
Overview = dto.Overview, Overview = dto.Overview,
EndDate = dto.EndDate, EndDate = dto.EndDate,
Name = dto.Name, Name = dto.Name,
@ -416,7 +423,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{ {
var info = new SeriesTimerInfo var info = new SeriesTimerInfo
{ {
ChannelName = dto.ChannelName,
Overview = dto.Overview, Overview = dto.Overview,
EndDate = dto.EndDate, EndDate = dto.EndDate,
Name = dto.Name, Name = dto.Name,

@ -184,7 +184,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
isNew = true; 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; var item = _itemRepo.RetrieveItem(id) as LiveTvChannel;
@ -295,8 +295,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
programs = programs.Where(i => programs = programs.Where(i =>
{ {
var programChannelId = i.ProgramInfo.ChannelId; var programChannelId = i.ProgramInfo.ChannelId;
var internalProgramChannelId = _tvDtoService.GetInternalChannelId(serviceName, programChannelId, i.ProgramInfo.ChannelName); var internalProgramChannelId = _tvDtoService.GetInternalChannelId(serviceName, programChannelId);
return guids.Contains(internalProgramChannelId); return guids.Contains(internalProgramChannelId);
}); });
@ -426,7 +426,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
if (!string.IsNullOrEmpty(query.ChannelId)) if (!string.IsNullOrEmpty(query.ChannelId))
{ {
list = list 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(); .ToList();
} }
@ -445,7 +445,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
} }
var returnArray = entities 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) .OrderByDescending(i => i.StartDate)
.ToArray(); .ToArray();
@ -493,15 +497,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv
if (!string.IsNullOrEmpty(query.ChannelId)) if (!string.IsNullOrEmpty(query.ChannelId))
{ {
var guid = new Guid(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 var returnArray = timers
.Select(i => .Select(i =>
{ {
var program = string.IsNullOrEmpty(i.ProgramId) ? null : GetInternalProgram(_tvDtoService.GetInternalProgramId(service.Name, i.ProgramId).ToString("N")); 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) .OrderBy(i => i.StartDate)
.ToArray(); .ToArray();
@ -591,7 +596,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var timers = await service.GetSeriesTimersAsync(cancellationToken).ConfigureAwait(false); var timers = await service.GetSeriesTimersAsync(cancellationToken).ConfigureAwait(false);
var returnArray = timers 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) .OrderByDescending(i => i.StartDate)
.ToArray(); .ToArray();
@ -617,7 +635,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var info = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false); 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; obj.Id = obj.ExternalId = string.Empty;

@ -117,8 +117,6 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<ITaskTrigger> GetDefaultTriggers() public IEnumerable<ITaskTrigger> GetDefaultTriggers()
{ {
// IMPORTANT: Make sure to update the dashboard "wizardsettings" page if this default ever changes
return new ITaskTrigger[] return new ITaskTrigger[]
{ {
new DailyTrigger { TimeOfDay = TimeSpan.FromHours(4) } new DailyTrigger { TimeOfDay = TimeSpan.FromHours(4) }
@ -197,7 +195,6 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
{ {
get get
{ {
// IMPORTANT: Make sure to update the dashboard "wizardsettings" page if this name ever changes
return "Chapter image extraction"; return "Chapter image extraction";
} }
} }

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

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.289</version> <version>3.0.290</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <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> <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> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <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="NLog" version="2.1.0" />
<dependency id="SimpleInjector" version="2.4.0" /> <dependency id="SimpleInjector" version="2.4.0" />
<dependency id="sharpcompress" version="0.10.2" /> <dependency id="sharpcompress" version="0.10.2" />

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

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.289</version> <version>3.0.290</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description> <description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.289" /> <dependency id="MediaBrowser.Common" version="3.0.290" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>

Loading…
Cancel
Save