From 871a3cb52c987188f6d65b8944d29b7c7ba403f8 Mon Sep 17 00:00:00 2001 From: 7illusions Date: Sun, 6 Apr 2014 20:34:47 +0200 Subject: [PATCH 1/5] PlayTo Progressreporting --- MediaBrowser.Dlna/PlayTo/DlnaController.cs | 37 ++++++++++++---------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/MediaBrowser.Dlna/PlayTo/DlnaController.cs b/MediaBrowser.Dlna/PlayTo/DlnaController.cs index b1c85889d1..6edb9d6f6e 100644 --- a/MediaBrowser.Dlna/PlayTo/DlnaController.cs +++ b/MediaBrowser.Dlna/PlayTo/DlnaController.cs @@ -167,25 +167,28 @@ namespace MediaBrowser.Dlna.PlayTo if (_currentItem == null || _device.IsStopped) return; - if (!_playbackStarted) + var playlistItem = Playlist.FirstOrDefault(p => p.PlayState == 1); + + if (playlistItem != null) { - await _sessionManager.OnPlaybackStart(new PlaybackInfo + if (!_playbackStarted) { - Item = _currentItem, - SessionId = _session.Id, - CanSeek = true, - QueueableMediaTypes = new List { _currentItem.MediaType } - - }).ConfigureAwait(false); + await _sessionManager.OnPlaybackStart(new PlaybackInfo + { + Item = _currentItem, + SessionId = _session.Id, + CanSeek = true, + QueueableMediaTypes = new List { _currentItem.MediaType }, + MediaSourceId = playlistItem.MediaSourceId, + AudioStreamIndex = playlistItem.AudioStreamIndex, + SubtitleStreamIndex = playlistItem.SubtitleStreamIndex - _playbackStarted = true; - } + }).ConfigureAwait(false); - if ((_device.IsPlaying || _device.IsPaused)) - { - var playlistItem = Playlist.FirstOrDefault(p => p.PlayState == 1); + _playbackStarted = true; + } - if (playlistItem != null) + if ((_device.IsPlaying || _device.IsPaused)) { var ticks = _device.Position.Ticks; @@ -487,7 +490,7 @@ namespace MediaBrowser.Dlna.PlayTo return (contentFeatures + orgOp + orgCi + dlnaflags).Trim(';'); } - + private PlaylistItem GetPlaylistItem(BaseItem item, List mediaStreams, DeviceProfile profile) { var video = item as Video; @@ -563,10 +566,10 @@ namespace MediaBrowser.Dlna.PlayTo _logger.Debug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", _device.Properties.Name, nextTrack.StreamUrl, dlnaheaders); await _device.SetAvTransport(nextTrack.StreamUrl, dlnaheaders, nextTrack.Didl); - + if (nextTrack.StartPositionTicks > 0 && !nextTrack.Transcode) await _device.Seek(TimeSpan.FromTicks(nextTrack.StartPositionTicks)); - + return true; } From e221bd5c9e733a8749b477d827323e99c713099f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 6 Apr 2014 14:48:50 -0400 Subject: [PATCH 2/5] remove dlna conditionals --- MediaBrowser.Api/Playback/BaseStreamingService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index f57927f879..fe45cd39e3 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1749,11 +1749,11 @@ namespace MediaBrowser.Api.Playback if (isStaticallyStreamed) { - flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_BYTE_BASED_SEEK; + //flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_BYTE_BASED_SEEK; } else if (state.RunTimeTicks.HasValue) { - flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_TIME_BASED_SEEK; + //flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_TIME_BASED_SEEK; } var dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}000000000000000000000000", From 56c0d491f4c05a2c0c4f21c20e3530c039b33148 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 6 Apr 2014 22:10:38 -0400 Subject: [PATCH 3/5] fixes #769 - Artists pages don't include music videos --- .../Playback/BaseStreamingService.cs | 6 +++--- .../UserLibrary/ArtistsService.cs | 8 +++----- .../Entities/Audio/IHasAlbumArtist.cs | 5 ++++- .../Entities/MusicVideo.cs | 19 +++++++++++++++++++ 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index fe45cd39e3..612f731918 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1368,7 +1368,7 @@ namespace MediaBrowser.Api.Playback mediaUrl = streamInfo.Url; } - if (!string.IsNullOrEmpty(path) && File.Exists(path)) + if (!string.IsNullOrEmpty(path)) { state.MediaPath = path; state.IsRemote = false; @@ -1381,7 +1381,7 @@ namespace MediaBrowser.Api.Playback state.RunTimeTicks = recording.RunTimeTicks; - if (recording.RecordingInfo.Status == RecordingStatus.InProgress && !state.IsRemote) + if (recording.RecordingInfo.Status == RecordingStatus.InProgress) { await Task.Delay(1000, cancellationToken).ConfigureAwait(false); } @@ -1404,7 +1404,7 @@ namespace MediaBrowser.Api.Playback state.LiveTvStreamId = streamInfo.Id; - if (!string.IsNullOrEmpty(streamInfo.Path) && File.Exists(streamInfo.Path)) + if (!string.IsNullOrEmpty(streamInfo.Path)) { state.MediaPath = streamInfo.Path; state.IsRemote = false; diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs index 9972ac3eff..5ca0d75ac9 100644 --- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs +++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs @@ -15,14 +15,12 @@ namespace MediaBrowser.Api.UserLibrary /// /// Class GetArtists /// - [Route("/Artists", "GET")] - [Api(Description = "Gets all artists from a given item, folder, or the entire library")] + [Route("/Artists", "GET", Summary = "Gets all artists from a given item, folder, or the entire library")] public class GetArtists : GetItemsByName { } - [Route("/Artists/{Name}", "GET")] - [Api(Description = "Gets an artist, by name")] + [Route("/Artists/{Name}", "GET", Summary = "Gets an artist, by name")] public class GetArtist : IReturn { /// @@ -112,7 +110,7 @@ namespace MediaBrowser.Api.UserLibrary protected override IEnumerable GetAllItems(GetItemsByName request, IEnumerable items) { return items - .OfType