fixes #712 - multi-version grouping

This commit is contained in:
Luke Pulverenti 2014-03-20 23:31:40 -04:00
parent 0d518ebf17
commit 74d1ffd676
18 changed files with 160 additions and 223 deletions

View File

@ -6,8 +6,7 @@ using System.Threading.Tasks;
namespace MediaBrowser.Api.Movies namespace MediaBrowser.Api.Movies
{ {
[Route("/Collections", "POST")] [Route("/Collections", "POST", Summary = "Creates a new collection")]
[Api(Description = "Creates a new collection")]
public class CreateCollection : IReturnVoid public class CreateCollection : IReturnVoid
{ {
[ApiMember(Name = "IsLocked", Description = "Whether or not to lock the new collection.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "IsLocked", Description = "Whether or not to lock the new collection.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "POST")]
@ -20,8 +19,7 @@ namespace MediaBrowser.Api.Movies
public Guid? ParentId { get; set; } public Guid? ParentId { get; set; }
} }
[Route("/Collections/{Id}/Items", "POST")] [Route("/Collections/{Id}/Items", "POST", Summary = "Adds items to a collection")]
[Api(Description = "Adds items to a collection")]
public class AddToCollection : IReturnVoid public class AddToCollection : IReturnVoid
{ {
[ApiMember(Name = "Ids", Description = "Item id, comma delimited", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "Ids", Description = "Item id, comma delimited", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
@ -31,8 +29,7 @@ namespace MediaBrowser.Api.Movies
public Guid Id { get; set; } public Guid Id { get; set; }
} }
[Route("/Collections/{Id}/Items", "DELETE")] [Route("/Collections/{Id}/Items", "DELETE", Summary = "Removes items from a collection")]
[Api(Description = "Removes items from a collection")]
public class RemoveFromCollection : IReturnVoid public class RemoveFromCollection : IReturnVoid
{ {
[ApiMember(Name = "Ids", Description = "Item id, comma delimited", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "Ids", Description = "Item id, comma delimited", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]

View File

@ -210,6 +210,9 @@ namespace MediaBrowser.Api
[ApiMember(Name = "PlayableMediaTypes", Description = "A list of playable media types, comma delimited. Audio, Video, Book, Game, Photo.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "PlayableMediaTypes", Description = "A list of playable media types, comma delimited. Audio, Video, Book, Game, Photo.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string PlayableMediaTypes { get; set; } public string PlayableMediaTypes { get; set; }
[ApiMember(Name = "SupportsFullscreenToggle", Description = "Whether or not the session supports fullscreen toggle", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "POST")]
public bool SupportsFullscreenToggle { get; set; }
} }
/// <summary> /// <summary>
@ -361,11 +364,12 @@ namespace MediaBrowser.Api
public void Post(PostCapabilities request) public void Post(PostCapabilities request)
{ {
var session = _sessionManager.Sessions.First(i => i.Id == request.Id); _sessionManager.ReportCapabilities(request.Id, new SessionCapabilities
{
PlayableMediaTypes = request.PlayableMediaTypes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries),
session.PlayableMediaTypes = request.PlayableMediaTypes SupportsFullscreenToggle = request.SupportsFullscreenToggle
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) });
.ToList();
} }
private SessionInfo GetSession() private SessionInfo GetSession()

View File

@ -4,12 +4,9 @@ using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using ServiceStack; using ServiceStack;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -31,18 +28,6 @@ namespace MediaBrowser.Api
public string Id { get; set; } public string Id { get; set; }
} }
[Route("/Videos/{Id}/Versions", "GET")]
[Api(Description = "Gets all versions of a video.")]
public class GetMediaVersions : IReturn<List<MediaVersionInfo>>
{
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
}
[Route("/Videos/{Id}/AlternateVersions", "DELETE")] [Route("/Videos/{Id}/AlternateVersions", "DELETE")]
[Api(Description = "Assigns videos as alternates of antoher.")] [Api(Description = "Assigns videos as alternates of antoher.")]
public class DeleteAlternateVersions : IReturnVoid public class DeleteAlternateVersions : IReturnVoid
@ -113,169 +98,6 @@ namespace MediaBrowser.Api
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
public object Get(GetMediaVersions request)
{
var item = _libraryManager.GetItemById(new Guid(request.Id));
var video = (Video)item;
var result = video.GetAlternateVersions().Select(GetVersionInfo).ToList();
result.Add(GetVersionInfo(video));
result = result.OrderBy(i =>
{
if (video.VideoType == VideoType.VideoFile)
{
return 0;
}
return 1;
}).ThenBy(i => i.Video3DFormat.HasValue ? 1 : 0)
.ThenByDescending(i =>
{
var stream = i.MediaStreams.FirstOrDefault(m => m.Type == MediaStreamType.Video);
return stream == null || stream.Width == null ? 0 : stream.Width.Value;
})
.ToList();
return ToOptimizedSerializedResultUsingCache(result);
}
private MediaVersionInfo GetVersionInfo(Video i)
{
return new MediaVersionInfo
{
Chapters = _itemRepo.GetChapters(i.Id).Select(c => _dtoService.GetChapterInfoDto(c, i)).ToList(),
Id = i.Id.ToString("N"),
IsoType = i.IsoType,
LocationType = i.LocationType,
MediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery {ItemId = i.Id}).ToList(),
Name = GetAlternateVersionName(i),
Path = GetMappedPath(i),
RunTimeTicks = i.RunTimeTicks,
Video3DFormat = i.Video3DFormat,
VideoType = i.VideoType
};
}
private string GetMappedPath(Video video)
{
var path = video.Path;
var locationType = video.LocationType;
if (locationType != LocationType.FileSystem && locationType != LocationType.Offline)
{
return path;
}
foreach (var map in _config.Configuration.PathSubstitutions)
{
path = _fileSystem.SubstitutePath(path, map.From, map.To);
}
return path;
}
private string GetAlternateVersionName(Video video)
{
var name = "";
var stream = video.GetDefaultVideoStream();
if (video.Video3DFormat.HasValue)
{
name = "3D " + name;
name = name.Trim();
}
if (video.VideoType == VideoType.BluRay)
{
name = name + " " + "Bluray";
name = name.Trim();
}
else if (video.VideoType == VideoType.Dvd)
{
name = name + " " + "DVD";
name = name.Trim();
}
else if (video.VideoType == VideoType.HdDvd)
{
name = name + " " + "HD-DVD";
name = name.Trim();
}
else if (video.VideoType == VideoType.Iso)
{
if (video.IsoType.HasValue)
{
if (video.IsoType.Value == IsoType.BluRay)
{
name = name + " " + "Bluray";
}
else if (video.IsoType.Value == IsoType.Dvd)
{
name = name + " " + "DVD";
}
}
else
{
name = name + " " + "ISO";
}
name = name.Trim();
}
else if (video.VideoType == VideoType.VideoFile)
{
if (stream != null)
{
if (stream.Width.HasValue)
{
if (stream.Width.Value >= 3800)
{
name = name + " " + "4K";
name = name.Trim();
}
else if (stream.Width.Value >= 1900)
{
name = name + " " + "1080P";
name = name.Trim();
}
else if (stream.Width.Value >= 1270)
{
name = name + " " + "720P";
name = name.Trim();
}
else if (stream.Width.Value >= 700)
{
name = name + " " + "480p";
name = name.Trim();
}
else
{
name = name + " " + "SD";
name = name.Trim();
}
}
}
}
if (stream != null && !string.IsNullOrWhiteSpace(stream.Codec))
{
name = name + " " + stream.Codec.ToUpper();
name = name.Trim();
}
if (string.IsNullOrWhiteSpace(name))
{
return video.Name;
}
return name;
}
public void Delete(DeleteAlternateVersions request) public void Delete(DeleteAlternateVersions request)
{ {
var task = RemoveAlternateVersions(request); var task = RemoveAlternateVersions(request);

View File

@ -90,7 +90,9 @@ namespace MediaBrowser.Controller.Entities
if (!string.IsNullOrWhiteSpace(key)) if (!string.IsNullOrWhiteSpace(key))
{ {
return key + "-trailer"; key = key + "-trailer";
return key;
} }
return base.GetUserDataKey(); return base.GetUserDataKey();

View File

@ -180,5 +180,12 @@ namespace MediaBrowser.Controller.Session
/// <param name="remoteEndPoint">The remote end point.</param> /// <param name="remoteEndPoint">The remote end point.</param>
/// <returns>Task{SessionInfo}.</returns> /// <returns>Task{SessionInfo}.</returns>
Task<SessionInfo> AuthenticateNewSession(User user, string password, string clientType, string appVersion, string deviceId, string deviceName, string remoteEndPoint); Task<SessionInfo> AuthenticateNewSession(User user, string password, string clientType, string appVersion, string deviceId, string deviceName, string remoteEndPoint);
/// <summary>
/// Reports the capabilities.
/// </summary>
/// <param name="sessionId">The session identifier.</param>
/// <param name="capabilities">The capabilities.</param>
void ReportCapabilities(Guid sessionId, SessionCapabilities capabilities);
} }
} }

View File

@ -155,6 +155,12 @@ namespace MediaBrowser.Controller.Session
/// <value>The session controller.</value> /// <value>The session controller.</value>
public ISessionController SessionController { get; set; } public ISessionController SessionController { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports fullscreen toggle].
/// </summary>
/// <value><c>true</c> if [supports fullscreen toggle]; otherwise, <c>false</c>.</value>
public bool SupportsFullscreenToggle { get; set; }
/// <summary> /// <summary>
/// Gets a value indicating whether this instance is active. /// Gets a value indicating whether this instance is active.
/// </summary> /// </summary>

View File

@ -13,7 +13,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Timers;
namespace MediaBrowser.Dlna.PlayTo namespace MediaBrowser.Dlna.PlayTo
{ {
@ -32,7 +31,7 @@ namespace MediaBrowser.Dlna.PlayTo
private readonly IServerApplicationHost _appHost; private readonly IServerApplicationHost _appHost;
private bool _playbackStarted = false; private bool _playbackStarted = false;
private int UpdateTimerIntervalMs = 1000; private const int UpdateTimerIntervalMs = 1000;
public bool SupportsMediaRemoteControl public bool SupportsMediaRemoteControl
{ {

View File

@ -5,6 +5,7 @@ using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Session; using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
@ -15,6 +16,7 @@ using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Dlna.PlayTo namespace MediaBrowser.Dlna.PlayTo
{ {
@ -226,6 +228,12 @@ namespace MediaBrowser.Dlna.PlayTo
var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, device.Properties.Name, device.Properties.UUID, device.Properties.DisplayName, uri.OriginalString, null) var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, device.Properties.Name, device.Properties.UUID, device.Properties.DisplayName, uri.OriginalString, null)
.ConfigureAwait(false); .ConfigureAwait(false);
_sessionManager.ReportCapabilities(sessionInfo.Id, new SessionCapabilities
{
PlayableMediaTypes = new[] { MediaType.Audio, MediaType.Video, MediaType.Photo },
SupportsFullscreenToggle = false
});
var controller = sessionInfo.SessionController as PlayToController; var controller = sessionInfo.SessionController as PlayToController;
if (controller == null) if (controller == null)

View File

@ -434,6 +434,9 @@
<Compile Include="..\MediaBrowser.Model\Session\PlaystateCommand.cs"> <Compile Include="..\MediaBrowser.Model\Session\PlaystateCommand.cs">
<Link>Session\PlaystateCommand.cs</Link> <Link>Session\PlaystateCommand.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Session\SessionCapabilities.cs">
<Link>Session\SessionCapabilities.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Session\SessionInfoDto.cs"> <Compile Include="..\MediaBrowser.Model\Session\SessionInfoDto.cs">
<Link>Session\SessionInfoDto.cs</Link> <Link>Session\SessionInfoDto.cs</Link>
</Compile> </Compile>

View File

@ -421,6 +421,9 @@
<Compile Include="..\MediaBrowser.Model\Session\PlaystateCommand.cs"> <Compile Include="..\MediaBrowser.Model\Session\PlaystateCommand.cs">
<Link>Session\PlaystateCommand.cs</Link> <Link>Session\PlaystateCommand.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Session\SessionCapabilities.cs">
<Link>Session\SessionCapabilities.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Session\SessionInfoDto.cs"> <Compile Include="..\MediaBrowser.Model\Session\SessionInfoDto.cs">
<Link>Session\SessionInfoDto.cs</Link> <Link>Session\SessionInfoDto.cs</Link>
</Compile> </Compile>

View File

@ -500,7 +500,7 @@ namespace MediaBrowser.Model.Dto
/// </summary> /// </summary>
/// <value>The part count.</value> /// <value>The part count.</value>
public int? PartCount { get; set; } public int? PartCount { get; set; }
public int? AlternateVersionCount { get; set; } public int? MediaVersionCount { get; set; }
/// <summary> /// <summary>
/// Determines whether the specified type is type. /// Determines whether the specified type is type.

View File

@ -5,7 +5,7 @@ namespace MediaBrowser.Model.Dto
{ {
public class MediaVersionInfo public class MediaVersionInfo
{ {
public string Id { get; set; } public string ItemId { get; set; }
public string Path { get; set; } public string Path { get; set; }
@ -24,5 +24,7 @@ namespace MediaBrowser.Model.Dto
public List<MediaStream> MediaStreams { get; set; } public List<MediaStream> MediaStreams { get; set; }
public List<ChapterInfoDto> Chapters { get; set; } public List<ChapterInfoDto> Chapters { get; set; }
public bool IsPrimaryVersion { get; set; }
} }
} }

View File

@ -166,6 +166,7 @@
<Compile Include="Search\SearchHintResult.cs" /> <Compile Include="Search\SearchHintResult.cs" />
<Compile Include="Serialization\IJsonSerializer.cs" /> <Compile Include="Serialization\IJsonSerializer.cs" />
<Compile Include="Serialization\IXmlSerializer.cs" /> <Compile Include="Serialization\IXmlSerializer.cs" />
<Compile Include="Session\SessionCapabilities.cs" />
<Compile Include="Session\SessionInfoDto.cs" /> <Compile Include="Session\SessionInfoDto.cs" />
<Compile Include="Session\SystemCommand.cs" /> <Compile Include="Session\SystemCommand.cs" />
<Compile Include="Session\UserDataChangeInfo.cs" /> <Compile Include="Session\UserDataChangeInfo.cs" />

View File

@ -32,12 +32,4 @@ namespace MediaBrowser.Model.Session
/// <value>The context.</value> /// <value>The context.</value>
public string Context { get; set; } public string Context { get; set; }
} }
public class ItemContext
{
public const string Music = "Music";
public const string Movies = "Movies";
public const string TvShows = "TvShows";
public const string Games = "Games";
}
} }

View File

@ -0,0 +1,15 @@

namespace MediaBrowser.Model.Session
{
public class SessionCapabilities
{
public string[] PlayableMediaTypes { get; set; }
public bool SupportsFullscreenToggle { get; set; }
public SessionCapabilities()
{
PlayableMediaTypes = new string[] {};
}
}
}

View File

@ -135,6 +135,12 @@ namespace MediaBrowser.Model.Session
/// <value>The device id.</value> /// <value>The device id.</value>
public string DeviceId { get; set; } public string DeviceId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports fullscreen toggle].
/// </summary>
/// <value><c>true</c> if [supports fullscreen toggle]; otherwise, <c>false</c>.</value>
public bool SupportsFullscreenToggle { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether [supports remote control]. /// Gets or sets a value indicating whether [supports remote control].
/// </summary> /// </summary>

View File

@ -266,7 +266,8 @@ namespace MediaBrowser.Server.Implementations.Dto
QueueableMediaTypes = session.QueueableMediaTypes, QueueableMediaTypes = session.QueueableMediaTypes,
PlayableMediaTypes = session.PlayableMediaTypes, PlayableMediaTypes = session.PlayableMediaTypes,
RemoteEndPoint = session.RemoteEndPoint, RemoteEndPoint = session.RemoteEndPoint,
AdditionalUsers = session.AdditionalUsers AdditionalUsers = session.AdditionalUsers,
SupportsFullscreenToggle = session.SupportsFullscreenToggle
}; };
if (session.NowPlayingItem != null) if (session.NowPlayingItem != null)
@ -1052,6 +1053,9 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.AlbumPrimaryImageTag = GetImageCacheTag(albumParent, ImageType.Primary); dto.AlbumPrimaryImageTag = GetImageCacheTag(albumParent, ImageType.Primary);
} }
dto.MediaVersions = GetMediaVersions(audio);
dto.MediaVersionCount = 1;
} }
var album = item as MusicAlbum; var album = item as MusicAlbum;
@ -1082,16 +1086,31 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.IsHD = video.IsHD; dto.IsHD = video.IsHD;
dto.PartCount = video.AdditionalPartIds.Count + 1; dto.PartCount = video.AdditionalPartIds.Count + 1;
dto.AlternateVersionCount = video.AlternateVersionCount; dto.MediaVersionCount = video.AlternateVersionCount + 1;
if (fields.Contains(ItemFields.Chapters))
{
dto.Chapters = _itemRepo.GetChapters(video.Id).Select(c => GetChapterInfoDto(c, item)).ToList();
}
if (fields.Contains(ItemFields.MediaVersions)) if (fields.Contains(ItemFields.MediaVersions))
{ {
//dto.MediaVersions = GetMediaVersions(video); dto.MediaVersions = GetMediaVersions(video);
}
if (fields.Contains(ItemFields.Chapters))
{
List<ChapterInfoDto> chapters;
if (dto.MediaVersions != null && dto.MediaVersions.Count > 0)
{
chapters = dto.MediaVersions.Where(i => i.IsPrimaryVersion)
.SelectMany(i => i.Chapters)
.ToList();
}
else
{
chapters = _itemRepo.GetChapters(video.Id)
.Select(c => GetChapterInfoDto(c, item))
.ToList();
}
dto.Chapters = chapters;
} }
} }
@ -1102,11 +1121,24 @@ namespace MediaBrowser.Server.Implementations.Dto
if (iHasMediaStreams != null) if (iHasMediaStreams != null)
{ {
dto.MediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery List<MediaStream> mediaStreams;
{
ItemId = item.Id
}).ToList(); if (dto.MediaVersions != null && dto.MediaVersions.Count > 0)
{
mediaStreams = dto.MediaVersions.Where(i => i.IsPrimaryVersion)
.SelectMany(i => i.MediaStreams)
.ToList();
}
else
{
mediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery
{
ItemId = item.Id
}).ToList();
}
dto.MediaStreams = mediaStreams;
} }
} }
@ -1228,15 +1260,15 @@ namespace MediaBrowser.Server.Implementations.Dto
} }
} }
private List<MediaVersionInfo> GetMediaVersions(Video video) private List<MediaVersionInfo> GetMediaVersions(Video item)
{ {
var result = video.GetAlternateVersions().Select(GetVersionInfo).ToList(); var result = item.GetAlternateVersions().Select(i => GetVersionInfo(i, false)).ToList();
result.Add(GetVersionInfo(video)); result.Add(GetVersionInfo(item, true));
return result.OrderBy(i => return result.OrderBy(i =>
{ {
if (video.VideoType == VideoType.VideoFile) if (item.VideoType == VideoType.VideoFile)
{ {
return 0; return 0;
} }
@ -1250,16 +1282,26 @@ namespace MediaBrowser.Server.Implementations.Dto
return stream == null || stream.Width == null ? 0 : stream.Width.Value; return stream == null || stream.Width == null ? 0 : stream.Width.Value;
}) })
.ThenBy(i => i.IsPrimaryVersion ? 0 : 1)
.ToList(); .ToList();
} }
private MediaVersionInfo GetVersionInfo(Video i) private List<MediaVersionInfo> GetMediaVersions(Audio item)
{
var result = new List<MediaVersionInfo>();
result.Add(GetVersionInfo(item, true));
return result;
}
private MediaVersionInfo GetVersionInfo(Video i, bool isPrimary)
{ {
return new MediaVersionInfo return new MediaVersionInfo
{ {
Chapters = _itemRepo.GetChapters(i.Id).Select(c => GetChapterInfoDto(c, i)).ToList(), Chapters = _itemRepo.GetChapters(i.Id).Select(c => GetChapterInfoDto(c, i)).ToList(),
Id = i.Id.ToString("N"), ItemId = i.Id.ToString("N"),
IsoType = i.IsoType, IsoType = i.IsoType,
LocationType = i.LocationType, LocationType = i.LocationType,
MediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id }).ToList(), MediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id }).ToList(),
@ -1267,15 +1309,30 @@ namespace MediaBrowser.Server.Implementations.Dto
Path = GetMappedPath(i), Path = GetMappedPath(i),
RunTimeTicks = i.RunTimeTicks, RunTimeTicks = i.RunTimeTicks,
Video3DFormat = i.Video3DFormat, Video3DFormat = i.Video3DFormat,
VideoType = i.VideoType VideoType = i.VideoType,
IsPrimaryVersion = isPrimary
}; };
} }
private string GetMappedPath(Video video) private MediaVersionInfo GetVersionInfo(Audio i, bool isPrimary)
{ {
var path = video.Path; return new MediaVersionInfo
{
ItemId = i.Id.ToString("N"),
LocationType = i.LocationType,
MediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id }).ToList(),
Name = i.Name,
Path = GetMappedPath(i),
RunTimeTicks = i.RunTimeTicks,
IsPrimaryVersion = isPrimary
};
}
var locationType = video.LocationType; private string GetMappedPath(IHasMetadata item)
{
var path = item.Path;
var locationType = item.LocationType;
if (locationType != LocationType.FileSystem && locationType != LocationType.Offline) if (locationType != LocationType.FileSystem && locationType != LocationType.Offline)
{ {

View File

@ -887,5 +887,18 @@ namespace MediaBrowser.Server.Implementations.Session
return await LogSessionActivity(clientType, appVersion, deviceId, deviceName, remoteEndPoint, user).ConfigureAwait(false); return await LogSessionActivity(clientType, appVersion, deviceId, deviceName, remoteEndPoint, user).ConfigureAwait(false);
} }
/// <summary>
/// Reports the capabilities.
/// </summary>
/// <param name="sessionId">The session identifier.</param>
/// <param name="capabilities">The capabilities.</param>
public void ReportCapabilities(Guid sessionId, SessionCapabilities capabilities)
{
var session = GetSession(sessionId);
session.PlayableMediaTypes = capabilities.PlayableMediaTypes.ToList();
session.SupportsFullscreenToggle = capabilities.SupportsFullscreenToggle;
}
} }
} }