preserve manual recording overrides

This commit is contained in:
Luke Pulverenti 2017-02-20 02:04:03 -05:00
parent 5d8fd7ce39
commit 149d16a314
5 changed files with 65 additions and 15 deletions

View File

@ -635,6 +635,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
existingTimer.Status == RecordingStatus.Completed)
{
existingTimer.Status = RecordingStatus.New;
existingTimer.IsManual = true;
_timerProvider.Update(existingTimer);
return Task.FromResult(existingTimer.Id);
}
@ -663,6 +664,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
RecordingHelper.CopyProgramInfoToTimerInfo(programInfo, timer);
}
timer.IsManual = true;
_timerProvider.Add(timer);
return Task.FromResult(timer.Id);
}
@ -758,6 +760,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
existingTimer.PostPaddingSeconds = updatedTimer.PostPaddingSeconds;
existingTimer.IsPostPaddingRequired = updatedTimer.IsPostPaddingRequired;
existingTimer.IsPrePaddingRequired = updatedTimer.IsPrePaddingRequired;
_timerProvider.Update(existingTimer);
}
return Task.FromResult(true);
@ -2203,6 +2207,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private bool ShouldCancelTimerForSeriesTimer(SeriesTimerInfo seriesTimer, TimerInfo timer)
{
if (timer.IsManual)
{
return false;
}
if (!seriesTimer.RecordAnyTime)
{
if (Math.Abs(seriesTimer.StartDate.TimeOfDay.Ticks - timer.StartDate.TimeOfDay.Ticks) >= TimeSpan.FromMinutes(5).Ticks)

View File

@ -954,8 +954,11 @@ namespace Emby.Server.Implementations.Session
{
var session = GetSessionToRemoteControl(sessionId);
var controllingSession = GetSession(controllingSessionId);
AssertCanControl(session, controllingSession);
if (!string.IsNullOrWhiteSpace(controllingSessionId))
{
var controllingSession = GetSession(controllingSessionId);
AssertCanControl(session, controllingSession);
}
return session.SessionController.SendGeneralCommand(command, cancellationToken);
}
@ -1042,11 +1045,14 @@ namespace Emby.Server.Implementations.Session
}
}
var controllingSession = GetSession(controllingSessionId);
AssertCanControl(session, controllingSession);
if (controllingSession.UserId.HasValue)
if (!string.IsNullOrWhiteSpace(controllingSessionId))
{
command.ControllingUserId = controllingSession.UserId.Value.ToString("N");
var controllingSession = GetSession(controllingSessionId);
AssertCanControl(session, controllingSession);
if (controllingSession.UserId.HasValue)
{
command.ControllingUserId = controllingSession.UserId.Value.ToString("N");
}
}
await session.SessionController.SendPlayCommand(command, cancellationToken).ConfigureAwait(false);
@ -1136,11 +1142,14 @@ namespace Emby.Server.Implementations.Session
{
var session = GetSessionToRemoteControl(sessionId);
var controllingSession = GetSession(controllingSessionId);
AssertCanControl(session, controllingSession);
if (controllingSession.UserId.HasValue)
if (!string.IsNullOrWhiteSpace(controllingSessionId))
{
command.ControllingUserId = controllingSession.UserId.Value.ToString("N");
var controllingSession = GetSession(controllingSessionId);
AssertCanControl(session, controllingSession);
if (controllingSession.UserId.HasValue)
{
command.ControllingUserId = controllingSession.UserId.Value.ToString("N");
}
}
return session.SessionController.SendPlaystateCommand(command, cancellationToken);

View File

@ -127,7 +127,7 @@ namespace MediaBrowser.Api.Playback
SetDeviceSpecificData(item, result.MediaSource, profile, authInfo, request.MaxStreamingBitrate,
request.StartTimeTicks ?? 0, result.MediaSource.Id, request.AudioStreamIndex,
request.SubtitleStreamIndex, request.MaxAudioChannels, request.PlaySessionId, request.UserId);
request.SubtitleStreamIndex, request.MaxAudioChannels, request.PlaySessionId, request.UserId, true, true, true);
}
else
{
@ -169,7 +169,7 @@ namespace MediaBrowser.Api.Playback
{
var mediaSourceId = request.MediaSourceId;
SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId);
SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId, request.EnableDirectPlay, request.EnableDirectStream, request.EnableTranscoding);
}
return info;
@ -251,13 +251,16 @@ namespace MediaBrowser.Api.Playback
int? audioStreamIndex,
int? subtitleStreamIndex,
int? maxAudioChannels,
string userId)
string userId,
bool enableDirectPlay,
bool enableDirectStream,
bool enableTranscoding)
{
var item = _libraryManager.GetItemById(itemId);
foreach (var mediaSource in result.MediaSources)
{
SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, maxAudioChannels, result.PlaySessionId, userId);
SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, maxAudioChannels, result.PlaySessionId, userId, enableDirectPlay, enableDirectStream, enableTranscoding);
}
SortMediaSources(result, maxBitrate);
@ -274,7 +277,10 @@ namespace MediaBrowser.Api.Playback
int? subtitleStreamIndex,
int? maxAudioChannels,
string playSessionId,
string userId)
string userId,
bool enableDirectPlay,
bool enableDirectStream,
bool enableTranscoding)
{
var streamBuilder = new StreamBuilder(_mediaEncoder, Logger);
@ -297,6 +303,19 @@ namespace MediaBrowser.Api.Playback
var user = _userManager.GetUserById(userId);
if (!enableDirectPlay)
{
mediaSource.SupportsDirectPlay = false;
}
if (!enableDirectStream)
{
mediaSource.SupportsDirectStream = false;
}
if (!enableTranscoding)
{
mediaSource.SupportsTranscoding = false;
}
if (mediaSource.SupportsDirectPlay)
{
var supportsDirectStream = mediaSource.SupportsDirectStream;

View File

@ -88,6 +88,8 @@ namespace MediaBrowser.Controller.LiveTv
/// <value><c>true</c> if this instance is post padding required; otherwise, <c>false</c>.</value>
public bool IsPostPaddingRequired { get; set; }
public bool IsManual { get; set; }
/// <summary>
/// Gets or sets the priority.
/// </summary>

View File

@ -23,5 +23,16 @@ namespace MediaBrowser.Model.MediaInfo
public string LiveStreamId { get; set; }
public DeviceProfile DeviceProfile { get; set; }
public bool EnableDirectPlay { get; set; }
public bool EnableDirectStream { get; set; }
public bool EnableTranscoding { get; set; }
public PlaybackInfoRequest()
{
EnableDirectPlay = true;
EnableDirectStream = true;
EnableTranscoding = true;
}
}
}