added user data save reason

This commit is contained in:
Luke Pulverenti
2013-10-02 13:23:10 -04:00
parent bb4c918bf8
commit 1f7bc3e61d
9 changed files with 66 additions and 13 deletions

View File

@@ -6,6 +6,7 @@ using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Session;
using System;
@@ -252,7 +253,7 @@ namespace MediaBrowser.Server.Implementations.Session
data.Played = true;
}
await _userDataRepository.SaveUserData(user.Id, key, data, CancellationToken.None).ConfigureAwait(false);
await _userDataRepository.SaveUserData(user.Id, key, data, UserDataSaveReason.PlaybackStart, CancellationToken.None).ConfigureAwait(false);
// Nothing to save here
// Fire events to inform plugins
@@ -295,7 +296,7 @@ namespace MediaBrowser.Server.Implementations.Session
var data = _userDataRepository.GetUserData(user.Id, key);
UpdatePlayState(info.Item, data, info.PositionTicks.Value);
await _userDataRepository.SaveUserData(user.Id, key, data, CancellationToken.None).ConfigureAwait(false);
await _userDataRepository.SaveUserData(user.Id, key, data, UserDataSaveReason.PlaybackProgress, CancellationToken.None).ConfigureAwait(false);
}
EventHelper.QueueEventIfNotNull(PlaybackProgress, this, new PlaybackProgressEventArgs
@@ -348,7 +349,7 @@ namespace MediaBrowser.Server.Implementations.Session
data.PlaybackPositionTicks = 0;
}
await _userDataRepository.SaveUserData(user.Id, key, data, CancellationToken.None).ConfigureAwait(false);
await _userDataRepository.SaveUserData(user.Id, key, data, UserDataSaveReason.PlaybackFinished, CancellationToken.None).ConfigureAwait(false);
EventHelper.QueueEventIfNotNull(PlaybackStopped, this, new PlaybackProgressEventArgs
{