Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
c8cdc6099a
|
@ -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;
|
||||
|
@ -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",
|
||||
|
|
|
@ -15,14 +15,12 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <summary>
|
||||
/// Class GetArtists
|
||||
/// </summary>
|
||||
[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<BaseItemDto>
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -112,7 +110,8 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
protected override IEnumerable<MusicArtist> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items)
|
||||
{
|
||||
return items
|
||||
.OfType<Audio>()
|
||||
.OfType<IHasArtist>()
|
||||
.Where(i => !(i is MusicAlbum))
|
||||
.SelectMany(i => i.AllArtists)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.Select(name =>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.Audio
|
||||
{
|
||||
public interface IHasAlbumArtist
|
||||
|
@ -9,5 +10,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
public interface IHasArtist
|
||||
{
|
||||
bool HasArtist(string name);
|
||||
|
||||
List<string> AllArtists { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,23 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public List<string> AllArtists
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(AlbumArtist))
|
||||
{
|
||||
list.Add(AlbumArtist);
|
||||
}
|
||||
list.AddRange(Artists);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tags.
|
||||
/// </summary>
|
||||
|
|
|
@ -3,7 +3,9 @@ using MediaBrowser.Controller.Providers;
|
|||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
@ -33,6 +35,23 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <value>The revenue.</value>
|
||||
public double? Revenue { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public List<string> AllArtists
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(Artist))
|
||||
{
|
||||
list.Add(Artist);
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified name has artist.
|
||||
/// </summary>
|
||||
|
|
|
@ -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<string> { _currentItem.MediaType }
|
||||
await _sessionManager.OnPlaybackStart(new PlaybackInfo
|
||||
{
|
||||
Item = _currentItem,
|
||||
SessionId = _session.Id,
|
||||
CanSeek = true,
|
||||
QueueableMediaTypes = new List<string> { _currentItem.MediaType },
|
||||
MediaSourceId = playlistItem.MediaSourceId,
|
||||
AudioStreamIndex = playlistItem.AudioStreamIndex,
|
||||
SubtitleStreamIndex = playlistItem.SubtitleStreamIndex
|
||||
|
||||
}).ConfigureAwait(false);
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
_playbackStarted = true;
|
||||
}
|
||||
_playbackStarted = true;
|
||||
}
|
||||
|
||||
if ((_device.IsPlaying || _device.IsPaused))
|
||||
{
|
||||
var playlistItem = Playlist.FirstOrDefault(p => p.PlayState == 1);
|
||||
|
||||
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<MediaStream> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
{
|
||||
throw new ArgumentNullException("contentType");
|
||||
}
|
||||
|
||||
|
||||
RangeHeader = rangeHeader;
|
||||
SourceStream = source;
|
||||
IsHeadRequest = isHeadRequest;
|
||||
|
@ -98,11 +98,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
|
||||
RangeStart = requestedRange.Key;
|
||||
RangeLength = 1 + RangeEnd - RangeStart;
|
||||
|
||||
|
||||
// Content-Length is the length of what we're serving, not the original content
|
||||
Options["Content-Length"] = RangeLength.ToString(UsCulture);
|
||||
Options["Content-Range"] = string.Format("bytes {0}-{1}/{2}", RangeStart, RangeEnd, TotalContentLength);
|
||||
|
||||
|
||||
if (RangeStart > 0)
|
||||
{
|
||||
SourceStream.Position = RangeStart;
|
||||
|
@ -178,19 +178,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
|
||||
using (var source = SourceStream)
|
||||
{
|
||||
// If the requested range is "0-", we can optimize by just doing a stream copy
|
||||
if (RangeEnd == TotalContentLength - 1)
|
||||
{
|
||||
await source.CopyToAsync(responseStream).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read the bytes we need
|
||||
var buffer = new byte[Convert.ToInt32(RangeLength)];
|
||||
await source.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false);
|
||||
|
||||
await responseStream.WriteAsync(buffer, 0, Convert.ToInt32(RangeLength)).ConfigureAwait(false);
|
||||
}
|
||||
//Since we've already set the postion of the sourcestream, just copy the remains to the output
|
||||
await source.CopyToAsync(responseStream).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user