From 7601f6660e90aae5a3f23e63793b0ef21344be27 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 22 Jun 2016 00:39:06 -0400 Subject: [PATCH 1/3] add music artist channel folder type --- MediaBrowser.Model/Channels/ChannelFolderType.cs | 4 +++- .../Channels/ChannelManager.cs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Model/Channels/ChannelFolderType.cs b/MediaBrowser.Model/Channels/ChannelFolderType.cs index 9261cb5cd3..c456af69a7 100644 --- a/MediaBrowser.Model/Channels/ChannelFolderType.cs +++ b/MediaBrowser.Model/Channels/ChannelFolderType.cs @@ -6,6 +6,8 @@ namespace MediaBrowser.Model.Channels MusicAlbum = 1, - PhotoAlbum = 2 + PhotoAlbum = 2, + + MusicArtist = 3 } } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index faca936d37..aac5ddcaf7 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -1250,6 +1250,10 @@ namespace MediaBrowser.Server.Implementations.Channels { item = GetItemById(info.Id, channelProvider.Name, channelProvider.DataVersion, out isNew); } + else if (info.FolderType == ChannelFolderType.MusicArtist) + { + item = GetItemById(info.Id, channelProvider.Name, channelProvider.DataVersion, out isNew); + } else if (info.FolderType == ChannelFolderType.PhotoAlbum) { item = GetItemById(info.Id, channelProvider.Name, channelProvider.DataVersion, out isNew); From dfb99b45cdd6d1d71b7d87c4807809b79467782c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 22 Jun 2016 00:39:59 -0400 Subject: [PATCH 2/3] update nav drawer --- MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 740f36ae09..bc5db02241 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -152,6 +152,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest From b0ed7ef0a3b78483291a742b5c333fce802e3f80 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 22 Jun 2016 00:40:11 -0400 Subject: [PATCH 3/3] update recording conversion process --- .../LiveTv/EmbyTV/EncodedRecorder.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 6704dc1396..cad300fac3 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -108,17 +108,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV // Give the temp file a little time to build up await Task.Delay(bufferMs, cancellationToken).ConfigureAwait(false); - await RecordFromFile(mediaSource, tempFile, targetFile, onStarted, cancellationToken) - .ConfigureAwait(false); + var recordTask = Task.Run(() => RecordFromFile(mediaSource, tempFile, targetFile, duration, onStarted, cancellationToken), cancellationToken); await tempFileTask.ConfigureAwait(false); + + await recordTask.ConfigureAwait(false); } } _logger.Info("Recording completed to file {0}", targetFile); } - private async Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, Action onStarted, CancellationToken cancellationToken) + private Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken) { _targetPath = targetFile; _fileSystem.CreateDirectory(Path.GetDirectoryName(targetFile)); @@ -136,7 +137,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV RedirectStandardInput = true, FileName = _mediaEncoder.EncoderPath, - Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile), + Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile, duration), WindowStyle = ProcessWindowStyle.Hidden, ErrorDialog = false @@ -157,7 +158,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV _logFileStream = _fileSystem.GetFileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, true); var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(_json.SerializeToString(mediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine); - await _logFileStream.WriteAsync(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length, cancellationToken).ConfigureAwait(false); + _logFileStream.Write(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length); process.Exited += (sender, args) => OnFfMpegProcessExited(process); @@ -173,10 +174,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV // Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback StartStreamingLog(process.StandardError.BaseStream, _logFileStream); - await _taskCompletionSource.Task.ConfigureAwait(false); + return _taskCompletionSource.Task; } - private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile) + private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile, TimeSpan duration) { string videoArgs; if (EncodeVideo(mediaSource)) @@ -192,14 +193,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV videoArgs = "-codec:v:0 copy"; } - var commandLineArgs = "-fflags +genpts -async 1 -vsync -1 -re -i \"{0}\" -sn {2} -map_metadata -1 -threads 0 {3} -y \"{1}\""; + var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks); + var commandLineArgs = "-fflags +genpts -async 1 -vsync -1 -re -i \"{0}\"{4} -sn {2} -map_metadata -1 -threads 0 {3} -y \"{1}\""; if (mediaSource.ReadAtNativeFramerate) { commandLineArgs = "-re " + commandLineArgs; } - commandLineArgs = string.Format(commandLineArgs, inputTempFile, targetFile, videoArgs, GetAudioArgs(mediaSource)); + commandLineArgs = string.Format(commandLineArgs, inputTempFile, targetFile, videoArgs, GetAudioArgs(mediaSource), durationParam); return commandLineArgs; }