update channel display

This commit is contained in:
Luke Pulverenti 2016-05-17 15:18:50 -04:00
parent 6186c4ff70
commit da29fc8c68
2 changed files with 17 additions and 1 deletions

View File

@ -288,6 +288,8 @@ namespace MediaBrowser.Model.Querying
[Obsolete] [Obsolete]
public string Person { get; set; } public string Person { get; set; }
public bool EnableTotalRecordCount { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ItemQuery" /> class. /// Initializes a new instance of the <see cref="ItemQuery" /> class.
/// </summary> /// </summary>
@ -306,6 +308,8 @@ namespace MediaBrowser.Model.Querying
VideoTypes = new VideoType[] { }; VideoTypes = new VideoType[] { };
EnableTotalRecordCount = true;
Artists = new string[] { }; Artists = new string[] { };
Studios = new string[] { }; Studios = new string[] { };

View File

@ -527,6 +527,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private async Task<LiveTvChannel> GetChannel(ChannelInfo channelInfo, string serviceName, Guid parentFolderId, CancellationToken cancellationToken) private async Task<LiveTvChannel> GetChannel(ChannelInfo channelInfo, string serviceName, Guid parentFolderId, CancellationToken cancellationToken)
{ {
var isNew = false; var isNew = false;
var forceUpdate = false;
var id = _tvDtoService.GetInternalChannelId(serviceName, channelInfo.Id); var id = _tvDtoService.GetInternalChannelId(serviceName, channelInfo.Id);
@ -576,10 +577,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv
if (!string.IsNullOrWhiteSpace(channelInfo.ImagePath)) if (!string.IsNullOrWhiteSpace(channelInfo.ImagePath))
{ {
item.SetImagePath(ImageType.Primary, channelInfo.ImagePath); item.SetImagePath(ImageType.Primary, channelInfo.ImagePath);
forceUpdate = true;
} }
else if (!string.IsNullOrWhiteSpace(channelInfo.ImageUrl)) else if (!string.IsNullOrWhiteSpace(channelInfo.ImageUrl))
{ {
item.SetImagePath(ImageType.Primary, channelInfo.ImageUrl); item.SetImagePath(ImageType.Primary, channelInfo.ImageUrl);
forceUpdate = true;
} }
} }
@ -588,9 +591,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
item.Name = channelInfo.Name; item.Name = channelInfo.Name;
} }
if (isNew)
{
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
}
else if (forceUpdate)
{
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
}
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem) await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem)
{ {
ForceSave = isNew ForceSave = isNew || forceUpdate
}, cancellationToken); }, cancellationToken);