Merge pull request #1238 from MediaBrowser/master

update recording creation
This commit is contained in:
Luke 2015-10-29 18:47:58 -04:00
commit a0a31aaa2a

View File

@ -739,6 +739,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
recording.ExternalId = info.Id; recording.ExternalId = info.Id;
var dataChanged = false;
recording.Audio = info.Audio; recording.Audio = info.Audio;
recording.EndDate = info.EndDate; recording.EndDate = info.EndDate;
recording.EpisodeTitle = info.EpisodeTitle; recording.EpisodeTitle = info.EpisodeTitle;
@ -749,11 +751,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv
recording.IsNews = info.IsNews; recording.IsNews = info.IsNews;
recording.IsPremiere = info.IsPremiere; recording.IsPremiere = info.IsPremiere;
recording.IsRepeat = info.IsRepeat; recording.IsRepeat = info.IsRepeat;
recording.IsSeries = info.IsSeries;
recording.IsSports = info.IsSports; recording.IsSports = info.IsSports;
recording.SeriesTimerId = info.SeriesTimerId; recording.SeriesTimerId = info.SeriesTimerId;
recording.StartDate = info.StartDate; recording.StartDate = info.StartDate;
if (!dataChanged)
{
dataChanged = recording.IsSeries != info.IsSeries;
}
recording.IsSeries = info.IsSeries;
if (!string.IsNullOrWhiteSpace(info.ImagePath)) if (!string.IsNullOrWhiteSpace(info.ImagePath))
{ {
item.SetImagePath(ImageType.Primary, info.ImagePath); item.SetImagePath(ImageType.Primary, info.ImagePath);
@ -762,18 +769,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{ {
item.SetImagePath(ImageType.Primary, info.ImageUrl); item.SetImagePath(ImageType.Primary, info.ImageUrl);
} }
var statusChanged = info.Status != recording.Status; var statusChanged = info.Status != recording.Status;
recording.Status = info.Status; recording.Status = info.Status;
recording.ServiceName = serviceName; recording.ServiceName = serviceName;
var pathChanged = false;
if (!string.IsNullOrEmpty(info.Path)) if (!string.IsNullOrEmpty(info.Path))
{ {
pathChanged = !string.Equals(item.Path, info.Path); if (!dataChanged)
{
dataChanged = !string.Equals(item.Path, info.Path);
}
var fileInfo = _fileSystem.GetFileInfo(info.Path); var fileInfo = _fileSystem.GetFileInfo(info.Path);
recording.DateCreated = _fileSystem.GetCreationTimeUtc(fileInfo); recording.DateCreated = _fileSystem.GetCreationTimeUtc(fileInfo);
@ -782,7 +790,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
} }
else if (!string.IsNullOrEmpty(info.Url)) else if (!string.IsNullOrEmpty(info.Url))
{ {
pathChanged = !string.Equals(item.Path, info.Url); if (!dataChanged)
{
dataChanged = !string.Equals(item.Path, info.Url);
}
item.Path = info.Url; item.Path = info.Url;
} }
@ -792,7 +803,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{ {
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false); await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
} }
else if (pathChanged || info.DateLastUpdated > recording.DateLastSaved || statusChanged) else if (dataChanged || info.DateLastUpdated > recording.DateLastSaved || statusChanged)
{ {
metadataRefreshMode = MetadataRefreshMode.FullRefresh; metadataRefreshMode = MetadataRefreshMode.FullRefresh;
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);