recording fixes

pull/702/head
Luke Pulverenti 9 years ago
parent cc213128e2
commit 9ec1376e5f

@ -338,8 +338,9 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <param name="item">The item.</param>
/// <param name="dto">The dto.</param>
/// <param name="addChannelInfo">if set to <c>true</c> [add channel information].</param>
/// <param name="user">The user.</param>
void AddInfoToProgramDto(BaseItem item, BaseItemDto dto, User user = null);
void AddInfoToProgramDto(BaseItem item, BaseItemDto dto, bool addChannelInfo, User user = null);
/// <summary>
/// Saves the tuner host.
/// </summary>

@ -35,6 +35,11 @@
/// </summary>
CanDownload,
/// <summary>
/// The channel information
/// </summary>
ChannelInfo,
/// <summary>
/// The chapters
/// </summary>

@ -398,7 +398,7 @@ namespace MediaBrowser.Server.Implementations.Dto
else if (item is LiveTvProgram)
{
_livetvManager().AddInfoToProgramDto(item, dto, user);
_livetvManager().AddInfoToProgramDto(item, dto, fields.Contains(ItemFields.ChannelInfo), user);
}
return dto;

@ -82,7 +82,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
UserAgent = UserAgent,
CancellationToken = cancellationToken,
// The data can be large so give it some extra time
TimeoutMs = 60000
TimeoutMs = 60000,
LogErrorResponseBody = true
};
httpOptions.RequestHeaders["token"] = token;
@ -123,7 +124,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
Url = ApiUrl + "/programs",
UserAgent = UserAgent,
CancellationToken = cancellationToken
CancellationToken = cancellationToken,
LogErrorResponseBody = true
};
httpOptions.RequestHeaders["token"] = token;
@ -213,7 +215,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
Url = ApiUrl + "/lineups/" + info.ListingsId,
UserAgent = UserAgent,
CancellationToken = cancellationToken
CancellationToken = cancellationToken,
LogErrorResponseBody = true
};
httpOptions.RequestHeaders["token"] = token;
@ -451,7 +454,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
Url = ApiUrl + "/metadata/programs",
UserAgent = UserAgent,
CancellationToken = cancellationToken,
RequestContent = imageIdString
RequestContent = imageIdString,
LogErrorResponseBody = true
};
List<ScheduleDirect.ShowImages> images;
using (var innerResponse2 = await _httpClient.Post(httpOptions))
@ -478,7 +482,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
Url = ApiUrl + "/headends?country=" + country + "&postalcode=" + location,
UserAgent = UserAgent,
CancellationToken = cancellationToken
CancellationToken = cancellationToken,
LogErrorResponseBody = true
};
options.RequestHeaders["token"] = token;
@ -595,7 +600,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
Url = ApiUrl + "/token",
UserAgent = UserAgent,
RequestContent = "{\"username\":\"" + username + "\",\"password\":\"" + password + "\"}",
CancellationToken = cancellationToken
CancellationToken = cancellationToken,
LogErrorResponseBody = true
};
//_logger.Info("Obtaining token from Schedules Direct from addres: " + httpOptions.Url + " with body " +
// httpOptions.RequestContent);
@ -633,7 +639,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
Url = ApiUrl + "/lineups/" + info.ListingsId,
UserAgent = UserAgent,
CancellationToken = cancellationToken
CancellationToken = cancellationToken,
LogErrorResponseBody = true
};
httpOptions.RequestHeaders["token"] = token;
@ -673,7 +680,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
Url = ApiUrl + "/lineups",
UserAgent = UserAgent,
CancellationToken = cancellationToken
CancellationToken = cancellationToken,
LogErrorResponseBody = true
};
options.RequestHeaders["token"] = token;

@ -734,15 +734,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
recording.IsSports = info.IsSports;
recording.SeriesTimerId = info.SeriesTimerId;
recording.StartDate = info.StartDate;
var statusChanged = info.Status != recording.Status;
recording.Status = info.Status;
recording.ServiceName = serviceName;
var originalPath = item.Path;
var pathChanged = false;
if (!string.IsNullOrEmpty(info.Path))
{
item.Path = info.Path;
pathChanged = !string.Equals(item.Path, info.Path);
var fileInfo = _fileSystem.GetFileInfo(info.Path);
recording.DateCreated = _fileSystem.GetCreationTimeUtc(fileInfo);
@ -750,16 +753,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
}
else if (!string.IsNullOrEmpty(info.Url))
{
pathChanged = !string.Equals(item.Path, info.Url);
item.Path = info.Url;
}
var pathChanged = !string.Equals(originalPath, item.Path);
if (isNew)
{
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
}
else if (pathChanged || info.DateLastUpdated > recording.DateLastSaved || info.Status != recording.Status)
else if (pathChanged || info.DateLastUpdated > recording.DateLastSaved || statusChanged)
{
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
}
@ -1388,25 +1390,25 @@ namespace MediaBrowser.Server.Implementations.LiveTv
};
}
public void AddInfoToProgramDto(BaseItem item, BaseItemDto dto, User user = null)
public void AddInfoToProgramDto(BaseItem item, BaseItemDto dto, bool addChannelInfo, User user = null)
{
var program = (LiveTvProgram)item;
var service = GetService(program);
var channel = GetInternalChannel(program.ChannelId);
dto.Id = _tvDtoService.GetInternalProgramId(service.Name, program.ExternalId).ToString("N");
dto.StartDate = program.StartDate;
dto.IsRepeat = program.IsRepeat;
dto.EpisodeTitle = program.EpisodeTitle;
dto.ChannelType = program.ChannelType;
dto.Audio = program.Audio;
if (program.IsHD.HasValue && program.IsHD.Value)
{
dto.IsHD = program.IsHD;
}
if (program.IsRepeat)
{
dto.IsRepeat = program.IsRepeat;
}
if (program.IsMovie)
{
dto.IsMovie = program.IsMovie;
@ -1436,13 +1438,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
dto.IsPremiere = program.IsPremiere;
}
if (channel != null)
if (addChannelInfo)
{
dto.ChannelName = channel.Name;
var channel = GetInternalChannel(program.ChannelId);
if (!string.IsNullOrEmpty(channel.PrimaryImagePath))
if (channel != null)
{
dto.ChannelPrimaryImageTag = _tvDtoService.GetImageTag(channel);
dto.ChannelName = channel.Name;
if (!string.IsNullOrEmpty(channel.PrimaryImagePath))
{
dto.ChannelPrimaryImageTag = _tvDtoService.GetImageTag(channel);
}
}
}
}

Loading…
Cancel
Save