From c62267b1949bf933004beebc67cd12d6b9c76ab4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 9 May 2016 23:36:43 -0400 Subject: [PATCH 1/3] move recording editor to popup --- MediaBrowser.Dlna/Ssdp/SsdpHandler.cs | 2 +- .../Persistence/SqliteItemRepository.cs | 29 +++++++++++++------ .../MediaBrowser.WebDashboard.csproj | 12 ++++---- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs index 3cdeb1afd..0e791eb98 100644 --- a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs +++ b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs @@ -479,7 +479,7 @@ namespace MediaBrowser.Dlna.Ssdp var msg = new SsdpMessageBuilder().BuildMessage(header, values); - SendDatagram(msg, _ssdpEndp, new IPEndPoint(dev.Address, 0), true, 1); + SendDatagram(msg, _ssdpEndp, new IPEndPoint(dev.Address, 0), true, 2); //SendUnicastRequest(msg, 1); } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 6f83e5e06..939781fd1 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -2058,7 +2058,7 @@ namespace MediaBrowser.Server.Implementations.Persistence if (EnableJoinUserData(query)) { - whereClauses.Add("UserId=@UserId"); + whereClauses.Add("(UserId is null or UserId=@UserId)"); } if (query.IsCurrentSchema.HasValue) { @@ -2363,27 +2363,38 @@ namespace MediaBrowser.Server.Implementations.Persistence { if (query.IsFavoriteOrLiked.Value) { - whereClauses.Add("(IsFavorite=@IsFavoriteOrLiked or rating>=@UserRatingIsFavoriteOrLiked)"); - cmd.Parameters.Add(cmd, "@IsFavoriteOrLiked", DbType.Boolean).Value = true; - cmd.Parameters.Add(cmd, "@UserRatingIsFavoriteOrLiked", DbType.Double).Value = UserItemData.MinLikeValue; + whereClauses.Add("IsFavorite=@IsFavoriteOrLiked"); } else { - whereClauses.Add("(IsFavorite=@IsFavoriteOrLiked or rating is null or rating<@UserRatingIsFavoriteOrLiked)"); - cmd.Parameters.Add(cmd, "@IsFavoriteOrLiked", DbType.Boolean).Value = false; - cmd.Parameters.Add(cmd, "@UserRatingIsFavoriteOrLiked", DbType.Double).Value = UserItemData.MinLikeValue; + whereClauses.Add("(IsFavorite is null or IsFavorite=@IsFavoriteOrLiked)"); } + cmd.Parameters.Add(cmd, "@IsFavoriteOrLiked", DbType.Boolean).Value = query.IsFavoriteOrLiked.Value; } if (query.IsFavorite.HasValue) { - whereClauses.Add("IsFavorite=@IsFavorite"); + if (query.IsFavorite.Value) + { + whereClauses.Add("IsFavorite=@IsFavorite"); + } + else + { + whereClauses.Add("(IsFavorite is null or IsFavorite=@IsFavorite)"); + } cmd.Parameters.Add(cmd, "@IsFavorite", DbType.Boolean).Value = query.IsFavorite.Value; } if (query.IsPlayed.HasValue) { - whereClauses.Add("played=@IsPlayed"); + if (query.IsPlayed.Value) + { + whereClauses.Add("(played=@IsPlayed)"); + } + else + { + whereClauses.Add("(played is null or played=@IsPlayed)"); + } cmd.Parameters.Add(cmd, "@IsPlayed", DbType.Boolean).Value = query.IsPlayed.Value; } diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index e8ef8ef58..29c73d0de 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -146,6 +146,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -959,9 +965,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -974,9 +977,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest From 287f797d996c2080c8b9d7c438ad977ec6e5c45f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 10 May 2016 01:00:50 -0400 Subject: [PATCH 2/3] update recording editor --- MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index b5e8ad79a..ac8c99ace 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1154,7 +1154,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV IncludeItemTypes = new[] { typeof(Episode).Name }, ParentIndexNumber = program.SeasonNumber.Value, IndexNumber = program.EpisodeNumber.Value, - AncestorIds = seriesIds + AncestorIds = seriesIds, + ExcludeLocationTypes = new[] { LocationType.Virtual } }); if (result.TotalRecordCount > 0) @@ -1169,7 +1170,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { IncludeItemTypes = new[] { typeof(Episode).Name }, Name = program.EpisodeTitle, - AncestorIds = seriesIds + AncestorIds = seriesIds, + ExcludeLocationTypes = new[] { LocationType.Virtual } }); if (result.TotalRecordCount > 0) From 9edda5782b6c6221e1b1def4e209b08c2f94ad9c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 10 May 2016 01:15:06 -0400 Subject: [PATCH 3/3] update recording path --- .../LiveTv/EmbyTV/DirectRecorder.cs | 5 +++++ .../LiveTv/EmbyTV/EmbyTV.cs | 5 +---- .../LiveTv/EmbyTV/EncodedRecorder.cs | 10 ++++++++++ .../LiveTv/EmbyTV/IRecorder.cs | 2 ++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs index 54443d9ca..b21aa904b 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs @@ -23,6 +23,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV _fileSystem = fileSystem; } + public string GetOutputPath(MediaSourceInfo mediaSource, string targetFile) + { + return targetFile; + } + public async Task Record(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken) { var httpRequestOptions = new HttpRequestOptions() diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index ac8c99ace..2de51479f 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -898,10 +898,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV var recorder = await GetRecorder().ConfigureAwait(false); - if (recorder is EncodedRecorder) - { - recordPath = Path.ChangeExtension(recordPath, ".mp4"); - } + recordPath = recorder.GetOutputPath(mediaStreamInfo, recordPath); recordPath = EnsureFileUnique(recordPath, timer.Id); _fileSystem.CreateDirectory(Path.GetDirectoryName(recordPath)); activeRecordingInfo.Path = recordPath; diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index dec8ba83d..85b6ead07 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -42,6 +42,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV _liveTvOptions = liveTvOptions; } + public string GetOutputPath(MediaSourceInfo mediaSource, string targetFile) + { + if (_liveTvOptions.EnableOriginalAudioWithEncodedRecordings) + { + return Path.ChangeExtension(targetFile, ".mkv"); + } + + return Path.ChangeExtension(targetFile, ".mp4"); + } + public async Task Record(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken) { if (mediaSource.RunTimeTicks.HasValue) diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs index 268a4f751..5706b6ae9 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/IRecorder.cs @@ -17,5 +17,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV /// The cancellation token. /// Task. Task Record(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken); + + string GetOutputPath(MediaSourceInfo mediaSource, string targetFile); } }