mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-01 04:34:26 -04:00
rework media source methods
This commit is contained in:
parent
ddbbe9ce4e
commit
b9f3944b7f
@ -63,15 +63,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <param name="enablePathSubstitution">if set to <c>true</c> [enable path substitution].</param>
|
/// <param name="enablePathSubstitution">if set to <c>true</c> [enable path substitution].</param>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>IEnumerable<MediaSourceInfo>.</returns>
|
/// <returns>IEnumerable<MediaSourceInfo>.</returns>
|
||||||
IEnumerable<MediaSourceInfo> GetStaticMediaSources(IHasMediaSources item, bool enablePathSubstitution, User user);
|
IEnumerable<MediaSourceInfo> GetStaticMediaSources(IHasMediaSources item, bool enablePathSubstitution, User user = null);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the static media sources.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="enablePathSubstitution">if set to <c>true</c> [enable path substitution].</param>
|
|
||||||
/// <returns>IEnumerable<MediaSourceInfo>.</returns>
|
|
||||||
IEnumerable<MediaSourceInfo> GetStaticMediaSources(IHasMediaSources item, bool enablePathSubstitution);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the static media source.
|
/// Gets the static media source.
|
||||||
|
@ -124,7 +124,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||||||
{
|
{
|
||||||
if (streamInfo == null)
|
if (streamInfo == null)
|
||||||
{
|
{
|
||||||
var sources = _user == null ? _mediaSourceManager.GetStaticMediaSources(video, true).ToList() : _mediaSourceManager.GetStaticMediaSources(video, true, _user).ToList();
|
var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user).ToList();
|
||||||
|
|
||||||
streamInfo = new StreamBuilder().BuildVideoItem(new VideoOptions
|
streamInfo = new StreamBuilder().BuildVideoItem(new VideoOptions
|
||||||
{
|
{
|
||||||
@ -351,7 +351,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||||||
|
|
||||||
if (streamInfo == null)
|
if (streamInfo == null)
|
||||||
{
|
{
|
||||||
var sources = _user == null ? _mediaSourceManager.GetStaticMediaSources(audio, true).ToList() : _mediaSourceManager.GetStaticMediaSources(audio, true, _user).ToList();
|
var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user).ToList();
|
||||||
|
|
||||||
streamInfo = new StreamBuilder().BuildAudioItem(new AudioOptions
|
streamInfo = new StreamBuilder().BuildAudioItem(new AudioOptions
|
||||||
{
|
{
|
||||||
|
@ -470,7 +470,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
|
|
||||||
var hasMediaSources = item as IHasMediaSources;
|
var hasMediaSources = item as IHasMediaSources;
|
||||||
var mediaSources = hasMediaSources != null
|
var mediaSources = hasMediaSources != null
|
||||||
? (user == null ? _mediaSourceManager.GetStaticMediaSources(hasMediaSources, true) : _mediaSourceManager.GetStaticMediaSources(hasMediaSources, true, user)).ToList()
|
? (_mediaSourceManager.GetStaticMediaSources(hasMediaSources, true, user)).ToList()
|
||||||
: new List<MediaSourceInfo>();
|
: new List<MediaSourceInfo>();
|
||||||
|
|
||||||
var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId, mediaSourceId, audioStreamIndex, subtitleStreamIndex);
|
var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId, mediaSourceId, audioStreamIndex, subtitleStreamIndex);
|
||||||
|
@ -235,7 +235,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
return GetStaticMediaSources(item, enablePathSubstitution).FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
|
return GetStaticMediaSources(item, enablePathSubstitution).FirstOrDefault(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<MediaSourceInfo> GetStaticMediaSources(IHasMediaSources item, bool enablePathSubstitution)
|
public IEnumerable<MediaSourceInfo> GetStaticMediaSources(IHasMediaSources item, bool enablePathSubstitution, User user = null)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
@ -247,31 +247,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
return item.GetMediaSources(enablePathSubstitution);
|
return item.GetMediaSources(enablePathSubstitution);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item.GetMediaSources(enablePathSubstitution);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<MediaSourceInfo> GetStaticMediaSources(IHasMediaSources item, bool enablePathSubstitution, User user)
|
|
||||||
{
|
|
||||||
if (item == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("item");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(item is Video))
|
|
||||||
{
|
|
||||||
return item.GetMediaSources(enablePathSubstitution);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("user");
|
|
||||||
}
|
|
||||||
|
|
||||||
var sources = item.GetMediaSources(enablePathSubstitution).ToList();
|
var sources = item.GetMediaSources(enablePathSubstitution).ToList();
|
||||||
|
|
||||||
foreach (var source in sources)
|
if (user != null)
|
||||||
{
|
{
|
||||||
SetUserProperties(source, user);
|
foreach (var source in sources)
|
||||||
|
{
|
||||||
|
SetUserProperties(source, user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sources;
|
return sources;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
//[assembly: AssemblyVersion("3.0.*")]
|
[assembly: AssemblyVersion("3.0.*")]
|
||||||
[assembly: AssemblyVersion("3.0.5569.0")]
|
//[assembly: AssemblyVersion("3.0.5569.0")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user