Merge pull request #1463 from MediaBrowser/beta

Beta
This commit is contained in:
Luke 2016-02-14 23:29:42 -05:00
commit 5bee5acd27
7 changed files with 51 additions and 31 deletions

View File

@ -235,7 +235,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
}
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++;
@ -261,7 +261,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
}
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
{
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));
}
}

View File

@ -19,6 +19,7 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Xml;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Dlna.Didl
{
@ -56,7 +57,7 @@ namespace MediaBrowser.Dlna.Didl
_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();
@ -73,12 +74,12 @@ namespace MediaBrowser.Dlna.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;
}
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);
@ -112,11 +113,11 @@ namespace MediaBrowser.Dlna.Didl
{
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))
{
AddVideoResource(element, hasMediaSources, deviceId, filter, streamInfo);
AddVideoResource(options, element, hasMediaSources, deviceId, filter, streamInfo);
}
}
@ -125,13 +126,23 @@ namespace MediaBrowser.Dlna.Didl
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)
{
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),
MediaSources = sources,
@ -368,7 +379,7 @@ namespace MediaBrowser.Dlna.Didl
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);
@ -376,7 +387,7 @@ namespace MediaBrowser.Dlna.Didl
{
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),
MediaSources = sources,

View File

@ -17,6 +17,7 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
namespace MediaBrowser.Dlna.PlayTo
{
@ -33,6 +34,7 @@ namespace MediaBrowser.Dlna.PlayTo
private readonly IUserDataManager _userDataManager;
private readonly ILocalizationManager _localization;
private readonly IMediaSourceManager _mediaSourceManager;
private readonly IConfigurationManager _config;
private readonly IDeviceDiscovery _deviceDiscovery;
private readonly string _serverAddress;
@ -58,7 +60,7 @@ namespace MediaBrowser.Dlna.PlayTo
}
return false;
}
return _device != null;
}
}
@ -72,7 +74,7 @@ namespace MediaBrowser.Dlna.PlayTo
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;
_sessionManager = sessionManager;
@ -85,6 +87,7 @@ namespace MediaBrowser.Dlna.PlayTo
_userDataManager = userDataManager;
_localization = localization;
_mediaSourceManager = mediaSourceManager;
_config = config;
_accessToken = accessToken;
_logger = logger;
_creationTime = DateTime.UtcNow;
@ -476,7 +479,7 @@ namespace MediaBrowser.Dlna.PlayTo
playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);
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;
@ -532,13 +535,23 @@ namespace MediaBrowser.Dlna.PlayTo
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)
{
if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
{
return new PlaylistItem
{
StreamInfo = new StreamBuilder(_logger).BuildVideoItem(new VideoOptions
StreamInfo = new StreamBuilder(GetStreamBuilderLogger()).BuildVideoItem(new VideoOptions
{
ItemId = item.Id.ToString("N"),
MediaSources = mediaSources,
@ -558,7 +571,7 @@ namespace MediaBrowser.Dlna.PlayTo
{
return new PlaylistItem
{
StreamInfo = new StreamBuilder(_logger).BuildAudioItem(new AudioOptions
StreamInfo = new StreamBuilder(GetStreamBuilderLogger()).BuildAudioItem(new AudioOptions
{
ItemId = item.Id.ToString("N"),
MediaSources = mediaSources,

View File

@ -134,7 +134,8 @@ namespace MediaBrowser.Dlna.PlayTo
_deviceDiscovery,
_userDataManager,
_localization,
_mediaSourceManager);
_mediaSourceManager,
_config);
controller.Init(device);

View File

@ -1966,13 +1966,13 @@ namespace MediaBrowser.Server.Implementations.Persistence
whereClauses.Add(string.Format("(InheritedParentalRatingValue > 0 or UnratedType not in ({0}))", inClause));
}
//var excludeTagIndex = 0;
//foreach (var excludeTag in query.ExcludeTags)
//{
// whereClauses.Add("Tags not like @excludeTag" + excludeTagIndex);
// cmd.Parameters.Add(cmd, "@excludeTag" + excludeTagIndex, DbType.String).Value = "%" + excludeTag + "%";
// excludeTagIndex++;
//}
var excludeTagIndex = 0;
foreach (var excludeTag in query.ExcludeTags)
{
whereClauses.Add("Tags not like @excludeTag" + excludeTagIndex);
cmd.Parameters.Add(cmd, "@excludeTag" + excludeTagIndex, DbType.String).Value = "%" + excludeTag + "%";
excludeTagIndex++;
}
if (addPaging)
{
@ -2070,8 +2070,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
_updateInheritedRatingCommand.Transaction = transaction;
_updateInheritedRatingCommand.ExecuteNonQuery();
_updateInheritedRatingCommand.ExecuteNonQuery();
}
transaction.Commit();

View File

@ -104,9 +104,6 @@
<Content Include="dashboard-ui\components\chromecasthelpers.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\autoorganizesmart.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\bower_components\fastclick\lib\fastclick.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@ -1,4 +1,4 @@
using System.Reflection;
//[assembly: AssemblyVersion("3.0.*")]
[assembly: AssemblyVersion("3.0.5867")]
[assembly: AssemblyVersion("3.0.5878")]