Merge remote-tracking branch 'upstream/master'

pull/702/head
Tim Hobbs 11 years ago
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,6 +167,10 @@ namespace MediaBrowser.Dlna.PlayTo
if (_currentItem == null || _device.IsStopped)
return;
var playlistItem = Playlist.FirstOrDefault(p => p.PlayState == 1);
if (playlistItem != null)
{
if (!_playbackStarted)
{
await _sessionManager.OnPlaybackStart(new PlaybackInfo
@ -174,7 +178,10 @@ namespace MediaBrowser.Dlna.PlayTo
Item = _currentItem,
SessionId = _session.Id,
CanSeek = true,
QueueableMediaTypes = new List<string> { _currentItem.MediaType }
QueueableMediaTypes = new List<string> { _currentItem.MediaType },
MediaSourceId = playlistItem.MediaSourceId,
AudioStreamIndex = playlistItem.AudioStreamIndex,
SubtitleStreamIndex = playlistItem.SubtitleStreamIndex
}).ConfigureAwait(false);
@ -182,10 +189,6 @@ namespace MediaBrowser.Dlna.PlayTo
}
if ((_device.IsPlaying || _device.IsPaused))
{
var playlistItem = Playlist.FirstOrDefault(p => p.PlayState == 1);
if (playlistItem != null)
{
var ticks = _device.Position.Ticks;

@ -178,20 +178,9 @@ 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)
{
//Since we've already set the postion of the sourcestream, just copy the remains to the output
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);
}
}
}
public string ContentType { get; set; }

Loading…
Cancel
Save