mirror of https://github.com/jellyfin/jellyfin.git
stub out config setting to remember tracks
This commit is contained in:
parent
10c1225a84
commit
299ac388b3
|
@ -48,11 +48,17 @@ namespace MediaBrowser.Model.Configuration
|
||||||
public bool HidePlayedInLatest { get; set; }
|
public bool HidePlayedInLatest { get; set; }
|
||||||
public bool DisplayChannelsInline { get; set; }
|
public bool DisplayChannelsInline { get; set; }
|
||||||
|
|
||||||
|
public bool RememberAudioSelections { get; set; }
|
||||||
|
public bool RememberSubtitleSelections { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UserConfiguration()
|
public UserConfiguration()
|
||||||
{
|
{
|
||||||
|
RememberAudioSelections = true;
|
||||||
|
RememberSubtitleSelections = true;
|
||||||
|
|
||||||
HidePlayedInLatest = true;
|
HidePlayedInLatest = true;
|
||||||
PlayDefaultAudioTrack = true;
|
PlayDefaultAudioTrack = true;
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
private void SetDefaultSubtitleStreamIndex(MediaSourceInfo source, UserItemData userData, User user)
|
private void SetDefaultSubtitleStreamIndex(MediaSourceInfo source, UserItemData userData, User user)
|
||||||
{
|
{
|
||||||
if (userData.SubtitleStreamIndex.HasValue)
|
if (userData.SubtitleStreamIndex.HasValue && user.Configuration.RememberSubtitleSelections)
|
||||||
{
|
{
|
||||||
var index = userData.SubtitleStreamIndex.Value;
|
var index = userData.SubtitleStreamIndex.Value;
|
||||||
// Make sure the saved index is still valid
|
// Make sure the saved index is still valid
|
||||||
|
@ -307,7 +307,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
private void SetDefaultAudioStreamIndex(MediaSourceInfo source, UserItemData userData, User user)
|
private void SetDefaultAudioStreamIndex(MediaSourceInfo source, UserItemData userData, User user)
|
||||||
{
|
{
|
||||||
if (userData.AudioStreamIndex.HasValue)
|
if (userData.AudioStreamIndex.HasValue && user.Configuration.RememberAudioSelections)
|
||||||
{
|
{
|
||||||
var index = userData.AudioStreamIndex.Value;
|
var index = userData.AudioStreamIndex.Value;
|
||||||
// Make sure the saved index is still valid
|
// Make sure the saved index is still valid
|
||||||
|
|
|
@ -680,7 +680,7 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
|
|
||||||
foreach (var user in users)
|
foreach (var user in users)
|
||||||
{
|
{
|
||||||
await OnPlaybackProgress(user.Id, key, libraryItem, info).ConfigureAwait(false);
|
await OnPlaybackProgress(user, key, libraryItem, info).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,9 +712,9 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
StartIdleCheckTimer();
|
StartIdleCheckTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnPlaybackProgress(Guid userId, string userDataKey, BaseItem item, PlaybackProgressInfo info)
|
private async Task OnPlaybackProgress(User user, string userDataKey, BaseItem item, PlaybackProgressInfo info)
|
||||||
{
|
{
|
||||||
var data = _userDataRepository.GetUserData(userId, userDataKey);
|
var data = _userDataRepository.GetUserData(user.Id, userDataKey);
|
||||||
|
|
||||||
var positionTicks = info.PositionTicks;
|
var positionTicks = info.PositionTicks;
|
||||||
|
|
||||||
|
@ -722,17 +722,32 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
_userDataRepository.UpdatePlayState(item, data, positionTicks.Value);
|
_userDataRepository.UpdatePlayState(item, data, positionTicks.Value);
|
||||||
|
|
||||||
UpdatePlaybackSettings(info, data);
|
UpdatePlaybackSettings(user, info, data);
|
||||||
|
|
||||||
await _userDataRepository.SaveUserData(userId, item, data, UserDataSaveReason.PlaybackProgress, CancellationToken.None).ConfigureAwait(false);
|
await _userDataRepository.SaveUserData(user.Id, item, data, UserDataSaveReason.PlaybackProgress, CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdatePlaybackSettings(PlaybackProgressInfo info, UserItemData data)
|
private void UpdatePlaybackSettings(User user, PlaybackProgressInfo info, UserItemData data)
|
||||||
|
{
|
||||||
|
if (user.Configuration.RememberAudioSelections)
|
||||||
{
|
{
|
||||||
data.AudioStreamIndex = info.AudioStreamIndex;
|
data.AudioStreamIndex = info.AudioStreamIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.AudioStreamIndex = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user.Configuration.RememberSubtitleSelections)
|
||||||
|
{
|
||||||
data.SubtitleStreamIndex = info.SubtitleStreamIndex;
|
data.SubtitleStreamIndex = info.SubtitleStreamIndex;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.SubtitleStreamIndex = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to report that playback has ended for an item
|
/// Used to report that playback has ended for an item
|
||||||
|
|
Loading…
Reference in New Issue