Skip to content

Commit

Permalink
Merge pull request #3366 from MediaBrowser/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
LukePulverenti authored Jul 17, 2018
2 parents e24bc2c + 714d988 commit dffad1c
Show file tree
Hide file tree
Showing 3,940 changed files with 2,709,689 additions and 115,717 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 8 additions & 5 deletions BDInfo/BDInfo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -33,6 +33,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MediaBrowser.Common, Version=3.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.5.0\lib\netstandard2.0\MediaBrowser.Common.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.Model, Version=3.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.5.0\lib\netstandard2.0\MediaBrowser.Model.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -66,10 +72,7 @@
<Compile Include="TSStreamFile.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
<Name>MediaBrowser.Model</Name>
</ProjectReference>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
4 changes: 4 additions & 0 deletions BDInfo/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.Common" version="3.5.0" targetFramework="net47" />
</packages>
27 changes: 19 additions & 8 deletions DvdLib/DvdLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
<AssemblyName>DvdLib</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -49,14 +48,26 @@
<Compile Include="Ifo\UserOperation.cs" />
<Compile Include="Ifo\VideoAttributes.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Reference Include="MediaBrowser.Common, Version=3.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.5.0\lib\netstandard2.0\MediaBrowser.Common.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.Model, Version=3.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.5.0\lib\netstandard2.0\MediaBrowser.Model.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
<Name>MediaBrowser.Model</Name>
</ProjectReference>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
6 changes: 0 additions & 6 deletions DvdLib/DvdLib.nuget.targets

This file was deleted.

4 changes: 4 additions & 0 deletions DvdLib/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.Common" version="3.5.0" targetFramework="net47" />
</packages>
96 changes: 50 additions & 46 deletions Emby.Dlna/Api/DlnaServerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Services;
using MediaBrowser.Common.Extensions;
using System.Text;
using MediaBrowser.Controller.Net;
using System.Linq;
using Emby.Dlna.Main;

namespace Emby.Dlna.Api
{
Expand Down Expand Up @@ -99,7 +99,7 @@ public class ProcessConnectionManagerEventRequest
[Route("/Dlna/icons/{Filename}", "GET", Summary = "Gets a server icon")]
public class GetIcon
{
[ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
[ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string UuId { get; set; }

[ApiMember(Name = "Filename", Description = "The icon filename", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
Expand All @@ -109,23 +109,39 @@ public class GetIcon
public class DlnaServerService : IService, IRequiresRequest
{
private readonly IDlnaManager _dlnaManager;
private readonly IContentDirectory _contentDirectory;
private readonly IConnectionManager _connectionManager;
private readonly IMediaReceiverRegistrar _mediaReceiverRegistrar;

private const string XMLContentType = "text/xml; charset=UTF-8";
private readonly IMemoryStreamFactory _memoryStreamProvider;

public IRequest Request { get; set; }
private IHttpResultFactory _resultFactory;

public DlnaServerService(IDlnaManager dlnaManager, IHttpResultFactory httpResultFactory, IContentDirectory contentDirectory, IConnectionManager connectionManager, IMediaReceiverRegistrar mediaReceiverRegistrar, IMemoryStreamFactory memoryStreamProvider)
private IContentDirectory ContentDirectory
{
get
{
return DlnaEntryPoint.Current.ContentDirectory;
}
}

private IConnectionManager ConnectionManager
{
get
{
return DlnaEntryPoint.Current.ConnectionManager;
}
}

private IMediaReceiverRegistrar MediaReceiverRegistrar
{
get
{
return DlnaEntryPoint.Current.MediaReceiverRegistrar;
}
}

public DlnaServerService(IDlnaManager dlnaManager, IHttpResultFactory httpResultFactory)
{
_dlnaManager = dlnaManager;
_contentDirectory = contentDirectory;
_connectionManager = connectionManager;
_mediaReceiverRegistrar = mediaReceiverRegistrar;
_memoryStreamProvider = memoryStreamProvider;
_resultFactory = httpResultFactory;
}

Expand All @@ -149,44 +165,44 @@ public object Get(GetDescriptionXml request)

public object Get(GetContentDirectory request)
{
var xml = _contentDirectory.GetServiceXml(Request.Headers.ToDictionary());
var xml = ContentDirectory.GetServiceXml(Request.Headers.ToDictionary());

return _resultFactory.GetResult(xml, XMLContentType);
return _resultFactory.GetResult(Request, xml, XMLContentType);
}

public object Get(GetMediaReceiverRegistrar request)
{
var xml = _mediaReceiverRegistrar.GetServiceXml(Request.Headers.ToDictionary());
var xml = MediaReceiverRegistrar.GetServiceXml(Request.Headers.ToDictionary());

return _resultFactory.GetResult(xml, XMLContentType);
return _resultFactory.GetResult(Request, xml, XMLContentType);
}

public object Get(GetConnnectionManager request)
{
var xml = _connectionManager.GetServiceXml(Request.Headers.ToDictionary());
var xml = ConnectionManager.GetServiceXml(Request.Headers.ToDictionary());

return _resultFactory.GetResult(xml, XMLContentType);
return _resultFactory.GetResult(Request, xml, XMLContentType);
}

public object Post(ProcessMediaReceiverRegistrarControlRequest request)
{
var response = PostAsync(request.RequestStream, _mediaReceiverRegistrar);
var response = PostAsync(request.RequestStream, MediaReceiverRegistrar);

return _resultFactory.GetResult(response.Xml, XMLContentType);
return _resultFactory.GetResult(Request, response.Xml, XMLContentType);
}

public object Post(ProcessContentDirectoryControlRequest request)
{
var response = PostAsync(request.RequestStream, _contentDirectory);
var response = PostAsync(request.RequestStream, ContentDirectory);

return _resultFactory.GetResult(response.Xml, XMLContentType);
return _resultFactory.GetResult(Request, response.Xml, XMLContentType);
}

public object Post(ProcessConnectionManagerControlRequest request)
{
var response = PostAsync(request.RequestStream, _connectionManager);
var response = PostAsync(request.RequestStream, ConnectionManager);

return _resultFactory.GetResult(response.Xml, XMLContentType);
return _resultFactory.GetResult(Request, response.Xml, XMLContentType);
}

private ControlResponse PostAsync(Stream requestStream, IUpnpService service)
Expand Down Expand Up @@ -236,54 +252,42 @@ private List<string> Parse(string pathUri)

public object Get(GetIcon request)
{
using (var response = _dlnaManager.GetIcon(request.Filename))
{
using (var ms = new MemoryStream())
{
response.Stream.CopyTo(ms);
var contentType = "image/" + Path.GetExtension(request.Filename).TrimStart('.').ToLower();

ms.Position = 0;
var bytes = ms.ToArray();

var contentType = "image/" + response.Format.ToString().ToLower();

var cacheLength = TimeSpan.FromDays(365);
var cacheKey = Request.RawUrl.GetMD5();
var cacheLength = TimeSpan.FromDays(365);
var cacheKey = Request.RawUrl.GetMD5();

return _resultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, contentType, ()=> Task.FromResult<Stream>(new MemoryStream(bytes)));
//return ResultFactory.GetResult(bytes, contentType);
}
}
return _resultFactory.GetStaticResult(Request, cacheKey, null, cacheLength, contentType, () => Task.FromResult<Stream>(_dlnaManager.GetIcon(request.Filename).Stream));
}

public object Subscribe(ProcessContentDirectoryEventRequest request)
{
return ProcessEventRequest(_contentDirectory);
return ProcessEventRequest(ContentDirectory);
}

public object Subscribe(ProcessConnectionManagerEventRequest request)
{
return ProcessEventRequest(_connectionManager);
return ProcessEventRequest(ConnectionManager);
}

public object Subscribe(ProcessMediaReceiverRegistrarEventRequest request)
{
return ProcessEventRequest(_mediaReceiverRegistrar);
return ProcessEventRequest(MediaReceiverRegistrar);
}

public object Unsubscribe(ProcessContentDirectoryEventRequest request)
{
return ProcessEventRequest(_contentDirectory);
return ProcessEventRequest(ContentDirectory);
}

public object Unsubscribe(ProcessConnectionManagerEventRequest request)
{
return ProcessEventRequest(_connectionManager);
return ProcessEventRequest(ConnectionManager);
}

public object Unsubscribe(ProcessMediaReceiverRegistrarEventRequest request)
{
return ProcessEventRequest(_mediaReceiverRegistrar);
return ProcessEventRequest(MediaReceiverRegistrar);
}

private object ProcessEventRequest(IEventManager eventManager)
Expand All @@ -310,7 +314,7 @@ private object ProcessEventRequest(IEventManager eventManager)

private object GetSubscriptionResponse(EventSubscriptionResponse response)
{
return _resultFactory.GetResult(response.Content, response.ContentType, response.Headers);
return _resultFactory.GetResult(Request, response.Content, response.ContentType, response.Headers);
}
}
}
10 changes: 3 additions & 7 deletions Emby.Dlna/ContentDirectory/ContentDirectory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
Expand All @@ -26,10 +25,9 @@ public class ContentDirectory : BaseService, IContentDirectory
private readonly IServerConfigurationManager _config;
private readonly IUserManager _userManager;
private readonly ILocalizationManager _localization;
private readonly IChannelManager _channelManager;
private readonly IMediaSourceManager _mediaSourceManager;
private readonly IUserViewManager _userViewManager;
private readonly Func<IMediaEncoder> _mediaEncoder;
private readonly IMediaEncoder _mediaEncoder;
protected readonly IXmlReaderSettingsFactory XmlReaderSettingsFactory;
private readonly ITVSeriesManager _tvSeriesManager;

Expand All @@ -40,7 +38,7 @@ public ContentDirectory(IDlnaManager dlna,
IServerConfigurationManager config,
IUserManager userManager,
ILogger logger,
IHttpClient httpClient, ILocalizationManager localization, IChannelManager channelManager, IMediaSourceManager mediaSourceManager, IUserViewManager userViewManager, Func<IMediaEncoder> mediaEncoder, IXmlReaderSettingsFactory xmlReaderSettingsFactory, ITVSeriesManager tvSeriesManager)
IHttpClient httpClient, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IUserViewManager userViewManager, IMediaEncoder mediaEncoder, IXmlReaderSettingsFactory xmlReaderSettingsFactory, ITVSeriesManager tvSeriesManager)
: base(logger, httpClient)
{
_dlna = dlna;
Expand All @@ -50,7 +48,6 @@ public ContentDirectory(IDlnaManager dlna,
_config = config;
_userManager = userManager;
_localization = localization;
_channelManager = channelManager;
_mediaSourceManager = mediaSourceManager;
_userViewManager = userViewManager;
_mediaEncoder = mediaEncoder;
Expand Down Expand Up @@ -95,10 +92,9 @@ public ControlResponse ProcessControlRequest(ControlRequest request)
SystemUpdateId,
_config,
_localization,
_channelManager,
_mediaSourceManager,
_userViewManager,
_mediaEncoder(),
_mediaEncoder,
XmlReaderSettingsFactory,
_tvSeriesManager)
.ProcessControlRequest(request);
Expand Down
Loading

0 comments on commit dffad1c

Please sign in to comment.