mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
commit
95347ba7b3
6 changed files with 50 additions and 30 deletions
|
@ -235,7 +235,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.DocumentElement.AppendChild(_didlBuilder.GetItemElement(result, item, null, null, deviceId, filter));
|
result.DocumentElement.AppendChild(_didlBuilder.GetItemElement(_config.GetDlnaConfiguration(), result, item, null, null, deviceId, filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
provided++;
|
provided++;
|
||||||
|
@ -261,7 +261,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.DocumentElement.AppendChild(_didlBuilder.GetItemElement(result, childItem, item, serverItem.StubType, deviceId, filter));
|
result.DocumentElement.AppendChild(_didlBuilder.GetItemElement(_config.GetDlnaConfiguration(), result, childItem, item, serverItem.StubType, deviceId, filter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.DocumentElement.AppendChild(_didlBuilder.GetItemElement(result, i, item, serverItem.StubType, deviceId, filter));
|
result.DocumentElement.AppendChild(_didlBuilder.GetItemElement(_config.GetDlnaConfiguration(), result, i, item, serverItem.StubType, deviceId, filter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using MediaBrowser.Model.Configuration;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.Didl
|
namespace MediaBrowser.Dlna.Didl
|
||||||
{
|
{
|
||||||
|
@ -56,7 +57,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
_user = user;
|
_user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetItemDidl(BaseItem item, BaseItem context, string deviceId, Filter filter, StreamInfo streamInfo)
|
public string GetItemDidl(DlnaOptions options, BaseItem item, BaseItem context, string deviceId, Filter filter, StreamInfo streamInfo)
|
||||||
{
|
{
|
||||||
var result = new XmlDocument();
|
var result = new XmlDocument();
|
||||||
|
|
||||||
|
@ -73,12 +74,12 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
|
|
||||||
result.AppendChild(didl);
|
result.AppendChild(didl);
|
||||||
|
|
||||||
result.DocumentElement.AppendChild(GetItemElement(result, item, context, null, deviceId, filter, streamInfo));
|
result.DocumentElement.AppendChild(GetItemElement(options, result, item, context, null, deviceId, filter, streamInfo));
|
||||||
|
|
||||||
return result.DocumentElement.OuterXml;
|
return result.DocumentElement.OuterXml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlElement GetItemElement(XmlDocument doc, BaseItem item, BaseItem context, StubType? contextStubType, string deviceId, Filter filter, StreamInfo streamInfo = null)
|
public XmlElement GetItemElement(DlnaOptions options, XmlDocument doc, BaseItem item, BaseItem context, StubType? contextStubType, string deviceId, Filter filter, StreamInfo streamInfo = null)
|
||||||
{
|
{
|
||||||
var clientId = GetClientId(item, null);
|
var clientId = GetClientId(item, null);
|
||||||
|
|
||||||
|
@ -112,11 +113,11 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
{
|
{
|
||||||
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
AddAudioResource(element, hasMediaSources, deviceId, filter, streamInfo);
|
AddAudioResource(options, element, hasMediaSources, deviceId, filter, streamInfo);
|
||||||
}
|
}
|
||||||
else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
AddVideoResource(element, hasMediaSources, deviceId, filter, streamInfo);
|
AddVideoResource(options, element, hasMediaSources, deviceId, filter, streamInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,13 +126,23 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddVideoResource(XmlElement container, IHasMediaSources video, string deviceId, Filter filter, StreamInfo streamInfo = null)
|
private ILogger GetStreamBuilderLogger(DlnaOptions options)
|
||||||
|
{
|
||||||
|
if (options.EnableDebugLog)
|
||||||
|
{
|
||||||
|
return _logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new NullLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddVideoResource(DlnaOptions options, XmlElement container, IHasMediaSources video, string deviceId, Filter filter, StreamInfo streamInfo = null)
|
||||||
{
|
{
|
||||||
if (streamInfo == null)
|
if (streamInfo == null)
|
||||||
{
|
{
|
||||||
var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user).ToList();
|
var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user).ToList();
|
||||||
|
|
||||||
streamInfo = new StreamBuilder(_logger).BuildVideoItem(new VideoOptions
|
streamInfo = new StreamBuilder(GetStreamBuilderLogger(options)).BuildVideoItem(new VideoOptions
|
||||||
{
|
{
|
||||||
ItemId = GetClientId(video),
|
ItemId = GetClientId(video),
|
||||||
MediaSources = sources,
|
MediaSources = sources,
|
||||||
|
@ -368,7 +379,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
return item.Name;
|
return item.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddAudioResource(XmlElement container, IHasMediaSources audio, string deviceId, Filter filter, StreamInfo streamInfo = null)
|
private void AddAudioResource(DlnaOptions options, XmlElement container, IHasMediaSources audio, string deviceId, Filter filter, StreamInfo streamInfo = null)
|
||||||
{
|
{
|
||||||
var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
|
var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
|
||||||
|
|
||||||
|
@ -376,7 +387,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
{
|
{
|
||||||
var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user).ToList();
|
var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user).ToList();
|
||||||
|
|
||||||
streamInfo = new StreamBuilder(new NullLogger()).BuildAudioItem(new AudioOptions
|
streamInfo = new StreamBuilder(GetStreamBuilderLogger(options)).BuildAudioItem(new AudioOptions
|
||||||
{
|
{
|
||||||
ItemId = GetClientId(audio),
|
ItemId = GetClientId(audio),
|
||||||
MediaSources = sources,
|
MediaSources = sources,
|
||||||
|
|
|
@ -17,6 +17,7 @@ using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Common.Configuration;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.PlayTo
|
namespace MediaBrowser.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
|
@ -33,6 +34,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
private readonly IUserDataManager _userDataManager;
|
private readonly IUserDataManager _userDataManager;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
|
private readonly IConfigurationManager _config;
|
||||||
|
|
||||||
private readonly IDeviceDiscovery _deviceDiscovery;
|
private readonly IDeviceDiscovery _deviceDiscovery;
|
||||||
private readonly string _serverAddress;
|
private readonly string _serverAddress;
|
||||||
|
@ -58,7 +60,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _device != null;
|
return _device != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +74,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
get { return IsSessionActive; }
|
get { return IsSessionActive; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayToController(SessionInfo session, ISessionManager sessionManager, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, string accessToken, IDeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager)
|
public PlayToController(SessionInfo session, ISessionManager sessionManager, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, string accessToken, IDeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IConfigurationManager config)
|
||||||
{
|
{
|
||||||
_session = session;
|
_session = session;
|
||||||
_sessionManager = sessionManager;
|
_sessionManager = sessionManager;
|
||||||
|
@ -85,6 +87,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
_userDataManager = userDataManager;
|
_userDataManager = userDataManager;
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
|
_config = config;
|
||||||
_accessToken = accessToken;
|
_accessToken = accessToken;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_creationTime = DateTime.UtcNow;
|
_creationTime = DateTime.UtcNow;
|
||||||
|
@ -476,7 +479,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);
|
playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);
|
||||||
|
|
||||||
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager)
|
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager)
|
||||||
.GetItemDidl(item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
|
.GetItemDidl(_config.GetDlnaConfiguration(), item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
|
||||||
|
|
||||||
playlistItem.Didl = itemXml;
|
playlistItem.Didl = itemXml;
|
||||||
|
|
||||||
|
@ -532,13 +535,23 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ILogger GetStreamBuilderLogger()
|
||||||
|
{
|
||||||
|
if (_config.GetDlnaConfiguration().EnableDebugLog)
|
||||||
|
{
|
||||||
|
return _logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new NullLogger();
|
||||||
|
}
|
||||||
|
|
||||||
private PlaylistItem GetPlaylistItem(BaseItem item, List<MediaSourceInfo> mediaSources, DeviceProfile profile, string deviceId, string mediaSourceId, int? audioStreamIndex, int? subtitleStreamIndex)
|
private PlaylistItem GetPlaylistItem(BaseItem item, List<MediaSourceInfo> mediaSources, DeviceProfile profile, string deviceId, string mediaSourceId, int? audioStreamIndex, int? subtitleStreamIndex)
|
||||||
{
|
{
|
||||||
if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return new PlaylistItem
|
return new PlaylistItem
|
||||||
{
|
{
|
||||||
StreamInfo = new StreamBuilder(_logger).BuildVideoItem(new VideoOptions
|
StreamInfo = new StreamBuilder(GetStreamBuilderLogger()).BuildVideoItem(new VideoOptions
|
||||||
{
|
{
|
||||||
ItemId = item.Id.ToString("N"),
|
ItemId = item.Id.ToString("N"),
|
||||||
MediaSources = mediaSources,
|
MediaSources = mediaSources,
|
||||||
|
@ -558,7 +571,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
return new PlaylistItem
|
return new PlaylistItem
|
||||||
{
|
{
|
||||||
StreamInfo = new StreamBuilder(_logger).BuildAudioItem(new AudioOptions
|
StreamInfo = new StreamBuilder(GetStreamBuilderLogger()).BuildAudioItem(new AudioOptions
|
||||||
{
|
{
|
||||||
ItemId = item.Id.ToString("N"),
|
ItemId = item.Id.ToString("N"),
|
||||||
MediaSources = mediaSources,
|
MediaSources = mediaSources,
|
||||||
|
|
|
@ -134,7 +134,8 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
_deviceDiscovery,
|
_deviceDiscovery,
|
||||||
_userDataManager,
|
_userDataManager,
|
||||||
_localization,
|
_localization,
|
||||||
_mediaSourceManager);
|
_mediaSourceManager,
|
||||||
|
_config);
|
||||||
|
|
||||||
controller.Init(device);
|
controller.Init(device);
|
||||||
|
|
||||||
|
|
|
@ -1966,13 +1966,13 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
whereClauses.Add(string.Format("(InheritedParentalRatingValue > 0 or UnratedType not in ({0}))", inClause));
|
whereClauses.Add(string.Format("(InheritedParentalRatingValue > 0 or UnratedType not in ({0}))", inClause));
|
||||||
}
|
}
|
||||||
|
|
||||||
//var excludeTagIndex = 0;
|
var excludeTagIndex = 0;
|
||||||
//foreach (var excludeTag in query.ExcludeTags)
|
foreach (var excludeTag in query.ExcludeTags)
|
||||||
//{
|
{
|
||||||
// whereClauses.Add("Tags not like @excludeTag" + excludeTagIndex);
|
whereClauses.Add("Tags not like @excludeTag" + excludeTagIndex);
|
||||||
// cmd.Parameters.Add(cmd, "@excludeTag" + excludeTagIndex, DbType.String).Value = "%" + excludeTag + "%";
|
cmd.Parameters.Add(cmd, "@excludeTag" + excludeTagIndex, DbType.String).Value = "%" + excludeTag + "%";
|
||||||
// excludeTagIndex++;
|
excludeTagIndex++;
|
||||||
//}
|
}
|
||||||
|
|
||||||
if (addPaging)
|
if (addPaging)
|
||||||
{
|
{
|
||||||
|
@ -2070,8 +2070,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
|
|
||||||
_updateInheritedRatingCommand.Transaction = transaction;
|
_updateInheritedRatingCommand.Transaction = transaction;
|
||||||
_updateInheritedRatingCommand.ExecuteNonQuery();
|
_updateInheritedRatingCommand.ExecuteNonQuery();
|
||||||
|
|
||||||
_updateInheritedRatingCommand.ExecuteNonQuery();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
|
|
|
@ -104,9 +104,6 @@
|
||||||
<Content Include="dashboard-ui\components\chromecasthelpers.js">
|
<Content Include="dashboard-ui\components\chromecasthelpers.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="dashboard-ui\autoorganizesmart.html">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="dashboard-ui\bower_components\fastclick\lib\fastclick.js">
|
<Content Include="dashboard-ui\bower_components\fastclick\lib\fastclick.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in a new issue