From 561028c90734b911ebb5eec26aa071fb6851a2a6 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 17 Apr 2017 15:01:16 -0400 Subject: update automated checkins --- .../Session/SessionManager.cs | 38 ++++++++-------------- 1 file changed, 14 insertions(+), 24 deletions(-) (limited to 'Emby.Server.Implementations/Session/SessionManager.cs') diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index ed0a47121e..63556c1ce1 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -310,10 +310,7 @@ namespace Emby.Server.Implementations.Session /// /// Updates the now playing item id. /// - /// The session. - /// The information. - /// The library item. - private async Task UpdateNowPlayingItem(SessionInfo session, PlaybackProgressInfo info, BaseItem libraryItem) + private async Task UpdateNowPlayingItem(SessionInfo session, PlaybackProgressInfo info, BaseItem libraryItem, bool updateLastCheckInTime) { if (string.IsNullOrWhiteSpace(info.MediaSourceId)) { @@ -352,7 +349,11 @@ namespace Emby.Server.Implementations.Session session.NowPlayingItem = info.Item; session.LastActivityDate = DateTime.UtcNow; - session.LastPlaybackCheckIn = DateTime.UtcNow; + + if (updateLastCheckInTime) + { + session.LastPlaybackCheckIn = DateTime.UtcNow; + } session.PlayState.IsPaused = info.IsPaused; session.PlayState.PositionTicks = info.PositionTicks; @@ -604,7 +605,7 @@ namespace Emby.Server.Implementations.Session ? null : GetNowPlayingItem(session, info.ItemId); - await UpdateNowPlayingItem(session, info, libraryItem).ConfigureAwait(false); + await UpdateNowPlayingItem(session, info, libraryItem, true).ConfigureAwait(false); if (!string.IsNullOrEmpty(session.DeviceId) && info.PlayMethod != PlayMethod.Transcode) { @@ -671,14 +672,15 @@ namespace Emby.Server.Implementations.Session await _userDataManager.SaveUserData(userId, item, data, UserDataSaveReason.PlaybackStart, CancellationToken.None).ConfigureAwait(false); } + public Task OnPlaybackProgress(PlaybackProgressInfo info) + { + return OnPlaybackProgress(info, false); + } + /// /// Used to report playback progress for an item /// - /// The info. - /// Task. - /// - /// positionTicks - public async Task OnPlaybackProgress(PlaybackProgressInfo info) + public async Task OnPlaybackProgress(PlaybackProgressInfo info, bool isAutomated) { if (info == null) { @@ -691,7 +693,7 @@ namespace Emby.Server.Implementations.Session ? null : GetNowPlayingItem(session, info.ItemId); - await UpdateNowPlayingItem(session, info, libraryItem).ConfigureAwait(false); + await UpdateNowPlayingItem(session, info, libraryItem, !isAutomated).ConfigureAwait(false); var users = GetUsers(session); @@ -703,18 +705,6 @@ namespace Emby.Server.Implementations.Session } } - if (!string.IsNullOrWhiteSpace(info.LiveStreamId)) - { - try - { - await _mediaSourceManager.PingLiveStream(info.LiveStreamId, CancellationToken.None).ConfigureAwait(false); - } - catch (Exception ex) - { - _logger.ErrorException("Error closing live stream", ex); - } - } - EventHelper.FireEventIfNotNull(PlaybackProgress, this, new PlaybackProgressEventArgs { Item = libraryItem, -- cgit v1.2.3