diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-08-24 15:53:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-24 15:53:36 -0400 |
| commit | 421f506d3f5dcfd020355f2dbc37db3ed6493363 (patch) | |
| tree | 1d9a69d530f59bf261b0fc8a63f2ceb1a1608fd3 /Emby.Server.Implementations/LiveTv | |
| parent | 2bd37fd2c25cd740f4e9f69c4f9a766b10467ded (diff) | |
| parent | 165069ce6337919ebc824d8cf0ef1ef945835718 (diff) | |
Merge pull request #2841 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/LiveTv')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 61 | ||||
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs | 17 |
2 files changed, 22 insertions, 56 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index f3d40ae19e..2e12f46bf9 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -607,20 +607,22 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV var timer = _timerProvider.GetTimer(timerId); if (timer != null) { + timer.Status = RecordingStatus.Cancelled; + if (string.IsNullOrWhiteSpace(timer.SeriesTimerId) || isSeriesCancelled) { _timerProvider.Delete(timer); } else { - timer.Status = RecordingStatus.Cancelled; _timerProvider.AddOrUpdate(timer, false); } } ActiveRecordingInfo activeRecordingInfo; if (_activeRecordings.TryGetValue(timerId, out activeRecordingInfo)) - { + { + activeRecordingInfo.Timer = timer; activeRecordingInfo.CancellationTokenSource.Cancel(); } } @@ -865,7 +867,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public async Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken) { return new List<RecordingInfo>(); - //return _activeRecordings.Values.ToList().Select(GetRecordingInfo).ToList(); } public string GetActiveRecordingPath(string id) @@ -881,7 +882,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public IEnumerable<ActiveRecordingInfo> GetAllActiveRecordings() { - return _activeRecordings.Values; + return _activeRecordings.Values.Where(i => i.Timer.Status == RecordingStatus.InProgress && !i.CancellationTokenSource.IsCancellationRequested); } public ActiveRecordingInfo GetActiveRecordingInfo(string path) @@ -893,59 +894,19 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV foreach (var recording in _activeRecordings.Values) { - if (string.Equals(recording.Path, path, StringComparison.Ordinal)) + if (string.Equals(recording.Path, path, StringComparison.Ordinal) && !recording.CancellationTokenSource.IsCancellationRequested) { + var timer = recording.Timer; + if (timer.Status != RecordingStatus.InProgress) + { + return null; + } return recording; } } return null; } - private RecordingInfo GetRecordingInfo(ActiveRecordingInfo info) - { - var timer = info.Timer; - var program = info.Program; - - var result = new RecordingInfo - { - ChannelId = timer.ChannelId, - CommunityRating = timer.CommunityRating, - DateLastUpdated = DateTime.UtcNow, - EndDate = timer.EndDate, - EpisodeTitle = timer.EpisodeTitle, - Genres = timer.Genres, - Id = "recording" + timer.Id, - IsKids = timer.IsKids, - IsMovie = timer.IsMovie, - IsNews = timer.IsNews, - IsRepeat = timer.IsRepeat, - IsSeries = timer.IsProgramSeries, - IsSports = timer.IsSports, - Name = timer.Name, - OfficialRating = timer.OfficialRating, - OriginalAirDate = timer.OriginalAirDate, - Overview = timer.Overview, - ProgramId = timer.ProgramId, - SeriesTimerId = timer.SeriesTimerId, - StartDate = timer.StartDate, - Status = RecordingStatus.InProgress, - TimerId = timer.Id - }; - - if (program != null) - { - result.Audio = program.Audio; - result.ImagePath = program.ImagePath; - result.ImageUrl = program.ImageUrl; - result.IsHD = program.IsHD; - result.IsLive = program.IsLive; - result.IsPremiere = program.IsPremiere; - result.ShowId = program.ShowId; - } - - return result; - } - public Task<IEnumerable<TimerInfo>> GetTimersAsync(CancellationToken cancellationToken) { var excludeStatues = new List<RecordingStatus> diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 6fe3615d38..b7cfdea1b5 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -358,14 +358,19 @@ namespace Emby.Server.Implementations.LiveTv.Listings if (details.metadata != null) { - var gracenote = details.metadata.Find(x => x.Gracenote != null).Gracenote; - if (gracenote != null) + foreach (var metadataProgram in details.metadata) { - info.SeasonNumber = gracenote.season; - - if (gracenote.episode > 0) + var gracenote = metadataProgram.Gracenote; + if (gracenote != null) { - info.EpisodeNumber = gracenote.episode; + info.SeasonNumber = gracenote.season; + + if (gracenote.episode > 0) + { + info.EpisodeNumber = gracenote.episode; + } + + break; } } } |
