Merge pull request #2281 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-11-11 15:37:53 -05:00 committed by GitHub
commit b4c6cad2fa
418 changed files with 14834 additions and 1776 deletions

View File

@ -1,13 +1,13 @@
using System.IO;
using MediaBrowser.Model.IO;
using SharpCompress.Archive.Rar;
using SharpCompress.Archive.SevenZip;
using SharpCompress.Archive.Tar;
using SharpCompress.Archives.Rar;
using SharpCompress.Archives.SevenZip;
using SharpCompress.Archives.Tar;
using SharpCompress.Common;
using SharpCompress.Reader;
using SharpCompress.Reader.Zip;
using SharpCompress.Readers;
using SharpCompress.Readers.Zip;
namespace MediaBrowser.Server.Implementations.Archiving
namespace Emby.Common.Implementations.Archiving
{
/// <summary>
/// Class DotNetZipClient
@ -45,11 +45,12 @@ namespace MediaBrowser.Server.Implementations.Archiving
{
using (var reader = ReaderFactory.Open(source))
{
var options = ExtractOptions.ExtractFullPath;
var options = new ExtractionOptions();
options.ExtractFullPath = true;
if (overwriteExistingFiles)
{
options = options | ExtractOptions.Overwrite;
options.Overwrite = true;
}
reader.WriteAllToDirectory(targetPath, options);
@ -60,11 +61,12 @@ namespace MediaBrowser.Server.Implementations.Archiving
{
using (var reader = ZipReader.Open(source))
{
var options = ExtractOptions.ExtractFullPath;
var options = new ExtractionOptions();
options.ExtractFullPath = true;
if (overwriteExistingFiles)
{
options = options | ExtractOptions.Overwrite;
options.Overwrite = true;
}
reader.WriteAllToDirectory(targetPath, options);
@ -97,11 +99,12 @@ namespace MediaBrowser.Server.Implementations.Archiving
{
using (var reader = archive.ExtractAllEntries())
{
var options = ExtractOptions.ExtractFullPath;
var options = new ExtractionOptions();
options.ExtractFullPath = true;
if (overwriteExistingFiles)
{
options = options | ExtractOptions.Overwrite;
options.Overwrite = true;
}
reader.WriteAllToDirectory(targetPath, options);
@ -136,11 +139,12 @@ namespace MediaBrowser.Server.Implementations.Archiving
{
using (var reader = archive.ExtractAllEntries())
{
var options = ExtractOptions.ExtractFullPath;
var options = new ExtractionOptions();
options.ExtractFullPath = true;
if (overwriteExistingFiles)
{
options = options | ExtractOptions.Overwrite;
options.Overwrite = true;
}
reader.WriteAllToDirectory(targetPath, options);
@ -174,11 +178,12 @@ namespace MediaBrowser.Server.Implementations.Archiving
{
using (var reader = archive.ExtractAllEntries())
{
var options = ExtractOptions.ExtractFullPath;
var options = new ExtractionOptions();
options.ExtractFullPath = true;
if (overwriteExistingFiles)
{
options = options | ExtractOptions.Overwrite;
options.Overwrite = true;
}
reader.WriteAllToDirectory(targetPath, options);

View File

@ -152,8 +152,6 @@ namespace Emby.Common.Implementations
protected IIsoManager IsoManager { get; private set; }
protected ISystemEvents SystemEvents { get; private set; }
protected IProcessFactory ProcessFactory { get; private set; }
protected ITimerFactory TimerFactory { get; private set; }
protected ISocketFactory SocketFactory { get; private set; }
@ -172,7 +170,7 @@ namespace Emby.Common.Implementations
protected ICryptoProvider CryptographyProvider = new CryptographyProvider();
protected IEnvironmentInfo EnvironmentInfo = new Emby.Common.Implementations.EnvironmentInfo.EnvironmentInfo();
protected IEnvironmentInfo EnvironmentInfo { get; private set; }
private DeviceId _deviceId;
public string SystemId
@ -193,20 +191,30 @@ namespace Emby.Common.Implementations
get { return EnvironmentInfo.OperatingSystemName; }
}
public IMemoryStreamFactory MemoryStreamProvider { get; set; }
/// <summary>
/// The container
/// </summary>
protected readonly SimpleInjector.Container Container = new SimpleInjector.Container();
protected ISystemEvents SystemEvents { get; private set; }
protected IMemoryStreamFactory MemoryStreamFactory { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationHost{TApplicationPathsType}"/> class.
/// </summary>
protected BaseApplicationHost(TApplicationPathsType applicationPaths,
ILogManager logManager,
IFileSystem fileSystem)
IFileSystem fileSystem,
IEnvironmentInfo environmentInfo,
ISystemEvents systemEvents,
IMemoryStreamFactory memoryStreamFactory,
INetworkManager networkManager)
{
NetworkManager = networkManager;
EnvironmentInfo = environmentInfo;
SystemEvents = systemEvents;
MemoryStreamFactory = memoryStreamFactory;
// hack alert, until common can target .net core
BaseExtensions.CryptographyProvider = CryptographyProvider;
@ -233,9 +241,6 @@ namespace Emby.Common.Implementations
JsonSerializer = CreateJsonSerializer();
MemoryStreamProvider = CreateMemoryStreamProvider();
SystemEvents = CreateSystemEvents();
OnLoggerLoaded(true);
LogManager.LoggerLoaded += (s, e) => OnLoggerLoaded(false);
@ -267,9 +272,6 @@ namespace Emby.Common.Implementations
progress.Report(100);
}
protected abstract IMemoryStreamFactory CreateMemoryStreamProvider();
protected abstract ISystemEvents CreateSystemEvents();
protected virtual void OnLoggerLoaded(bool isFirstLoad)
{
Logger.Info("Application version: {0}", ApplicationVersion);
@ -521,7 +523,7 @@ return null;
RegisterSingleInstance(JsonSerializer);
RegisterSingleInstance(XmlSerializer);
RegisterSingleInstance(MemoryStreamProvider);
RegisterSingleInstance(MemoryStreamFactory);
RegisterSingleInstance(SystemEvents);
RegisterSingleInstance(LogManager);
@ -532,10 +534,9 @@ return null;
RegisterSingleInstance(FileSystemManager);
HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamProvider);
HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamFactory);
RegisterSingleInstance(HttpClient);
NetworkManager = CreateNetworkManager(LogManager.GetLogger("NetworkManager"));
RegisterSingleInstance(NetworkManager);
IsoManager = new IsoManager();
@ -588,8 +589,6 @@ return null;
}
}
protected abstract INetworkManager CreateNetworkManager(ILogger logger);
/// <summary>
/// Creates an instance of type and resolves all constructor dependancies
/// </summary>

View File

@ -9,6 +9,8 @@ namespace Emby.Common.Implementations.EnvironmentInfo
{
public class EnvironmentInfo : IEnvironmentInfo
{
public MediaBrowser.Model.System.Architecture? CustomArchitecture { get; set; }
public MediaBrowser.Model.System.OperatingSystem OperatingSystem
{
get
@ -66,5 +68,32 @@ namespace Emby.Common.Implementations.EnvironmentInfo
return "1.0";
}
}
public MediaBrowser.Model.System.Architecture SystemArchitecture
{
get
{
if (CustomArchitecture.HasValue)
{
return CustomArchitecture.Value;
}
#if NET46
return Environment.Is64BitOperatingSystem ? MediaBrowser.Model.System.Architecture.X64 : MediaBrowser.Model.System.Architecture.X86;
#elif NETSTANDARD1_6
switch(System.Runtime.InteropServices.RuntimeInformation.OSArchitecture)
{
case System.Runtime.InteropServices.Architecture.Arm:
return MediaBrowser.Model.System.Architecture.Arm;
case System.Runtime.InteropServices.Architecture.Arm64:
return MediaBrowser.Model.System.Architecture.Arm64;
case System.Runtime.InteropServices.Architecture.X64:
return MediaBrowser.Model.System.Architecture.X64;
case System.Runtime.InteropServices.Architecture.X86:
return MediaBrowser.Model.System.Architecture.X86;
}
#endif
return MediaBrowser.Model.System.Architecture.X64;
}
}
}
}

View File

@ -761,5 +761,10 @@ namespace Emby.Common.Implementations.IO
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
return Directory.EnumerateFileSystemEntries(path, "*", searchOption);
}
public virtual void SetExecutable(string path)
{
}
}
}

View File

@ -23,7 +23,7 @@ namespace Emby.Common.Implementations.Net
{
get
{
return BaseNetworkManager.ToIpEndPointInfo((IPEndPoint)Socket.LocalEndPoint);
return NetworkManager.ToIpEndPointInfo((IPEndPoint)Socket.LocalEndPoint);
}
}
@ -31,7 +31,7 @@ namespace Emby.Common.Implementations.Net
{
get
{
return BaseNetworkManager.ToIpEndPointInfo((IPEndPoint)Socket.RemoteEndPoint);
return NetworkManager.ToIpEndPointInfo((IPEndPoint)Socket.RemoteEndPoint);
}
}
@ -64,7 +64,7 @@ namespace Emby.Common.Implementations.Net
public void Bind(IpEndPointInfo endpoint)
{
var nativeEndpoint = BaseNetworkManager.ToIPEndPoint(endpoint);
var nativeEndpoint = NetworkManager.ToIPEndPoint(endpoint);
Socket.Bind(nativeEndpoint);
}

View File

@ -175,7 +175,7 @@ namespace Emby.Common.Implementations.Net
return null;
}
return BaseNetworkManager.ToIpEndPointInfo(endpoint);
return NetworkManager.ToIpEndPointInfo(endpoint);
}
private void ProcessResponse(IAsyncResult asyncResult)

View File

@ -9,15 +9,17 @@ using System.Net.Sockets;
using System.Threading.Tasks;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.IO;
using MediaBrowser.Common.Net;
namespace Emby.Common.Implementations.Networking
{
public abstract class BaseNetworkManager
public class NetworkManager : INetworkManager
{
protected ILogger Logger { get; private set; }
private DateTime _lastRefresh;
protected BaseNetworkManager(ILogger logger)
public NetworkManager(ILogger logger)
{
Logger = logger;
}
@ -481,5 +483,24 @@ namespace Emby.Common.Implementations.Networking
var addresses = await Dns.GetHostAddressesAsync(host).ConfigureAwait(false);
return addresses.Select(ToIpAddressInfo).ToArray();
}
/// <summary>
/// Gets the network shares.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>IEnumerable{NetworkShare}.</returns>
public IEnumerable<NetworkShare> GetNetworkShares(string path)
{
return new List<NetworkShare>();
}
/// <summary>
/// Gets available devices within the domain
/// </summary>
/// <returns>PC's in the Domain</returns>
public IEnumerable<FileSystemEntryInfo> GetNetworkDevices()
{
return new List<FileSystemEntryInfo>();
}
}
}

View File

@ -4,7 +4,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Server.Implementations.Serialization
namespace Emby.Common.Implementations.Serialization
{
/// <summary>
/// Provides a wrapper around third party json serialization.

View File

@ -23,7 +23,9 @@
},
"dependencies": {
"SimpleInjector": "3.2.4",
"ServiceStack.Text": "4.5.4",
"NLog": "4.4.0-betaV15",
"sharpcompress": "0.14.0",
"MediaBrowser.Model": {
"target": "project"
},
@ -52,13 +54,16 @@
"System.Reflection.Primitives": "4.0.1",
"System.Runtime.Loader": "4.0.0",
"SimpleInjector": "3.2.4",
"ServiceStack.Text.Core": "1.0.27",
"NLog": "4.4.0-betaV15",
"sharpcompress": "0.14.0",
"MediaBrowser.Model": {
"target": "project"
},
"MediaBrowser.Common": {
"target": "project"
} }
}
}
}
}
}

View File

@ -1,4 +1,4 @@
{
{
"frameworks":{
"netstandard1.6":{
"dependencies":{

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6CFEE013-6E7C-432B-AC37-CABF0880C69A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Emby.Drawing.ImageMagick</RootNamespace>
<AssemblyName>Emby.Drawing.ImageMagick</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ImageMagickSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ImageMagickSharp.1.0.0.18\lib\net45\ImageMagickSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ImageHelpers.cs" />
<Compile Include="ImageMagickEncoder.cs" />
<Compile Include="PercentPlayedDrawer.cs" />
<Compile Include="PlayedIndicatorDrawer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StripCollageBuilder.cs" />
<Compile Include="UnplayedCountIndicator.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="fonts\robotoregular.ttf" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
<Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
<Name>MediaBrowser.Common</Name>
</ProjectReference>
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj">
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
<Name>MediaBrowser.Controller</Name>
</ProjectReference>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
<Name>MediaBrowser.Model</Name>
</ProjectReference>
</ItemGroup>
<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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Emby.Drawing.ImageMagick
{
internal static class ImageHelpers
{
internal static List<string> ProjectPaths(List<string> paths, int count)
{
if (count <= 0)
{
throw new ArgumentOutOfRangeException("count");
}
if (paths.Count == 0)
{
throw new ArgumentOutOfRangeException("paths");
}
var list = new List<string>();
AddToList(list, paths, count);
return list.Take(count).ToList();
}
private static void AddToList(List<string> list, List<string> paths, int count)
{
while (list.Count < count)
{
foreach (var path in paths)
{
list.Add(path);
if (list.Count >= count)
{
return;
}
}
}
}
}
}

View File

@ -8,9 +8,6 @@ using MediaBrowser.Model.Logging;
using System;
using System.IO;
using System.Linq;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
namespace Emby.Drawing.ImageMagick
@ -19,17 +16,15 @@ namespace Emby.Drawing.ImageMagick
{
private readonly ILogger _logger;
private readonly IApplicationPaths _appPaths;
private readonly IHttpClient _httpClient;
private readonly Func<IHttpClient> _httpClientFactory;
private readonly IFileSystem _fileSystem;
private readonly IServerConfigurationManager _config;
public ImageMagickEncoder(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager config)
public ImageMagickEncoder(ILogger logger, IApplicationPaths appPaths, Func<IHttpClient> httpClientFactory, IFileSystem fileSystem)
{
_logger = logger;
_appPaths = appPaths;
_httpClient = httpClient;
_httpClientFactory = httpClientFactory;
_fileSystem = fileSystem;
_config = config;
LogVersion();
}
@ -260,7 +255,7 @@ namespace Emby.Drawing.ImageMagick
{
var currentImageSize = new ImageSize(imageWidth, imageHeight);
var task = new PlayedIndicatorDrawer(_appPaths, _httpClient, _fileSystem).DrawPlayedIndicator(wand, currentImageSize);
var task = new PlayedIndicatorDrawer(_appPaths, _httpClientFactory(), _fileSystem).DrawPlayedIndicator(wand, currentImageSize);
Task.WaitAll(task);
}
else if (options.UnplayedCount.HasValue)

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Drawing.ImageMagick")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Emby.Drawing.ImageMagick")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6cfee013-6e7c-432b-ac37-cabf0880c69a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ImageMagickSharp" version="1.0.0.18" targetFramework="net45" />
<package id="ImageMagickSharp" version="1.0.0.18" targetFramework="net452" />
</packages>

View File

@ -7,7 +7,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
namespace Emby.Drawing.GDI
namespace Emby.Drawing.Net
{
public static class DynamicImageHelpers
{

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C97A239E-A96C-4D64-A844-CCF8CC30AECB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Emby.Drawing.Net</RootNamespace>
<AssemblyName>Emby.Drawing.Net</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DynamicImageHelpers.cs" />
<Compile Include="GDIImageEncoder.cs" />
<Compile Include="ImageExtensions.cs" />
<Compile Include="ImageHelpers.cs" />
<Compile Include="PercentPlayedDrawer.cs" />
<Compile Include="PlayedIndicatorDrawer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UnplayedCountIndicator.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
<Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
<Name>MediaBrowser.Common</Name>
</ProjectReference>
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj">
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
<Name>MediaBrowser.Controller</Name>
</ProjectReference>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
<Name>MediaBrowser.Model</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="empty.png" />
</ItemGroup>
<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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -12,7 +12,7 @@ using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using ImageFormat = MediaBrowser.Model.Drawing.ImageFormat;
namespace Emby.Drawing.GDI
namespace Emby.Drawing.Net
{
public class GDIImageEncoder : IImageEncoder
{

View File

@ -4,7 +4,7 @@ using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
namespace Emby.Drawing.GDI
namespace Emby.Drawing.Net
{
public static class ImageExtensions
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
namespace Emby.Drawing
namespace Emby.Drawing.Net
{
internal static class ImageHelpers
{

View File

@ -1,7 +1,7 @@
using System;
using System.Drawing;
namespace Emby.Drawing.GDI
namespace Emby.Drawing.Net
{
public class PercentPlayedDrawer
{

View File

@ -1,6 +1,6 @@
using System.Drawing;
namespace Emby.Drawing.GDI
namespace Emby.Drawing.Net
{
public class PlayedIndicatorDrawer
{

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Drawing.Net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Emby.Drawing.Net")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c97a239e-a96c-4d64-a844-ccf8cc30aecb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,6 +1,6 @@
using System.Drawing;
namespace Emby.Drawing.GDI
namespace Emby.Drawing.Net
{
public class UnplayedCountIndicator
{

View File

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 158 B

View File

@ -48,7 +48,7 @@ namespace Emby.Drawing.Common
/// <exception cref="ArgumentException">The image was of an unrecognised format.</exception>
public static ImageSize GetDimensions(string path, ILogger logger, IFileSystem fileSystem)
{
using (var fs = File.OpenRead(path))
using (var fs = fileSystem.OpenRead(path))
{
using (var binaryReader = new BinaryReader(fs))
{

View File

@ -9,10 +9,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Emby.Drawing</RootNamespace>
<AssemblyName>Emby.Drawing</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -32,18 +33,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ImageMagickSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ImageMagickSharp.1.0.0.18\lib\net45\ImageMagickSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="TagLib.Portable">
<HintPath>..\ThirdParty\taglib\TagLib.Portable.dll</HintPath>
</Reference>
@ -53,25 +42,9 @@
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Common\ImageHeader.cs" />
<Compile Include="GDI\DynamicImageHelpers.cs" />
<Compile Include="GDI\GDIImageEncoder.cs" />
<Compile Include="GDI\ImageExtensions.cs" />
<Compile Include="GDI\PercentPlayedDrawer.cs" />
<Compile Include="GDI\PlayedIndicatorDrawer.cs" />
<Compile Include="GDI\UnplayedCountIndicator.cs" />
<Compile Include="IImageEncoder.cs" />
<Compile Include="ImageHelpers.cs" />
<Compile Include="ImageMagick\ImageMagickEncoder.cs" />
<Compile Include="ImageMagick\StripCollageBuilder.cs" />
<Compile Include="ImageProcessor.cs" />
<Compile Include="ImageMagick\PercentPlayedDrawer.cs" />
<Compile Include="ImageMagick\PlayedIndicatorDrawer.cs" />
<Compile Include="NullImageEncoder.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ImageMagick\UnplayedCountIndicator.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ImageMagick\fonts\robotoregular.ttf" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
@ -87,13 +60,8 @@
<Name>MediaBrowser.Model</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="GDI\empty.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.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">

View File

@ -21,8 +21,8 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Threading;
using TagLib;
using File = System.IO.File;
namespace Emby.Drawing
{
@ -65,7 +65,7 @@ namespace Emby.Drawing
IFileSystem fileSystem,
IJsonSerializer jsonSerializer,
IImageEncoder imageEncoder,
int maxConcurrentImageProcesses, Func<ILibraryManager> libraryManager)
int maxConcurrentImageProcesses, Func<ILibraryManager> libraryManager, ITimerFactory timerFactory)
{
_logger = logger;
_fileSystem = fileSystem;
@ -75,7 +75,7 @@ namespace Emby.Drawing
_appPaths = appPaths;
ImageEnhancers = new List<IImageEnhancer>();
_saveImageSizeTimer = new Timer(SaveImageSizeCallback, null, Timeout.Infinite, Timeout.Infinite);
_saveImageSizeTimer = timerFactory.Create(SaveImageSizeCallback, null, Timeout.Infinite, Timeout.Infinite);
Dictionary<Guid, ImageSize> sizeDictionary;
@ -89,7 +89,7 @@ namespace Emby.Drawing
// No biggie
sizeDictionary = new Dictionary<Guid, ImageSize>();
}
catch (DirectoryNotFoundException)
catch (IOException)
{
// No biggie
sizeDictionary = new Dictionary<Guid, ImageSize>();
@ -286,7 +286,7 @@ namespace Emby.Drawing
{
try
{
File.Copy(src, destination, true);
_fileSystem.CopyFile(src, destination, true);
}
catch
{
@ -600,7 +600,7 @@ namespace Emby.Drawing
return ImageHeader.GetDimensions(path, _logger, _fileSystem);
}
private readonly Timer _saveImageSizeTimer;
private readonly ITimer _saveImageSizeTimer;
private const int SaveImageSizeTimeout = 5000;
private readonly object _saveImageSizeLock = new object();
private void StartSaveImageSizeTimer()
@ -801,7 +801,7 @@ namespace Emby.Drawing
try
{
File.Copy(tmpPath, enhancedImagePath, true);
_fileSystem.CopyFile(tmpPath, enhancedImagePath, true);
}
catch
{

17
Emby.Drawing/project.json Normal file
View File

@ -0,0 +1,17 @@
{
"frameworks":{
"netstandard1.6":{
"dependencies":{
"NETStandard.Library":"1.6.0",
}
},
".NETPortable,Version=v4.5,Profile=Profile7":{
"buildOptions": {
"define": [ ]
},
"frameworkAssemblies":{
}
}
}
}

View File

@ -1,16 +1,16 @@
using MediaBrowser.Controller;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Server.Implementations.Persistence;
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Threading.Tasks;
using Emby.Server.Core.Data;
using MediaBrowser.Controller;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Activity
namespace Emby.Server.Core.Activity
{
public class ActivityRepository : BaseSqliteRepository, IActivityRepository
{

View File

@ -1,7 +1,4 @@
using Emby.Drawing;
using Emby.Drawing.GDI;
using Emby.Drawing.ImageMagick;
using MediaBrowser.Api;
using MediaBrowser.Api;
using MediaBrowser.Common;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
@ -48,19 +45,6 @@ using MediaBrowser.Model.Updates;
using MediaBrowser.Providers.Chapters;
using MediaBrowser.Providers.Manager;
using MediaBrowser.Providers.Subtitles;
using MediaBrowser.Server.Implementations;
using MediaBrowser.Server.Implementations.Activity;
using MediaBrowser.Server.Implementations.Configuration;
using MediaBrowser.Server.Implementations.Devices;
using MediaBrowser.Server.Implementations.HttpServer;
using MediaBrowser.Server.Implementations.IO;
using MediaBrowser.Server.Implementations.Notifications;
using MediaBrowser.Server.Implementations.Persistence;
using MediaBrowser.Server.Implementations.Security;
using MediaBrowser.Server.Implementations.Social;
using MediaBrowser.Server.Implementations.Sync;
using MediaBrowser.Server.Startup.Common.FFMpeg;
using MediaBrowser.Server.Startup.Common.Migrations;
using MediaBrowser.WebDashboard.Api;
using MediaBrowser.XbmcMetadata.Providers;
using System;
@ -72,11 +56,14 @@ using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using Emby.Common.Implementations;
using Emby.Common.Implementations.Archiving;
using Emby.Common.Implementations.Networking;
using Emby.Common.Implementations.Reflection;
using Emby.Common.Implementations.Serialization;
using Emby.Common.Implementations.TextEncoding;
using Emby.Common.Implementations.Updates;
using Emby.Common.Implementations.Xml;
@ -95,6 +82,19 @@ using Emby.Dlna.ContentDirectory;
using Emby.Dlna.Main;
using Emby.Dlna.MediaReceiverRegistrar;
using Emby.Dlna.Ssdp;
using Emby.Server.Core;
using Emby.Server.Core.Activity;
using Emby.Server.Core.Configuration;
using Emby.Server.Core.Data;
using Emby.Server.Core.Devices;
using Emby.Server.Core.FFMpeg;
using Emby.Server.Core.IO;
using Emby.Server.Core.Localization;
using Emby.Server.Core.Migrations;
using Emby.Server.Core.Notifications;
using Emby.Server.Core.Security;
using Emby.Server.Core.Social;
using Emby.Server.Core.Sync;
using Emby.Server.Implementations.Activity;
using Emby.Server.Implementations.Channels;
using Emby.Server.Implementations.Collections;
@ -103,6 +103,7 @@ using Emby.Server.Implementations.Devices;
using Emby.Server.Implementations.Dto;
using Emby.Server.Implementations.EntryPoints;
using Emby.Server.Implementations.FileOrganization;
using Emby.Server.Implementations.HttpServer;
using Emby.Server.Implementations.HttpServer.Security;
using Emby.Server.Implementations.Library;
using Emby.Server.Implementations.LiveTv;
@ -130,13 +131,13 @@ using MediaBrowser.Model.Services;
using MediaBrowser.Model.Social;
using MediaBrowser.Model.Text;
using MediaBrowser.Model.Xml;
using MediaBrowser.Server.Implementations.Archiving;
using MediaBrowser.Server.Implementations.Serialization;
using OpenSubtitlesHandler;
using ServiceStack;
using SocketHttpListener.Primitives;
using StringExtensions = MediaBrowser.Controller.Extensions.StringExtensions;
using Emby.Drawing;
namespace MediaBrowser.Server.Startup.Common
namespace Emby.Server.Core
{
/// <summary>
/// Class CompositionRoot
@ -262,6 +263,10 @@ namespace MediaBrowser.Server.Startup.Common
internal INativeApp NativeApp { get; set; }
internal IPowerManagement PowerManagement { get; private set; }
internal IImageEncoder ImageEncoder { get; private set; }
private readonly Action<string, string> _certificateGenerator;
private readonly Func<string> _defaultUserNameFactory;
/// <summary>
/// Initializes a new instance of the <see cref="ApplicationHost" /> class.
@ -272,14 +277,31 @@ namespace MediaBrowser.Server.Startup.Common
IFileSystem fileSystem,
INativeApp nativeApp,
IPowerManagement powerManagement,
string releaseAssetFilename)
: base(applicationPaths, logManager, fileSystem)
string releaseAssetFilename,
IEnvironmentInfo environmentInfo,
IImageEncoder imageEncoder,
ISystemEvents systemEvents,
IMemoryStreamFactory memoryStreamFactory,
INetworkManager networkManager,
Action<string, string> certificateGenerator,
Func<string> defaultUsernameFactory)
: base(applicationPaths,
logManager,
fileSystem,
environmentInfo,
systemEvents,
memoryStreamFactory,
networkManager)
{
_startupOptions = options;
_certificateGenerator = certificateGenerator;
_releaseAssetFilename = releaseAssetFilename;
_defaultUserNameFactory = defaultUsernameFactory;
NativeApp = nativeApp;
PowerManagement = powerManagement;
ImageEncoder = imageEncoder;
SetBaseExceptionMessage();
}
@ -292,15 +314,10 @@ namespace MediaBrowser.Server.Startup.Common
{
get
{
return _version ?? (_version = NativeApp.GetType().Assembly.GetName().Version);
return _version ?? (_version = GetAssembly(NativeApp.GetType()).GetName().Version);
}
}
public override string OperatingSystemDisplayName
{
get { return NativeApp.Environment.OperatingSystemVersionString; }
}
public override bool IsRunningAsService
{
get { return NativeApp.IsRunningAsService; }
@ -311,11 +328,6 @@ namespace MediaBrowser.Server.Startup.Common
get { return NativeApp.SupportsRunningAsService; }
}
public bool SupportsLibraryMonitor
{
get { return NativeApp.SupportsLibraryMonitor; }
}
/// <summary>
/// Gets the name.
/// </summary>
@ -328,6 +340,11 @@ namespace MediaBrowser.Server.Startup.Common
}
}
private Assembly GetAssembly(Type type)
{
return type.GetTypeInfo().Assembly;
}
/// <summary>
/// Gets a value indicating whether this instance can self restart.
/// </summary>
@ -412,21 +429,6 @@ namespace MediaBrowser.Server.Startup.Common
LogManager.RemoveConsoleOutput();
}
protected override IMemoryStreamFactory CreateMemoryStreamProvider()
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
return new RecyclableMemoryStreamProvider();
}
return new MemoryStreamProvider();
}
protected override ISystemEvents CreateSystemEvents()
{
return new SystemEvents(LogManager.GetLogger("SystemEvents"));
}
protected override IJsonSerializer CreateJsonSerializer()
{
try
@ -578,11 +580,11 @@ namespace MediaBrowser.Server.Startup.Common
UserRepository = await GetUserRepository().ConfigureAwait(false);
var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LogManager, JsonSerializer, ApplicationPaths, NativeApp.GetDbConnector(), MemoryStreamProvider);
var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LogManager, JsonSerializer, ApplicationPaths, NativeApp.GetDbConnector(), MemoryStreamFactory);
DisplayPreferencesRepository = displayPreferencesRepo;
RegisterSingleInstance(DisplayPreferencesRepository);
var itemRepo = new SqliteItemRepository(ServerConfigurationManager, JsonSerializer, LogManager, NativeApp.GetDbConnector(), MemoryStreamProvider);
var itemRepo = new SqliteItemRepository(ServerConfigurationManager, JsonSerializer, LogManager, NativeApp.GetDbConnector(), MemoryStreamFactory);
ItemRepository = itemRepo;
RegisterSingleInstance(ItemRepository);
@ -595,7 +597,7 @@ namespace MediaBrowser.Server.Startup.Common
SyncRepository = await GetSyncRepository().ConfigureAwait(false);
RegisterSingleInstance(SyncRepository);
UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer, FileSystemManager, CryptographyProvider, Environment.UserName);
UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer, FileSystemManager, CryptographyProvider, _defaultUserNameFactory());
RegisterSingleInstance(UserManager);
LibraryManager = new LibraryManager(Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager);
@ -607,17 +609,17 @@ namespace MediaBrowser.Server.Startup.Common
LibraryMonitor = new LibraryMonitor(LogManager, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, TimerFactory, SystemEvents, EnvironmentInfo);
RegisterSingleInstance(LibraryMonitor);
ProviderManager = new ProviderManager(HttpClient, ServerConfigurationManager, LibraryMonitor, LogManager, FileSystemManager, ApplicationPaths, () => LibraryManager, JsonSerializer, MemoryStreamProvider);
ProviderManager = new ProviderManager(HttpClient, ServerConfigurationManager, LibraryMonitor, LogManager, FileSystemManager, ApplicationPaths, () => LibraryManager, JsonSerializer, MemoryStreamFactory);
RegisterSingleInstance(ProviderManager);
RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LogManager, LibraryManager, UserManager));
HttpServer = ServerFactory.CreateServer(this, LogManager, ServerConfigurationManager, NetworkManager, MemoryStreamProvider, "Emby", "web/index.html", textEncoding, SocketFactory, CryptographyProvider, JsonSerializer, XmlSerializer);
HttpServer = HttpServerFactory.CreateServer(this, LogManager, ServerConfigurationManager, NetworkManager, MemoryStreamFactory, "Emby", "web/index.html", textEncoding, SocketFactory, CryptographyProvider, JsonSerializer, XmlSerializer, EnvironmentInfo, Certificate);
HttpServer.GlobalResponse = LocalizationManager.GetLocalizedString("StartupEmbyServerIsLoading");
RegisterSingleInstance(HttpServer, false);
progress.Report(10);
ServerManager = new ServerManager(this, JsonSerializer, LogManager.GetLogger("ServerManager"), ServerConfigurationManager, MemoryStreamProvider, textEncoding);
ServerManager = new ServerManager(this, JsonSerializer, LogManager.GetLogger("ServerManager"), ServerConfigurationManager, MemoryStreamFactory, textEncoding);
RegisterSingleInstance(ServerManager);
var innerProgress = new ActionableProgress<double>();
@ -629,7 +631,7 @@ namespace MediaBrowser.Server.Startup.Common
TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager, ServerConfigurationManager);
RegisterSingleInstance(TVSeriesManager);
SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder, FileSystemManager, () => SubtitleEncoder, ServerConfigurationManager, UserDataManager, () => MediaSourceManager, JsonSerializer, TaskManager, MemoryStreamProvider);
SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder, FileSystemManager, () => SubtitleEncoder, ServerConfigurationManager, UserDataManager, () => MediaSourceManager, JsonSerializer, TaskManager, MemoryStreamFactory);
RegisterSingleInstance(SyncManager);
DtoService = new DtoService(LogManager.GetLogger("DtoService"), LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, SyncManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager);
@ -717,7 +719,7 @@ namespace MediaBrowser.Server.Startup.Common
AuthService = new AuthService(UserManager, authContext, ServerConfigurationManager, ConnectManager, SessionManager, DeviceManager);
RegisterSingleInstance<IAuthService>(AuthService);
SubtitleEncoder = new SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, MemoryStreamProvider, ProcessFactory, textEncoding);
SubtitleEncoder = new SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, MemoryStreamFactory, ProcessFactory, textEncoding);
RegisterSingleInstance(SubtitleEncoder);
await displayPreferencesRepo.Initialize().ConfigureAwait(false);
@ -735,6 +737,32 @@ namespace MediaBrowser.Server.Startup.Common
await ((UserManager)UserManager).Initialize().ConfigureAwait(false);
}
private ICertificate GetCertificate(string certificateLocation)
{
if (string.IsNullOrWhiteSpace(certificateLocation))
{
return null;
}
try
{
X509Certificate2 localCert = new X509Certificate2(certificateLocation);
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
if (!localCert.HasPrivateKey)
{
//throw new FileNotFoundException("Secure requested, no private key included", certificateLocation);
return null;
}
return new Certificate(localCert);
}
catch (Exception ex)
{
Logger.ErrorException("Error loading cert from {0}", ex, certificateLocation);
return null;
}
}
private IImageProcessor GetImageProcessor()
{
var maxConcurrentImageProcesses = Math.Max(Environment.ProcessorCount, 4);
@ -744,38 +772,7 @@ namespace MediaBrowser.Server.Startup.Common
int.TryParse(_startupOptions.GetOption("-imagethreads"), NumberStyles.Any, CultureInfo.InvariantCulture, out maxConcurrentImageProcesses);
}
return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, GetImageEncoder(), maxConcurrentImageProcesses, () => LibraryManager);
}
private IImageEncoder GetImageEncoder()
{
if (!_startupOptions.ContainsOption("-enablegdi"))
{
try
{
return new ImageMagickEncoder(LogManager.GetLogger("ImageMagick"), ApplicationPaths, HttpClient, FileSystemManager, ServerConfigurationManager);
}
catch
{
Logger.Error("Error loading ImageMagick. Will revert to GDI.");
}
}
try
{
return new GDIImageEncoder(FileSystemManager, LogManager.GetLogger("GDI"));
}
catch
{
Logger.Error("Error loading GDI. Will revert to NullImageEncoder.");
}
return new NullImageEncoder();
}
protected override INetworkManager CreateNetworkManager(ILogger logger)
{
return NativeApp.CreateNetworkManager(logger);
return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, ImageEncoder, maxConcurrentImageProcesses, () => LibraryManager, TimerFactory);
}
/// <summary>
@ -787,8 +784,8 @@ namespace MediaBrowser.Server.Startup.Common
string encoderPath = null;
string probePath = null;
var info = await new FFMpegLoader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment, NativeApp.GetFfmpegInstallInfo())
.GetFFMpegInfo(NativeApp.Environment, _startupOptions, progress).ConfigureAwait(false);
var info = await new FFMpegLoader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.GetFfmpegInstallInfo())
.GetFFMpegInfo(_startupOptions, progress).ConfigureAwait(false);
encoderPath = info.EncoderPath;
probePath = info.ProbePath;
@ -809,10 +806,11 @@ namespace MediaBrowser.Server.Startup.Common
() => SubtitleEncoder,
() => MediaSourceManager,
HttpClient,
ZipClient, MemoryStreamProvider,
ZipClient,
MemoryStreamFactory,
ProcessFactory,
Environment.Is64BitOperatingSystem ? (Environment.ProcessorCount > 2 ? 14000 : 20000) : 40000,
Environment.OSVersion.Platform == PlatformID.Win32NT);
(Environment.ProcessorCount > 2 ? 14000 : 40000),
EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows);
MediaEncoder = mediaEncoder;
RegisterSingleInstance(MediaEncoder);
@ -824,7 +822,7 @@ namespace MediaBrowser.Server.Startup.Common
/// <returns>Task{IUserRepository}.</returns>
private async Task<IUserRepository> GetUserRepository()
{
var repo = new SqliteUserRepository(LogManager, ApplicationPaths, JsonSerializer, NativeApp.GetDbConnector(), MemoryStreamProvider);
var repo = new SqliteUserRepository(LogManager, ApplicationPaths, JsonSerializer, NativeApp.GetDbConnector(), MemoryStreamFactory);
await repo.Initialize().ConfigureAwait(false);
@ -968,6 +966,7 @@ namespace MediaBrowser.Server.Startup.Common
}
private string CertificatePath { get; set; }
private ICertificate Certificate { get; set; }
private IEnumerable<string> GetUrlPrefixes()
{
@ -997,10 +996,11 @@ namespace MediaBrowser.Server.Startup.Common
private void StartServer()
{
CertificatePath = GetCertificatePath(true);
Certificate = GetCertificate(CertificatePath);
try
{
ServerManager.Start(GetUrlPrefixes(), CertificatePath);
ServerManager.Start(GetUrlPrefixes());
return;
}
catch (Exception ex)
@ -1017,7 +1017,7 @@ namespace MediaBrowser.Server.Startup.Common
try
{
ServerManager.Start(GetUrlPrefixes(), CertificatePath);
ServerManager.Start(GetUrlPrefixes());
}
catch (Exception ex)
{
@ -1047,7 +1047,7 @@ namespace MediaBrowser.Server.Startup.Common
try
{
NetworkManager.GenerateSelfSignedSslCertificate(certPath, certHost);
_certificateGenerator(certPath, certHost);
}
catch (Exception ex)
{
@ -1158,51 +1158,51 @@ namespace MediaBrowser.Server.Startup.Common
// This will prevent the .dll file from getting locked, and allow us to replace it when needed
// Include composable parts in the Api assembly
list.Add(typeof(ApiEntryPoint).Assembly);
list.Add(GetAssembly(typeof(ApiEntryPoint)));
// Include composable parts in the Dashboard assembly
list.Add(typeof(DashboardService).Assembly);
list.Add(GetAssembly(typeof(DashboardService)));
// Include composable parts in the Model assembly
list.Add(typeof(SystemInfo).Assembly);
list.Add(GetAssembly(typeof(SystemInfo)));
// Include composable parts in the Common assembly
list.Add(typeof(IApplicationHost).Assembly);
list.Add(GetAssembly(typeof(IApplicationHost)));
// Include composable parts in the Controller assembly
list.Add(typeof(IServerApplicationHost).Assembly);
list.Add(GetAssembly(typeof(IServerApplicationHost)));
// Include composable parts in the Providers assembly
list.Add(typeof(ProviderUtils).Assembly);
list.Add(GetAssembly(typeof(ProviderUtils)));
// Include composable parts in the Photos assembly
list.Add(typeof(PhotoProvider).Assembly);
list.Add(GetAssembly(typeof(PhotoProvider)));
// Common implementations
list.Add(typeof(TaskManager).Assembly);
// MediaBrowser.Server implementations
list.Add(typeof(ServerApplicationPaths).Assembly);
list.Add(GetAssembly(typeof(TaskManager)));
// Emby.Server implementations
list.Add(typeof(InstallationManager).Assembly);
list.Add(GetAssembly(typeof(InstallationManager)));
// Emby.Server.Core
list.Add(GetAssembly(typeof(ServerApplicationPaths)));
// MediaEncoding
list.Add(typeof(MediaEncoder).Assembly);
list.Add(GetAssembly(typeof(MediaEncoder)));
// Dlna
list.Add(typeof(DlnaEntryPoint).Assembly);
list.Add(GetAssembly(typeof(DlnaEntryPoint)));
// Local metadata
list.Add(typeof(BoxSetXmlSaver).Assembly);
list.Add(GetAssembly(typeof(BoxSetXmlSaver)));
// Xbmc
list.Add(typeof(ArtistNfoProvider).Assembly);
list.Add(GetAssembly(typeof(ArtistNfoProvider)));
list.AddRange(NativeApp.GetAssembliesWithParts());
// Include composable parts in the running assembly
list.Add(GetType().Assembly);
list.Add(GetAssembly(GetType()));
return list;
}
@ -1267,7 +1267,7 @@ namespace MediaBrowser.Server.Startup.Common
HttpServerPortNumber = HttpPort,
SupportsHttps = SupportsHttps,
HttpsPortNumber = HttpsPort,
OperatingSystem = NativeApp.Environment.OperatingSystem.ToString(),
OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
OperatingSystemDisplayName = OperatingSystemDisplayName,
CanSelfRestart = CanSelfRestart,
CanSelfUpdate = CanSelfUpdate,
@ -1279,9 +1279,9 @@ namespace MediaBrowser.Server.Startup.Common
SupportsRunningAsService = SupportsRunningAsService,
ServerName = FriendlyName,
LocalAddress = localAddress,
SupportsLibraryMonitor = SupportsLibraryMonitor,
SupportsLibraryMonitor = true,
EncoderLocationType = MediaEncoder.EncoderLocationType,
SystemArchitecture = NativeApp.Environment.SystemArchitecture,
SystemArchitecture = EnvironmentInfo.SystemArchitecture,
SystemUpdateLevel = ConfigurationManager.CommonConfiguration.SystemUpdateLevel,
PackageName = _startupOptions.GetOption("-package")
};
@ -1297,7 +1297,7 @@ namespace MediaBrowser.Server.Startup.Common
public bool SupportsHttps
{
get { return !string.IsNullOrWhiteSpace(HttpServer.CertificatePath); }
get { return Certificate != null; }
}
public async Task<string> GetLocalApiUrl()

View File

@ -1,7 +1,7 @@
using MediaBrowser.Controller;
using System;
namespace MediaBrowser.Server.Startup.Common.Browser
namespace Emby.Server.Core.Browser
{
/// <summary>
/// Class BrowserLauncher

View File

@ -1,7 +1,10 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Emby.Common.Implementations.Configuration;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
using Emby.Common.Implementations.Configuration;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
@ -10,16 +13,11 @@ using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System.IO;
using System.Linq;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Implementations.Configuration
namespace Emby.Server.Core.Configuration
{
/// <summary>
/// Class ServerConfigurationManager

View File

@ -1,10 +1,10 @@
using MediaBrowser.Model.Logging;
using System;
using System;
using System.Data;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
public abstract class BaseSqliteRepository : IDisposable
{

View File

@ -1,15 +1,14 @@
using System.Text;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System;
using System.Data;
using System.IO;
using MediaBrowser.Common.IO;
using System.Text;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
static class DataExtensions
public static class DataExtensions
{
/// <summary>
/// Determines whether the specified conn is open.

View File

@ -1,7 +1,7 @@
using System.Data;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
public interface IDbConnector
{

View File

@ -3,7 +3,7 @@ using System.Data;
using System.Text;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
public class MediaStreamColumns
{

View File

@ -1,19 +1,18 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
/// <summary>
/// Class SQLiteDisplayPreferencesRepository

View File

@ -1,9 +1,4 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.FileOrganization;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
@ -11,8 +6,13 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.FileOrganization;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
public class SqliteFileOrganizationRepository : BaseSqliteRepository, IFileOrganizationRepository, IDisposable
{

View File

@ -1,13 +1,3 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
using System.Data;
@ -18,21 +8,28 @@ using System.Runtime.Serialization;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Collections;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Server.Implementations.Devices;
using MediaBrowser.Server.Implementations.Playlists;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
/// <summary>
/// Class SQLiteItemRepository

View File

@ -1,8 +1,4 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Logging;
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
@ -10,8 +6,12 @@ using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
public class SqliteUserDataRepository : BaseSqliteRepository, IUserDataRepository
{

View File

@ -1,18 +1,17 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
/// <summary>
/// Class SQLiteUserRepository

View File

@ -2,7 +2,7 @@
using System.Collections.Concurrent;
using System.Linq;
namespace MediaBrowser.Server.Implementations.Persistence
namespace Emby.Server.Core.Data
{
/// <summary>
/// Class TypeMapper

View File

@ -1,20 +1,18 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Model.Devices;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Model.Devices;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Server.Implementations.Devices
namespace Emby.Server.Core.Devices
{
public class DeviceRepository : IDeviceRepository
{

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>65aa7d67-8059-40cd-91f1-16d02687226c</ProjectGuid>
<RootNamespace>Emby.Server.Core</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceStack\ServiceStack.csproj" />
<ProjectReference Include="..\Emby.Drawing\Emby.Drawing.csproj" />
<ProjectReference Include="..\Emby.Photos\Emby.Photos.csproj" />
<ProjectReference Include="..\MediaBrowser.Api\MediaBrowser.Api.csproj" />
<ProjectReference Include="..\MediaBrowser.XbmcMetadata\MediaBrowser.XbmcMetadata.csproj" />
<ProjectReference Include="..\MediaBrowser.LocalMetadata\MediaBrowser.LocalMetadata.csproj" />
<ProjectReference Include="..\MediaBrowser.WebDashboard\MediaBrowser.WebDashboard.csproj" />
<ProjectReference Include="..\MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj" />
<ProjectReference Include="..\Emby.Dlna\Emby.Dlna.csproj" />
<ProjectReference Include="..\Emby.Server.Implementations\Emby.Server.Implementations.csproj" />
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -1,19 +1,18 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging;
using Mono.Nat;
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Threading;
using Mono.Nat;
namespace MediaBrowser.Server.Implementations.EntryPoints
namespace Emby.Server.Core.EntryPoints
{
public class ExternalPortForwarding : IServerEntryPoint
{

View File

@ -1,9 +1,9 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Startup.Common.Browser;
using Emby.Server.Core.Browser;
namespace MediaBrowser.Server.Startup.Common.EntryPoints
namespace Emby.Server.Core.EntryPoints
{
/// <summary>
/// Class StartupWizard

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Server.Startup.Common.FFMpeg
namespace Emby.Server.Core.FFMpeg
{
/// <summary>
/// Class FFMpegInfo

View File

@ -1,5 +1,5 @@

namespace MediaBrowser.Server.Startup.Common.FFMpeg
namespace Emby.Server.Core.FFMpeg
{
public class FFMpegInstallInfo
{

View File

@ -2,18 +2,16 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using Mono.Unix.Native;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using Emby.Server.Core;
using Emby.Server.Core.FFMpeg;
namespace MediaBrowser.Server.Startup.Common.FFMpeg
namespace Emby.Server.Core.FFMpeg
{
public class FFMpegLoader
{
@ -22,21 +20,19 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
private readonly ILogger _logger;
private readonly IZipClient _zipClient;
private readonly IFileSystem _fileSystem;
private readonly NativeEnvironment _environment;
private readonly FFMpegInstallInfo _ffmpegInstallInfo;
public FFMpegLoader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem, NativeEnvironment environment, FFMpegInstallInfo ffmpegInstallInfo)
public FFMpegLoader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem, FFMpegInstallInfo ffmpegInstallInfo)
{
_logger = logger;
_appPaths = appPaths;
_httpClient = httpClient;
_zipClient = zipClient;
_fileSystem = fileSystem;
_environment = environment;
_ffmpegInstallInfo = ffmpegInstallInfo;
}
public async Task<FFMpegInfo> GetFFMpegInfo(NativeEnvironment environment, StartupOptions options, IProgress<double> progress)
public async Task<FFMpegInfo> GetFFMpegInfo(StartupOptions options, IProgress<double> progress)
{
var customffMpegPath = options.GetOption("-ffmpeg");
var customffProbePath = options.GetOption("-ffprobe");
@ -211,13 +207,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
private void SetFilePermissions(string path)
{
// Linux: File permission to 666, and user's execute bit
if (_environment.OperatingSystem == OperatingSystem.Bsd || _environment.OperatingSystem == OperatingSystem.Linux || _environment.OperatingSystem == OperatingSystem.Osx)
{
_logger.Info("Syscall.chmod {0} FilePermissions.DEFFILEMODE | FilePermissions.S_IRWXU | FilePermissions.S_IXGRP | FilePermissions.S_IXOTH", path);
Syscall.chmod(path, FilePermissions.DEFFILEMODE | FilePermissions.S_IRWXU | FilePermissions.S_IXGRP | FilePermissions.S_IXOTH);
}
_fileSystem.SetExecutable(path);
}
private void ExtractArchive(FFMpegInstallInfo downloadinfo, string archivePath, string targetPath)

View File

@ -0,0 +1,107 @@
using System;
using System.IO;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Emby.Common.Implementations.Net;
using Emby.Server.Implementations.HttpServer;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Text;
using ServiceStack.Text.Jsv;
using SocketHttpListener.Primitives;
namespace Emby.Server.Core
{
/// <summary>
/// Class ServerFactory
/// </summary>
public static class HttpServerFactory
{
/// <summary>
/// Creates the server.
/// </summary>
/// <returns>IHttpServer.</returns>
public static IHttpServer CreateServer(IServerApplicationHost applicationHost,
ILogManager logManager,
IServerConfigurationManager config,
INetworkManager networkmanager,
IMemoryStreamFactory streamProvider,
string serverName,
string defaultRedirectpath,
ITextEncoding textEncoding,
ISocketFactory socketFactory,
ICryptoProvider cryptoProvider,
IJsonSerializer json,
IXmlSerializer xml,
IEnvironmentInfo environment,
ICertificate certificate)
{
var logger = logManager.GetLogger("HttpServer");
return new HttpListenerHost(applicationHost,
logger,
config,
serverName,
defaultRedirectpath,
networkmanager,
streamProvider,
textEncoding,
socketFactory,
cryptoProvider,
json,
xml,
environment,
certificate,
new StreamFactory(),
GetParseFn);
}
private static Func<string, object> GetParseFn(Type propertyType)
{
return s => JsvReader.GetParseFn(propertyType)(s);
}
}
public class StreamFactory : IStreamFactory
{
public Stream CreateNetworkStream(ISocket socket, bool ownsSocket)
{
var netSocket = (NetSocket)socket;
return new NetworkStream(netSocket.Socket, ownsSocket);
}
public Task AuthenticateSslStreamAsServer(Stream stream, ICertificate certificate)
{
var sslStream = (SslStream)stream;
var cert = (Certificate)certificate;
return sslStream.AuthenticateAsServerAsync(cert.X509Certificate);
}
public Stream CreateSslStream(Stream innerStream, bool leaveInnerStreamOpen)
{
return new SslStream(innerStream, leaveInnerStreamOpen);
}
}
public class Certificate : ICertificate
{
public Certificate(X509Certificate x509Certificate)
{
X509Certificate = x509Certificate;
}
public X509Certificate X509Certificate { get; private set; }
}
}

View File

@ -2,10 +2,11 @@
using MediaBrowser.Model.Logging;
using System.Collections.Generic;
using System.Reflection;
using MediaBrowser.Server.Implementations.Persistence;
using MediaBrowser.Server.Startup.Common.FFMpeg;
using Emby.Server.Core;
using Emby.Server.Core.Data;
using Emby.Server.Core.FFMpeg;
namespace MediaBrowser.Server.Startup.Common
namespace Emby.Server.Core
{
public interface INativeApp
{
@ -18,18 +19,8 @@ namespace MediaBrowser.Server.Startup.Common
/// <summary>
/// Authorizes the server.
/// </summary>
/// <param name="udpPort">The UDP port.</param>
/// <param name="httpServerPort">The HTTP server port.</param>
/// <param name="httpsServerPort">The HTTPS server port.</param>
/// <param name="tempDirectory">The temporary directory.</param>
void AuthorizeServer(int udpPort, int httpServerPort, int httpsServerPort, string applicationPath, string tempDirectory);
/// <summary>
/// Gets the environment.
/// </summary>
/// <value>The environment.</value>
NativeEnvironment Environment { get; }
/// <summary>
/// Gets a value indicating whether [supports running as service].
/// </summary>
@ -54,12 +45,6 @@ namespace MediaBrowser.Server.Startup.Common
/// <value><c>true</c> if [supports autorun at startup]; otherwise, <c>false</c>.</value>
bool SupportsAutoRunAtStartup { get; }
/// <summary>
/// Gets a value indicating whether [supports library monitor].
/// </summary>
/// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value>
bool SupportsLibraryMonitor { get; }
/// <summary>
/// Gets a value indicating whether this instance can self update.
/// </summary>
@ -82,12 +67,6 @@ namespace MediaBrowser.Server.Startup.Common
/// <param name="autorun">if set to <c>true</c> [autorun].</param>
void ConfigureAutoRun(bool autorun);
/// <summary>
/// Gets the network manager.
/// </summary>
/// <returns>INetworkManager.</returns>
INetworkManager CreateNetworkManager(ILogger logger);
FFMpegInstallInfo GetFfmpegInstallInfo();
void LaunchUrl(string url);

View File

@ -1,25 +1,21 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Logging;
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Emby.Server.Implementations.IO;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.IO;
using MediaBrowser.Controller;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Threading;
using Emby.Server.Implementations.IO;
namespace MediaBrowser.Server.Implementations.IO
namespace Emby.Server.Core.IO
{
public class LibraryMonitor : ILibraryMonitor
{
@ -297,7 +293,7 @@ namespace MediaBrowser.Server.Implementations.IO
IncludeSubdirectories = true
};
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
if (_environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
{
newWatcher.InternalBufferSize = 32767;
}

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Emby.Server.Implementations.Localization;
namespace MediaBrowser.Server.Startup.Common
namespace Emby.Server.Core.Localization
{
public class TextLocalizer : ITextLocalizer
{

View File

@ -2,9 +2,9 @@
using Emby.Server.Implementations.Persistence;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.Persistence;
using Emby.Server.Core.Data;
namespace MediaBrowser.Server.Startup.Common.Migrations
namespace Emby.Server.Core.Migrations
{
public class DbMigration : IVersionMigration
{

View File

@ -1,6 +1,6 @@
using System.Threading.Tasks;
namespace MediaBrowser.Server.Startup.Common.Migrations
namespace Emby.Server.Core.Migrations
{
public interface IVersionMigration
{

View File

@ -10,7 +10,7 @@ using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Updates;
namespace MediaBrowser.Server.Startup.Common.Migrations
namespace Emby.Server.Core.Migrations
{
public class UpdateLevelMigration : IVersionMigration
{

View File

@ -1,17 +1,17 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Notifications;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Notifications;
using MediaBrowser.Server.Implementations.Persistence;
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Core.Data;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Notifications;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Notifications;
namespace MediaBrowser.Server.Implementations.Notifications
namespace Emby.Server.Core.Notifications
{
public class SqliteNotificationsRepository : BaseSqliteRepository, INotificationsRepository
{

View File

@ -0,0 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Emby.Server.Core")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("65aa7d67-8059-40cd-91f1-16d02687226c")]

View File

@ -1,17 +1,17 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Security;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Server.Implementations.Persistence;
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Core.Data;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Security;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Server.Implementations.Security
namespace Emby.Server.Core.Security
{
public class AuthenticationRepository : BaseSqliteRepository, IAuthenticationRepository
{

View File

@ -1,8 +1,8 @@
using Emby.Common.Implementations;
using System.IO;
using Emby.Common.Implementations;
using MediaBrowser.Controller;
using System.IO;
namespace MediaBrowser.Server.Implementations
namespace Emby.Server.Core
{
/// <summary>
/// Extends BaseApplicationPaths to add paths that are only applicable on the server

View File

@ -1,14 +1,14 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Social;
using MediaBrowser.Server.Implementations.Persistence;
using System;
using System;
using System.Data;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Core.Data;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Social;
namespace MediaBrowser.Server.Implementations.Social
namespace Emby.Server.Core.Social
{
public class SharingRepository : BaseSqliteRepository, ISharingRepository
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Server.Startup.Common
namespace Emby.Server.Core
{
public class StartupOptions
{

View File

@ -1,20 +1,20 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Sync;
using MediaBrowser.Server.Implementations.Persistence;
using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Emby.Server.Core.Data;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Sync;
namespace MediaBrowser.Server.Implementations.Sync
namespace Emby.Server.Core.Sync
{
public class SyncRepository : BaseSqliteRepository, ISyncRepository
{

View File

@ -3,7 +3,7 @@ using MediaBrowser.Model.Logging;
using System;
using System.IO;
namespace MediaBrowser.Server.Startup.Common
namespace Emby.Server.Core
{
public class UnhandledExceptionWriter
{

View File

@ -0,0 +1,131 @@
{
"version": "1.0.0-*",
"dependencies": {
},
"frameworks": {
"net46": {
"frameworkAssemblies": {
"System.Runtime": "4.0.0"
},
"dependencies": {
"MediaBrowser.Model": {
"target": "project"
},
"MediaBrowser.Common": {
"target": "project"
},
"MediaBrowser.Controller": {
"target": "project"
},
"Emby.Common.Implementations": {
"target": "project"
},
"Mono.Nat": {
"target": "project"
},
"Emby.Server.Implementations": {
"target": "project"
},
"MediaBrowser.Server.Implementations": {
"target": "project"
},
"Emby.Dlna": {
"target": "project"
},
"Emby.Photos": {
"target": "project"
},
"MediaBrowser.Api": {
"target": "project"
},
"MediaBrowser.MediaEncoding": {
"target": "project"
},
"MediaBrowser.XbmcMetadata": {
"target": "project"
},
"MediaBrowser.LocalMetadata": {
"target": "project"
},
"MediaBrowser.WebDashboard": {
"target": "project"
},
"Emby.Drawing": {
"target": "project"
},
"ServiceStack": {
"target": "project"
},
"SocketHttpListener.Portable": {
"target": "project"
}
}
},
"netstandard1.6": {
"imports": "dnxcore50",
"dependencies": {
"NETStandard.Library": "1.6.0",
"System.AppDomain": "2.0.11",
"System.Globalization.Extensions": "4.0.1",
"System.IO.FileSystem.Watcher": "4.0.0",
"System.Net.Security": "4.0.0",
"System.Security.Cryptography.X509Certificates": "4.1.0",
"System.Runtime.Extensions": "4.1.0",
"MediaBrowser.Model": {
"target": "project"
},
"MediaBrowser.Common": {
"target": "project"
},
"MediaBrowser.Controller": {
"target": "project"
},
"Emby.Common.Implementations": {
"target": "project"
},
"Mono.Nat": {
"target": "project"
},
"Emby.Server.Implementations": {
"target": "project"
},
"MediaBrowser.Server.Implementations": {
"target": "project"
},
"Emby.Dlna": {
"target": "project"
},
"Emby.Photos": {
"target": "project"
},
"MediaBrowser.Api": {
"target": "project"
},
"MediaBrowser.MediaEncoding": {
"target": "project"
},
"MediaBrowser.XbmcMetadata": {
"target": "project"
},
"MediaBrowser.LocalMetadata": {
"target": "project"
},
"MediaBrowser.WebDashboard": {
"target": "project"
},
"Emby.Drawing": {
"target": "project"
},
"SocketHttpListener.Portable": {
"target": "project"
},
"ServiceStack": {
"target": "project"
}
}
}
}
}

View File

@ -6,7 +6,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Controller.Collections;
using MediaBrowser.Controller.IO;
namespace MediaBrowser.Server.Implementations.Collections
namespace Emby.Server.Implementations.Collections
{
public class CollectionsDynamicFolder : IVirtualFolderCreator
{

View File

@ -0,0 +1,41 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Server.Implementations.Devices;
namespace Emby.Server.Implementations.Devices
{
public class CameraUploadsDynamicFolder : IVirtualFolderCreator
{
private readonly IApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
public CameraUploadsDynamicFolder(IApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
_fileSystem = fileSystem;
}
public BasePluginFolder GetFolder()
{
var path = Path.Combine(_appPaths.DataPath, "camerauploads");
_fileSystem.CreateDirectory(path);
return new CameraUploadsFolder
{
Path = path
};
}
}
}

View File

@ -43,11 +43,13 @@
<Compile Include="Channels\RefreshChannelsScheduledTask.cs" />
<Compile Include="Collections\CollectionImageProvider.cs" />
<Compile Include="Collections\CollectionManager.cs" />
<Compile Include="Collections\CollectionsDynamicFolder.cs" />
<Compile Include="Connect\ConnectData.cs" />
<Compile Include="Connect\ConnectEntryPoint.cs" />
<Compile Include="Connect\ConnectManager.cs" />
<Compile Include="Connect\Responses.cs" />
<Compile Include="Connect\Validator.cs" />
<Compile Include="Devices\CameraUploadsDynamicFolder.cs" />
<Compile Include="Devices\DeviceManager.cs" />
<Compile Include="Dto\DtoService.cs" />
<Compile Include="EntryPoints\AutomaticRestartEntryPoint.cs" />
@ -69,6 +71,8 @@
<Compile Include="FileOrganization\OrganizerScheduledTask.cs" />
<Compile Include="FileOrganization\TvFolderOrganizer.cs" />
<Compile Include="HttpServer\GetSwaggerResource.cs" />
<Compile Include="HttpServer\HttpListenerHost.cs" />
<Compile Include="HttpServer\HttpResultFactory.cs" />
<Compile Include="HttpServer\LoggerUtils.cs" />
<Compile Include="HttpServer\RangeRequestWriter.cs" />
<Compile Include="HttpServer\ResponseFilter.cs" />
@ -78,14 +82,17 @@
<Compile Include="HttpServer\Security\AuthorizationContext.cs" />
<Compile Include="HttpServer\Security\AuthService.cs" />
<Compile Include="HttpServer\Security\SessionContext.cs" />
<Compile Include="HttpServer\SocketSharp\RequestMono.cs" />
<Compile Include="HttpServer\SocketSharp\SharpWebSocket.cs" />
<Compile Include="HttpServer\SocketSharp\WebSocketSharpListener.cs" />
<Compile Include="HttpServer\SocketSharp\WebSocketSharpRequest.cs" />
<Compile Include="HttpServer\SocketSharp\WebSocketSharpResponse.cs" />
<Compile Include="HttpServer\StreamWriter.cs" />
<Compile Include="HttpServer\SwaggerService.cs" />
<Compile Include="Images\BaseDynamicImageProvider.cs" />
<Compile Include="Intros\DefaultIntroProvider.cs" />
<Compile Include="IO\FileRefresher.cs" />
<Compile Include="IO\MbLinkShortcutHandler.cs" />
<Compile Include="IO\ThrottledStream.cs" />
<Compile Include="Library\CoreResolutionIgnoreRule.cs" />
<Compile Include="Library\LibraryManager.cs" />
@ -156,7 +163,6 @@
<Compile Include="LiveTv\TunerHosts\MulticastStream.cs" />
<Compile Include="LiveTv\TunerHosts\QueueStream.cs" />
<Compile Include="Localization\LocalizationManager.cs" />
<Compile Include="Logging\PatternsLogger.cs" />
<Compile Include="MediaEncoder\EncodingManager.cs" />
<Compile Include="News\NewsEntryPoint.cs" />
<Compile Include="News\NewsService.cs" />
@ -171,6 +177,7 @@
<Compile Include="Photos\PhotoAlbumImageProvider.cs" />
<Compile Include="Playlists\PlaylistImageProvider.cs" />
<Compile Include="Playlists\PlaylistManager.cs" />
<Compile Include="Playlists\PlaylistsDynamicFolder.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScheduledTasks\ChapterImagesTask.cs" />
<Compile Include="ScheduledTasks\PeopleValidationTask.cs" />
@ -263,135 +270,32 @@
<Project>{442b5058-dcaf-4263-bb6a-f21e31120a1b}</Project>
<Name>MediaBrowser.Providers</Name>
</ProjectReference>
<Reference Include="SocketHttpListener.Portable">
<HintPath>..\ThirdParty\emby\SocketHttpListener.Portable.dll</HintPath>
<ProjectReference Include="..\MediaBrowser.Server.Implementations\MediaBrowser.Server.Implementations.csproj">
<Project>{2e781478-814d-4a48-9d80-bff206441a65}</Project>
<Name>MediaBrowser.Server.Implementations</Name>
</ProjectReference>
<ProjectReference Include="..\ServiceStack\ServiceStack.csproj">
<Project>{680a1709-25eb-4d52-a87f-ee03ffd94baa}</Project>
<Name>ServiceStack</Name>
</ProjectReference>
<ProjectReference Include="..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj">
<Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
<Name>SocketHttpListener.Portable</Name>
</ProjectReference>
<Reference Include="Emby.XmlTv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Emby.XmlTv.1.0.1\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MediaBrowser.Naming, Version=1.0.6159.25070, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Naming.1.0.2\lib\portable-net45+win8\MediaBrowser.Naming.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="UniversalDetector, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UniversalDetector.1.0.1\lib\portable-net45+sl4+wp71+win8+wpa81\UniversalDetector.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Emby.XmlTv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Emby.XmlTv.1.0.0.63\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MediaBrowser.Naming, Version=1.0.6151.30291, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.59\lib\portable-net45+win8\MediaBrowser.Naming.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Patterns.Logging, Version=1.0.6151.30227, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Patterns.Logging.1.0.0.6\lib\portable-net45+win8\Patterns.Logging.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\backbone-min.js">
<Link>swagger-ui\lib\backbone-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\handlebars-2.0.0.js">
<Link>swagger-ui\lib\handlebars-2.0.0.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\highlight.7.3.pack.js">
<Link>swagger-ui\lib\highlight.7.3.pack.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery-1.8.0.min.js">
<Link>swagger-ui\lib\jquery-1.8.0.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.ba-bbq.min.js">
<Link>swagger-ui\lib\jquery.ba-bbq.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.slideto.min.js">
<Link>swagger-ui\lib\jquery.slideto.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.wiggle.min.js">
<Link>swagger-ui\lib\jquery.wiggle.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\marked.js">
<Link>swagger-ui\lib\marked.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\shred.bundle.js">
<Link>swagger-ui\lib\shred.bundle.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\swagger-client.js">
<Link>swagger-ui\lib\swagger-client.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\swagger-oauth.js">
<Link>swagger-ui\lib\swagger-oauth.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\underscore-min.js">
<Link>swagger-ui\lib\underscore-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\o2c.html">
<Link>swagger-ui\o2c.html</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\patch.js">
<Link>swagger-ui\patch.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\swagger-ui.js">
<Link>swagger-ui\swagger-ui.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\swagger-ui.min.js">
<Link>swagger-ui\swagger-ui.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.eot">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.eot</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.ttf">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.ttf</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.woff">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.woff</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.woff2">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.woff2</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.eot">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.eot</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.ttf">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.ttf</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.woff">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.woff</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.woff2">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.woff2</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\reset.css">
<Link>swagger-ui\css\reset.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\screen.css">
<Link>swagger-ui\css\screen.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\typography.css">
<Link>swagger-ui\css\typography.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="Localization\Core\ar.json" />
<EmbeddedResource Include="Localization\Core\bg-BG.json" />
<EmbeddedResource Include="Localization\Core\ca.json" />

View File

@ -15,7 +15,6 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.Library;
using Emby.Server.Implementations.Logging;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.IO;
@ -71,7 +70,7 @@ namespace Emby.Server.Implementations.FileOrganization
}
var namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions();
var resolver = new EpisodeResolver(namingOptions, new PatternsLogger());
var resolver = new EpisodeResolver(namingOptions, new NullLogger());
var episodeInfo = resolver.Resolve(path, false) ??
new MediaBrowser.Naming.TV.EpisodeInfo();

View File

@ -2,20 +2,14 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Implementations.HttpServer.SocketSharp;
using ServiceStack;
using ServiceStack.Host;
using ServiceStack.Web;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Security;
using System.Net.Sockets;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Emby.Common.Implementations.Net;
using Emby.Server.Implementations.HttpServer;
using Emby.Server.Implementations.HttpServer.SocketSharp;
using MediaBrowser.Common.Net;
@ -27,11 +21,12 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Text;
using SocketHttpListener.Net;
using SocketHttpListener.Primitives;
namespace MediaBrowser.Server.Implementations.HttpServer
namespace Emby.Server.Implementations.HttpServer
{
public class HttpListenerHost : ServiceStackHost, IHttpServer
{
@ -47,8 +42,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
public event EventHandler<WebSocketConnectEventArgs> WebSocketConnected;
public event EventHandler<WebSocketConnectingEventArgs> WebSocketConnecting;
public string CertificatePath { get; private set; }
private readonly IServerConfigurationManager _config;
private readonly INetworkManager _networkManager;
private readonly IMemoryStreamFactory _memoryStreamProvider;
@ -61,13 +54,17 @@ namespace MediaBrowser.Server.Implementations.HttpServer
private readonly IJsonSerializer _jsonSerializer;
private readonly IXmlSerializer _xmlSerializer;
private readonly ICertificate _certificate;
private readonly IEnvironmentInfo _environment;
private readonly IStreamFactory _streamFactory;
private readonly Func<Type, Func<string, object>> _funcParseFn;
public HttpListenerHost(IServerApplicationHost applicationHost,
ILogManager logManager,
ILogger logger,
IServerConfigurationManager config,
string serviceName,
string defaultRedirectPath, INetworkManager networkManager, IMemoryStreamFactory memoryStreamProvider, ITextEncoding textEncoding, ISocketFactory socketFactory, ICryptoProvider cryptoProvider, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer)
: base(serviceName, new Assembly[] { })
string defaultRedirectPath, INetworkManager networkManager, IMemoryStreamFactory memoryStreamProvider, ITextEncoding textEncoding, ISocketFactory socketFactory, ICryptoProvider cryptoProvider, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer, IEnvironmentInfo environment, ICertificate certificate, IStreamFactory streamFactory, Func<Type, Func<string, object>> funcParseFn)
: base(serviceName)
{
_appHost = applicationHost;
DefaultRedirectPath = defaultRedirectPath;
@ -78,28 +75,29 @@ namespace MediaBrowser.Server.Implementations.HttpServer
_cryptoProvider = cryptoProvider;
_jsonSerializer = jsonSerializer;
_xmlSerializer = xmlSerializer;
_environment = environment;
_certificate = certificate;
_streamFactory = streamFactory;
_funcParseFn = funcParseFn;
_config = config;
_logger = logManager.GetLogger("HttpServer");
_logger = logger;
}
public string GlobalResponse { get; set; }
public override void Configure()
{
HostConfig.Instance.DefaultRedirectPath = DefaultRedirectPath;
HostConfig.Instance.MapExceptionToStatusCode = new Dictionary<Type, int>
var mapExceptionToStatusCode = new Dictionary<Type, int>
{
{typeof (InvalidOperationException), 500},
{typeof (NotImplementedException), 500},
{typeof (ResourceNotFoundException), 404},
{typeof (FileNotFoundException), 404},
{typeof (DirectoryNotFoundException), 404},
//{typeof (DirectoryNotFoundException), 404},
{typeof (SecurityException), 401},
{typeof (PaymentRequiredException), 402},
{typeof (UnauthorizedAccessException), 500},
{typeof (ApplicationException), 500},
{typeof (PlatformNotSupportedException), 500},
{typeof (NotSupportedException), 500}
};
@ -136,18 +134,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
return _appHost.CreateInstance(type);
}
public override void OnConfigLoad()
{
base.OnConfigLoad();
Config.HandlerFactoryPath = null;
}
protected override ServiceController CreateServiceController(params Assembly[] assembliesWithServices)
protected override ServiceController CreateServiceController()
{
var types = _restServices.Select(r => r.GetType()).ToArray();
return new ServiceController(this, () => types);
return new ServiceController(() => types);
}
public override ServiceStackHost Start(string listeningAtUrlBase)
@ -161,7 +152,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// </summary>
private void StartListener()
{
HostContext.Config.HandlerFactoryPath = GetHandlerPathIfAny(UrlPrefixes.First());
WebSocketSharpRequest.HandlerFactoryPath = GetHandlerPathIfAny(UrlPrefixes.First());
_listener = GetListener();
@ -187,34 +178,18 @@ namespace MediaBrowser.Server.Implementations.HttpServer
private IHttpListener GetListener()
{
var cert = !string.IsNullOrWhiteSpace(CertificatePath) && File.Exists(CertificatePath)
? GetCert(CertificatePath) :
null;
var enableDualMode = _environment.OperatingSystem == OperatingSystem.Windows;
var enableDualMode = Environment.OSVersion.Platform == PlatformID.Win32NT;
return new WebSocketSharpListener(_logger, cert, _memoryStreamProvider, _textEncoding, _networkManager, _socketFactory, _cryptoProvider, new StreamFactory(), enableDualMode, GetRequest);
}
public ICertificate GetCert(string certificateLocation)
{
try
{
X509Certificate2 localCert = new X509Certificate2(certificateLocation);
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
if (localCert.PrivateKey == null)
{
//throw new FileNotFoundException("Secure requested, no private key included", certificateLocation);
return null;
}
return new Certificate(localCert);
}
catch (Exception ex)
{
Logger.ErrorException("Error loading cert from {0}", ex, certificateLocation);
return null;
}
return new WebSocketSharpListener(_logger,
_certificate,
_memoryStreamProvider,
_textEncoding,
_networkManager,
_socketFactory,
_cryptoProvider,
_streamFactory,
enableDualMode,
GetRequest);
}
private IHttpRequest GetRequest(HttpListenerContext httpContext)
@ -328,7 +303,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
// this gets all the query string key value pairs as a collection
var newQueryString = MyHttpUtility.ParseQueryString(uri.Query);
if (newQueryString.Count == 0)
var originalCount = newQueryString.Count;
if (originalCount == 0)
{
return url;
}
@ -336,8 +313,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer
// this removes the key if exists
newQueryString.Remove(key);
if (originalCount == newQueryString.Count)
{
return url;
}
// this gets the page path from root without QueryString
string pagePathWithoutQueryString = uri.GetLeftPart(UriPartial.Path);
string pagePathWithoutQueryString = url.Split(new[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0];
return newQueryString.Count > 0
? String.Format("{0}?{1}", pagePathWithoutQueryString, newQueryString)
@ -578,28 +560,28 @@ namespace MediaBrowser.Server.Implementations.HttpServer
base.Init();
}
public override Model.Services.RouteAttribute[] GetRouteAttributes(Type requestType)
public override RouteAttribute[] GetRouteAttributes(Type requestType)
{
var routes = base.GetRouteAttributes(requestType).ToList();
var clone = routes.ToList();
foreach (var route in clone)
{
routes.Add(new Model.Services.RouteAttribute(NormalizeEmbyRoutePath(route.Path), route.Verbs)
routes.Add(new RouteAttribute(NormalizeEmbyRoutePath(route.Path), route.Verbs)
{
Notes = route.Notes,
Priority = route.Priority,
Summary = route.Summary
});
routes.Add(new Model.Services.RouteAttribute(NormalizeRoutePath(route.Path), route.Verbs)
routes.Add(new RouteAttribute(NormalizeRoutePath(route.Path), route.Verbs)
{
Notes = route.Notes,
Priority = route.Priority,
Summary = route.Summary
});
routes.Add(new Model.Services.RouteAttribute(DoubleNormalizeEmbyRoutePath(route.Path), route.Verbs)
routes.Add(new RouteAttribute(DoubleNormalizeEmbyRoutePath(route.Path), route.Verbs)
{
Notes = route.Notes,
Priority = route.Priority,
@ -610,6 +592,38 @@ namespace MediaBrowser.Server.Implementations.HttpServer
return routes.ToArray();
}
public override object GetTaskResult(Task task, string requestName)
{
try
{
var taskObject = task as Task<object>;
if (taskObject != null)
{
return taskObject.Result;
}
task.Wait();
var type = task.GetType().GetTypeInfo();
if (!type.IsGenericType)
{
return null;
}
Logger.Warn("Getting task result from " + requestName + " using reflection. For better performance have your api return Task<object>");
return type.GetDeclaredProperty("Result").GetValue(task);
}
catch (TypeAccessException)
{
return null; //return null for void Task's
}
}
public override Func<string, object> GetParseFn(Type propertyType)
{
return _funcParseFn(propertyType);
}
public override void SerializeToJson(object o, Stream stream)
{
_jsonSerializer.SerializeToStream(o, stream);
@ -687,44 +701,10 @@ namespace MediaBrowser.Server.Implementations.HttpServer
GC.SuppressFinalize(this);
}
public void StartServer(IEnumerable<string> urlPrefixes, string certificatePath)
public void StartServer(IEnumerable<string> urlPrefixes)
{
CertificatePath = certificatePath;
UrlPrefixes = urlPrefixes.ToList();
Start(UrlPrefixes.First());
}
}
public class StreamFactory : IStreamFactory
{
public Stream CreateNetworkStream(ISocket socket, bool ownsSocket)
{
var netSocket = (NetSocket)socket;
return new NetworkStream(netSocket.Socket, ownsSocket);
}
public Task AuthenticateSslStreamAsServer(Stream stream, ICertificate certificate)
{
var sslStream = (SslStream)stream;
var cert = (Certificate)certificate;
return sslStream.AuthenticateAsServerAsync(cert.X509Certificate);
}
public Stream CreateSslStream(Stream innerStream, bool leaveInnerStreamOpen)
{
return new SslStream(innerStream, leaveInnerStreamOpen);
}
}
public class Certificate : ICertificate
{
public Certificate(X509Certificate x509Certificate)
{
X509Certificate = x509Certificate;
}
public X509Certificate X509Certificate { get; private set; }
}
}

View File

@ -21,7 +21,7 @@ using IRequest = MediaBrowser.Model.Services.IRequest;
using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
using StreamWriter = Emby.Server.Implementations.HttpServer.StreamWriter;
namespace MediaBrowser.Server.Implementations.HttpServer
namespace Emby.Server.Implementations.HttpServer
{
/// <summary>
/// Class HttpResultFactory
@ -161,13 +161,16 @@ namespace MediaBrowser.Server.Implementations.HttpServer
public static string GetCompressionType(IRequest request)
{
var prefs = new RequestPreferences(request);
var acceptEncoding = request.Headers["Accept-Encoding"];
if (prefs.AcceptsDeflate)
if (!string.IsNullOrWhiteSpace(acceptEncoding))
{
if (acceptEncoding.Contains("deflate"))
return "deflate";
if (prefs.AcceptsGzip)
if (acceptEncoding.Contains("gzip"))
return "gzip";
}
return null;
}
@ -187,14 +190,16 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (compressionType == null)
{
var contentType = request.ResponseContentType;
var contentTypeAttr = ContentFormat.GetEndpointAttributes(contentType);
switch (contentTypeAttr)
switch (GetRealContentType(contentType))
{
case RequestAttributes.Xml:
case "application/xml":
case "text/xml":
case "text/xml; charset=utf-8": //"text/xml; charset=utf-8" also matches xml
return SerializeToXmlString(dto);
case RequestAttributes.Json:
case "application/json":
case "text/json":
return _jsonSerializer.SerializeToString(dto);
}
}
@ -204,7 +209,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
using (var compressionStream = GetCompressionStream(ms, compressionType))
{
ContentTypes.Instance.SerializeToStream(request, dto, compressionStream);
compressionStream.Close();
compressionStream.Dispose();
var compressedBytes = ms.ToArray();
@ -221,6 +226,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
}
public static string GetRealContentType(string contentType)
{
return contentType == null
? null
: contentType.Split(';')[0].ToLower().Trim();
}
public static string SerializeToXmlString(object from)
{
using (var ms = new MemoryStream())
@ -520,7 +532,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
private bool ShouldCompressResponse(IRequest requestContext, string contentType)
{
// It will take some work to support compression with byte range requests
if (!string.IsNullOrEmpty(requestContext.GetHeader("Range")))
if (!string.IsNullOrEmpty(requestContext.Headers.Get("Range")))
{
return false;
}
@ -573,7 +585,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (!compress || string.IsNullOrEmpty(requestedCompressionType))
{
var rangeHeader = requestContext.GetHeader("Range");
var rangeHeader = requestContext.Headers.Get("Range");
var stream = await factoryFn().ConfigureAwait(false);
@ -648,7 +660,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
using (var zipStream = new DeflateStream(ms, CompressionMode.Compress))
{
zipStream.Write(bytes, 0, bytes.Length);
zipStream.Close();
zipStream.Dispose();
return ms.ToArray();
}
@ -665,7 +677,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
using (var zipStream = new GZipStream(ms, CompressionMode.Compress))
{
zipStream.Write(buffer, 0, buffer.Length);
zipStream.Close();
zipStream.Dispose();
return ms.ToArray();
}
@ -747,7 +759,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
var isNotModified = true;
var ifModifiedSinceHeader = requestContext.GetHeader("If-Modified-Since");
var ifModifiedSinceHeader = requestContext.Headers.Get("If-Modified-Since");
if (!string.IsNullOrEmpty(ifModifiedSinceHeader))
{
@ -759,7 +771,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
}
var ifNoneMatchHeader = requestContext.GetHeader("If-None-Match");
var ifNoneMatchHeader = requestContext.Headers.Get("If-None-Match");
// Validate If-None-Match
if (isNotModified && (cacheKey.HasValue || !string.IsNullOrEmpty(ifNoneMatchHeader)))

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.IO;
@ -7,7 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using MediaBrowser.Model.Services;
namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
namespace Emby.Server.Implementations.HttpServer.SocketSharp
{
public partial class WebSocketSharpRequest : IHttpRequest
{
@ -68,7 +69,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
input.Position = e.Start;
input.Read(copy, 0, (int)e.Length);
form.Add(e.Name, (e.Encoding ?? ContentEncoding).GetString(copy));
form.Add(e.Name, (e.Encoding ?? ContentEncoding).GetString(copy, 0, copy.Length));
}
else
{
@ -76,7 +77,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
// We use a substream, as in 2.x we will support large uploads streamed to disk,
//
HttpPostedFile sub = new HttpPostedFile(e.Filename, e.ContentType, input, e.Start, e.Length);
files.AddFile(e.Name, sub);
files[e.Name] = sub;
}
}
}
@ -89,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
if (form == null)
{
form = new WebROCollection();
files = new HttpFileCollection();
files = new Dictionary<string, HttpPostedFile>();
if (IsContentType("multipart/form-data", true))
{
@ -224,7 +225,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
if (starts_with)
return StrUtils.StartsWith(ContentType, ct, true);
return String.Compare(ContentType, ct, true, Helpers.InvariantCulture) == 0;
return string.Equals(ContentType, ct, StringComparison.OrdinalIgnoreCase);
}
async Task LoadWwwForm()
@ -287,67 +288,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
WebROCollection form;
HttpFileCollection files;
Dictionary<string, HttpPostedFile> files;
public sealed class HttpFileCollection : NameObjectCollectionBase
{
internal HttpFileCollection()
{
}
internal void AddFile(string name, HttpPostedFile file)
{
BaseAdd(name, file);
}
public void CopyTo(Array dest, int index)
{
/* XXX this is kind of gross and inefficient
* since it makes a copy of the superclass's
* list */
object[] values = BaseGetAllValues();
values.CopyTo(dest, index);
}
public string GetKey(int index)
{
return BaseGetKey(index);
}
public HttpPostedFile Get(int index)
{
return (HttpPostedFile)BaseGet(index);
}
public HttpPostedFile Get(string key)
{
return (HttpPostedFile)BaseGet(key);
}
public HttpPostedFile this[string key]
{
get
{
return Get(key);
}
}
public HttpPostedFile this[int index]
{
get
{
return Get(index);
}
}
public string[] AllKeys
{
get
{
return BaseGetAllKeys();
}
}
}
class WebROCollection : QueryParamCollection
{
bool got_id;
@ -589,29 +531,15 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
internal sealed class StrUtils
{
StrUtils() { }
public static bool StartsWith(string str1, string str2)
{
return StartsWith(str1, str2, false);
}
public static bool StartsWith(string str1, string str2, bool ignore_case)
{
int l2 = str2.Length;
if (l2 == 0)
return true;
int l1 = str1.Length;
if (l2 > l1)
if (string.IsNullOrWhiteSpace(str1))
{
return false;
return 0 == String.Compare(str1, 0, str2, 0, l2, ignore_case, Helpers.InvariantCulture);
}
public static bool EndsWith(string str1, string str2)
{
return EndsWith(str1, str2, false);
var comparison = ignore_case ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
return str1.IndexOf(str2, comparison) == 0;
}
public static bool EndsWith(string str1, string str2, bool ignore_case)
@ -624,7 +552,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
if (l2 > l1)
return false;
return 0 == String.Compare(str1, l1 - l2, str2, 0, l2, ignore_case, Helpers.InvariantCulture);
var comparison = ignore_case ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
return str1.IndexOf(str2, comparison) == str1.Length - str2.Length - 1;
}
}
@ -742,7 +671,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
for (int i = temp.Length - 1; i >= 0; i--)
source[i] = (byte)temp[i];
return encoding.GetString(source);
return encoding.GetString(source, 0, source.Length);
}
bool ReadBoundary()

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Emby.Server.Implementations.Logging;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.IO;
@ -55,7 +54,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
public void Start(IEnumerable<string> urlPrefixes)
{
if (_listener == null)
_listener = new HttpListener(new PatternsLogger(_logger), _cryptoProvider, _streamFactory, _socketFactory, _networkManager, _textEncoding, _memoryStreamProvider);
_listener = new HttpListener(_logger, _cryptoProvider, _streamFactory, _socketFactory, _networkManager, _textEncoding, _memoryStreamProvider);
_listener.EnableDualMode = _enableDualMode;

View File

@ -1,20 +1,20 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using Emby.Server.Implementations.HttpServer;
using Emby.Server.Implementations.HttpServer.SocketSharp;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Services;
using ServiceStack;
using ServiceStack.Host;
using SocketHttpListener.Net;
using IHttpFile = MediaBrowser.Model.Services.IHttpFile;
using IHttpRequest = MediaBrowser.Model.Services.IHttpRequest;
using IHttpResponse = MediaBrowser.Model.Services.IHttpResponse;
using IResponse = MediaBrowser.Model.Services.IResponse;
namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
namespace Emby.Server.Implementations.HttpServer.SocketSharp
{
public partial class WebSocketSharpRequest : IHttpRequest
{
@ -244,14 +244,15 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
var specifiedContentType = GetQueryStringContentType(httpReq);
if (!string.IsNullOrEmpty(specifiedContentType)) return specifiedContentType;
var serverDefaultContentType = "application/json";
var acceptContentTypes = httpReq.AcceptTypes;
var defaultContentType = httpReq.ContentType;
if (HasAnyOfContentTypes(httpReq, FormUrlEncoded, MultiPartFormData))
{
defaultContentType = HostContext.Config.DefaultContentType;
defaultContentType = serverDefaultContentType;
}
var customContentTypes = ContentTypes.Instance.ContentTypeFormats.Values;
var preferredContentTypes = new string[] {};
var acceptsAnything = false;
@ -261,7 +262,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
var hasPreferredContentTypes = new bool[preferredContentTypes.Length];
foreach (var acceptsType in acceptContentTypes)
{
var contentType = ContentFormat.GetRealContentType(acceptsType);
var contentType = HttpResultFactory.GetRealContentType(acceptsType);
acceptsAnything = acceptsAnything || contentType == "*/*";
for (var i = 0; i < preferredContentTypes.Length; i++)
@ -285,17 +286,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
{
if (hasDefaultContentType)
return defaultContentType;
if (HostContext.Config.DefaultContentType != null)
return HostContext.Config.DefaultContentType;
}
foreach (var contentType in acceptContentTypes)
{
foreach (var customContentType in customContentTypes)
{
if (contentType.StartsWith(customContentType, StringComparison.OrdinalIgnoreCase))
return customContentType;
}
if (serverDefaultContentType != null)
return serverDefaultContentType;
}
}
@ -305,8 +297,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
}
//We could also send a '406 Not Acceptable', but this is allowed also
return HostContext.Config.DefaultContentType;
return serverDefaultContentType;
}
public const string Soap11 = "text/xml; charset=utf-8";
public static bool HasAnyOfContentTypes(IRequest request, params string[] contentTypes)
@ -334,22 +327,30 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
var pi = httpReq.PathInfo;
if (pi == null || pi.Length <= formatMaxLength) return null;
if (pi[0] == '/') pi = pi.Substring(1);
format = pi.LeftPart('/');
format = LeftPart(pi, '/');
if (format.Length > formatMaxLength) return null;
}
format = format.LeftPart('.').ToLower();
format = LeftPart(format, '.').ToLower();
if (format.Contains("json")) return "application/json";
if (format.Contains("xml")) return Xml;
string contentType;
ContentTypes.Instance.ContentTypeFormats.TryGetValue(format, out contentType);
return null;
}
return contentType;
public static string LeftPart(string strVal, char needle)
{
if (strVal == null) return null;
var pos = strVal.IndexOf(needle);
return pos == -1
? strVal
: strVal.Substring(0, pos);
}
public bool HasExplicitResponseContentType { get; private set; }
public static string HandlerFactoryPath;
private string pathInfo;
public string PathInfo
{
@ -357,7 +358,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
{
if (this.pathInfo == null)
{
var mode = HostContext.Config.HandlerFactoryPath;
var mode = HandlerFactoryPath;
var pos = request.RawUrl.IndexOf("?");
if (pos != -1)
@ -373,7 +374,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
this.pathInfo = request.RawUrl;
}
this.pathInfo = this.pathInfo.UrlDecode();
this.pathInfo = WebUtility.UrlDecode(pathInfo);
this.pathInfo = NormalizePathInfo(pathInfo, mode);
}
return this.pathInfo;
@ -437,9 +438,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
if (cookies == null)
{
cookies = new Dictionary<string, System.Net.Cookie>();
for (var i = 0; i < this.request.Cookies.Count; i++)
foreach (var cookie in this.request.Cookies)
{
var httpCookie = this.request.Cookies[i];
var httpCookie = (Cookie) cookie;
cookies[httpCookie.Name] = new System.Net.Cookie(httpCookie.Name, httpCookie.Value, httpCookie.Path, httpCookie.Domain);
}
}
@ -549,10 +550,10 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
return httpFiles = new IHttpFile[0];
httpFiles = new IHttpFile[files.Count];
for (var i = 0; i < files.Count; i++)
var i = 0;
foreach (var pair in files)
{
var reqFile = files[i];
var reqFile = pair.Value;
httpFiles[i] = new HttpFile
{
ContentType = reqFile.ContentType,
@ -560,6 +561,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
FileName = reqFile.FileName,
InputStream = reqFile.InputStream,
};
i++;
}
}
return httpFiles;
@ -571,14 +573,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
if (stream is MemoryStream)
{
var other = (MemoryStream)stream;
try
byte[] buffer;
if (streamProvider.TryGetBuffer(other, out buffer))
{
return new MemoryStream(other.GetBuffer(), 0, (int)other.Length, false, true);
}
catch (UnauthorizedAccessException)
{
return new MemoryStream(other.ToArray(), 0, (int)other.Length, false, true);
return streamProvider.CreateNew(buffer);
}
return streamProvider.CreateNew(other.ToArray());
}
return stream;
@ -587,7 +588,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
public static string GetHandlerPathIfAny(string listenerUrl)
{
if (listenerUrl == null) return null;
var pos = listenerUrl.IndexOf("://", StringComparison.InvariantCultureIgnoreCase);
var pos = listenerUrl.IndexOf("://", StringComparison.OrdinalIgnoreCase);
if (pos == -1) return null;
var startHostUrl = listenerUrl.Substring(pos + "://".Length);
var endPos = startHostUrl.IndexOf('/');
@ -599,7 +600,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
public static string NormalizePathInfo(string pathInfo, string handlerPath)
{
if (handlerPath != null && pathInfo.TrimStart('/').StartsWith(
handlerPath, StringComparison.InvariantCultureIgnoreCase))
handlerPath, StringComparison.OrdinalIgnoreCase))
{
return pathInfo.TrimStart('/').Substring(handlerPath.Length);
}

View File

@ -4,7 +4,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Startup.Common
namespace Emby.Server.Implementations.IO
{
public class MbLinkShortcutHandler : IShortcutHandler
{
@ -49,7 +49,7 @@ namespace MediaBrowser.Server.Startup.Common
throw new ArgumentNullException("targetPath");
}
File.WriteAllText(shortcutPath, targetPath);
_fileSystem.WriteAllText(shortcutPath, targetPath);
}
}
}

View File

@ -29,7 +29,6 @@ using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.Library.Resolvers;
using Emby.Server.Implementations.Library.Validators;
using Emby.Server.Implementations.Logging;
using Emby.Server.Implementations.ScheduledTasks;
using MediaBrowser.Model.IO;
using MediaBrowser.Controller.Channels;
@ -2266,7 +2265,7 @@ namespace Emby.Server.Implementations.Library
public bool IsVideoFile(string path, LibraryOptions libraryOptions)
{
var resolver = new VideoResolver(GetNamingOptions(libraryOptions), new PatternsLogger());
var resolver = new VideoResolver(GetNamingOptions(libraryOptions), new NullLogger());
return resolver.IsVideoFile(path);
}
@ -2294,7 +2293,7 @@ namespace Emby.Server.Implementations.Library
public bool FillMissingEpisodeNumbersFromPath(Episode episode)
{
var resolver = new EpisodeResolver(GetNamingOptions(),
new PatternsLogger());
new NullLogger());
var isFolder = episode.VideoType == VideoType.BluRay || episode.VideoType == VideoType.Dvd ||
episode.VideoType == VideoType.HdDvd;
@ -2440,7 +2439,7 @@ namespace Emby.Server.Implementations.Library
public ItemLookupInfo ParseName(string name)
{
var resolver = new VideoResolver(GetNamingOptions(), new PatternsLogger());
var resolver = new VideoResolver(GetNamingOptions(), new NullLogger());
var result = resolver.CleanDateTime(name);
var cleanName = resolver.CleanString(result.Name);
@ -2459,7 +2458,7 @@ namespace Emby.Server.Implementations.Library
.SelectMany(i => _fileSystem.GetFiles(i.FullName, false))
.ToList();
var videoListResolver = new VideoListResolver(GetNamingOptions(), new PatternsLogger());
var videoListResolver = new VideoListResolver(GetNamingOptions(), new NullLogger());
var videos = videoListResolver.Resolve(fileSystemChildren);
@ -2505,7 +2504,7 @@ namespace Emby.Server.Implementations.Library
.SelectMany(i => _fileSystem.GetFiles(i.FullName, false))
.ToList();
var videoListResolver = new VideoListResolver(GetNamingOptions(), new PatternsLogger());
var videoListResolver = new VideoListResolver(GetNamingOptions(), new NullLogger());
var videos = videoListResolver.Resolve(fileSystemChildren);
@ -2628,7 +2627,7 @@ namespace Emby.Server.Implementations.Library
private void SetExtraTypeFromFilename(Video item)
{
var resolver = new ExtraResolver(GetNamingOptions(), new PatternsLogger(), new RegexProvider());
var resolver = new ExtraResolver(GetNamingOptions(), new NullLogger(), new RegexProvider());
var result = resolver.GetExtraInfo(item.Path);

View File

@ -8,7 +8,6 @@ using MediaBrowser.Naming.Audio;
using System;
using System.Collections.Generic;
using System.IO;
using Emby.Server.Implementations.Logging;
using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Controller.Configuration;
@ -164,7 +163,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
{
var namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions(libraryOptions);
var parser = new AlbumParser(namingOptions, new PatternsLogger());
var parser = new AlbumParser(namingOptions, new NullLogger());
var result = parser.ParseMultiPart(path);
return result.IsMultiPart;

View File

@ -4,7 +4,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Naming.Video;
using System;
using System.IO;
using Emby.Server.Implementations.Logging;
using MediaBrowser.Model.Logging;
namespace Emby.Server.Implementations.Library.Resolvers
{
@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
// If the path is a file check for a matching extensions
var parser = new MediaBrowser.Naming.Video.VideoResolver(namingOptions, new PatternsLogger());
var parser = new MediaBrowser.Naming.Video.VideoResolver(namingOptions, new NullLogger());
if (args.IsDirectory)
{
@ -258,7 +258,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
{
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
var resolver = new Format3DParser(namingOptions, new PatternsLogger());
var resolver = new Format3DParser(namingOptions, new NullLogger());
var result = resolver.Parse(video.Path);
Set3DFormat(video, result.Is3D, result.Format3D);

View File

@ -11,10 +11,10 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Emby.Server.Implementations.Logging;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
namespace Emby.Server.Implementations.Library.Resolvers.Movies
{
@ -133,7 +133,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
var resolver = new VideoListResolver(namingOptions, new PatternsLogger());
var resolver = new VideoListResolver(namingOptions, new NullLogger());
var resolverResult = resolver.Resolve(files, suppportMultiEditions).ToList();
var result = new MultiItemResolverResult
@ -486,7 +486,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
}
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
var resolver = new StackResolver(namingOptions, new PatternsLogger());
var resolver = new StackResolver(namingOptions, new NullLogger());
var result = resolver.ResolveDirectories(folderPaths);

View File

@ -10,7 +10,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Emby.Server.Implementations.Logging;
using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Controller.Configuration;
@ -171,7 +170,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
.ToList();
}
var episodeResolver = new MediaBrowser.Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
var episodeResolver = new MediaBrowser.Naming.TV.EpisodeResolver(namingOptions, new NullLogger());
var episodeInfo = episodeResolver.Resolve(fullName, false, false);
if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue)
{

View File

@ -127,23 +127,7 @@ namespace Emby.Server.Implementations.Library.Validators
{
var item = _libraryManager.GetPerson(person.Key);
var hasMetdata = !string.IsNullOrWhiteSpace(item.Overview);
var performFullRefresh = !hasMetdata && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= 30;
var defaultMetadataRefreshMode = performFullRefresh
? MetadataRefreshMode.FullRefresh
: MetadataRefreshMode.Default;
var imageRefreshMode = performFullRefresh
? ImageRefreshMode.FullRefresh
: ImageRefreshMode.Default;
var options = new MetadataRefreshOptions(_fileSystem)
{
MetadataRefreshMode = person.Value ? defaultMetadataRefreshMode : MetadataRefreshMode.ValidationOnly,
ImageRefreshMode = person.Value ? imageRefreshMode : ImageRefreshMode.ValidationOnly,
ForceSave = performFullRefresh
};
var options = new MetadataRefreshOptions(_fileSystem);
await item.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
}

View File

@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
}
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
var reader = new XmlTvReader(path, GetLanguage(), null);
var reader = new XmlTvReader(path, GetLanguage());
var results = reader.GetProgrammes(channelNumber, startDateUtc, endDateUtc, cancellationToken);
return results.Select(p => GetProgramInfo(p, info));
@ -175,7 +175,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
{
// Add the channel image url
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
var reader = new XmlTvReader(path, GetLanguage(), null);
var reader = new XmlTvReader(path, GetLanguage());
var results = reader.GetChannels().ToList();
if (channels != null)
@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
{
// In theory this should never be called because there is always only one lineup
var path = await GetXml(info.Path, CancellationToken.None).ConfigureAwait(false);
var reader = new XmlTvReader(path, GetLanguage(), null);
var reader = new XmlTvReader(path, GetLanguage());
var results = reader.GetChannels();
// Should this method be async?
@ -219,7 +219,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
{
// In theory this should never be called because there is always only one lineup
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
var reader = new XmlTvReader(path, GetLanguage(), null);
var reader = new XmlTvReader(path, GetLanguage());
var results = reader.GetChannels();
// Should this method be async?

View File

@ -1,63 +0,0 @@
using Patterns.Logging;
using System;
namespace Emby.Server.Implementations.Logging
{
public class PatternsLogger : ILogger
{
private readonly MediaBrowser.Model.Logging.ILogger _logger;
public PatternsLogger()
: this(new MediaBrowser.Model.Logging.NullLogger())
{
}
public PatternsLogger(MediaBrowser.Model.Logging.ILogger logger)
{
_logger = logger;
}
public void Debug(string message, params object[] paramList)
{
_logger.Debug(message, paramList);
}
public void Error(string message, params object[] paramList)
{
_logger.Error(message, paramList);
}
public void ErrorException(string message, Exception exception, params object[] paramList)
{
_logger.ErrorException(message, exception, paramList);
}
public void Fatal(string message, params object[] paramList)
{
_logger.Fatal(message, paramList);
}
public void FatalException(string message, Exception exception, params object[] paramList)
{
_logger.FatalException(message, exception, paramList);
}
public void Info(string message, params object[] paramList)
{
_logger.Info(message, paramList);
}
public void Warn(string message, params object[] paramList)
{
_logger.Warn(message, paramList);
}
public void Log(LogSeverity severity, string message, params object[] paramList)
{
}
public void LogMultiline(string message, LogSeverity severity, System.Text.StringBuilder additionalContent)
{
}
}
}

View File

@ -0,0 +1,32 @@
using System.IO;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Server.Implementations.Playlists;
namespace Emby.Server.Implementations.Playlists
{
public class PlaylistsDynamicFolder : IVirtualFolderCreator
{
private readonly IApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
public PlaylistsDynamicFolder(IApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
_fileSystem = fileSystem;
}
public BasePluginFolder GetFolder()
{
var path = Path.Combine(_appPaths.DataPath, "playlists");
_fileSystem.CreateDirectory(path);
return new PlaylistsFolder
{
Path = path
};
}
}
}

View File

@ -112,22 +112,22 @@ namespace Emby.Server.Implementations.ServerManager
/// <summary>
/// Starts this instance.
/// </summary>
public void Start(IEnumerable<string> urlPrefixes, string certificatePath)
public void Start(IEnumerable<string> urlPrefixes)
{
ReloadHttpServer(urlPrefixes, certificatePath);
ReloadHttpServer(urlPrefixes);
}
/// <summary>
/// Restarts the Http Server, or starts it if not currently running
/// </summary>
private void ReloadHttpServer(IEnumerable<string> urlPrefixes, string certificatePath)
private void ReloadHttpServer(IEnumerable<string> urlPrefixes)
{
_logger.Info("Loading Http Server");
try
{
HttpServer = _applicationHost.Resolve<IHttpServer>();
HttpServer.StartServer(urlPrefixes, certificatePath);
HttpServer.StartServer(urlPrefixes);
}
catch (Exception ex)
{

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.Naming" version="1.0.0.59" targetFramework="portable45-net45+win8" />
<package id="Patterns.Logging" version="1.0.0.6" targetFramework="portable45-net45+win8" />
<package id="Emby.XmlTv" version="1.0.1" targetFramework="portable45-net45+win8" />
<package id="MediaBrowser.Naming" version="1.0.2" targetFramework="portable45-net45+win8" />
<package id="UniversalDetector" version="1.0.1" targetFramework="portable45-net45+win8" />
<package id="Emby.XmlTv" version="1.0.63" targetFramework="portable45-net45+win8" />
</packages>

View File

@ -34,25 +34,36 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSubtitlesHandler", "Ope
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Emby.Common.Implementations", "Emby.Common.Implementations\Emby.Common.Implementations.xproj", "{5A27010A-09C6-4E86-93EA-437484C10917}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Mono.Nat", "Mono.Nat\Mono.Nat.xproj", "{0A82260B-4C22-4FD2-869A-E510044E3502}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Photos", "Emby.Photos\Emby.Photos.csproj", "{89AB4548-770D-41FD-A891-8DAFF44F452C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Api", "MediaBrowser.Api\MediaBrowser.Api.csproj", "{4FD51AC5-2C16-4308-A993-C3A84F3B4582}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.MediaEncoding", "MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj", "{0BD82FA6-EB8A-4452-8AF5-74F9C3849451}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Server.Implementations", "Emby.Server.Implementations\Emby.Server.Implementations.csproj", "{D08B8079-08B3-48F2-83C4-E9CCCE48AFF1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RSSDP", "RSSDP\RSSDP.csproj", "{21002819-C39A-4D3E-BE83-2A276A77FB1F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Dlna", "Emby.Dlna\Emby.Dlna.csproj", "{805844AB-E92F-45E6-9D99-4F6D48D129A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Server.Implementations", "MediaBrowser.Server.Implementations\MediaBrowser.Server.Implementations.csproj", "{2E781478-814D-4A48-9D80-BFF206441A65}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Mono.Nat", "Mono.Nat\Mono.Nat.xproj", "{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Server.Implementations", "Emby.Server.Implementations\Emby.Server.Implementations.csproj", "{E383961B-9356-4D5D-8233-9A1079D03055}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Emby.Server.Core", "Emby.Server.Core\Emby.Server.Core.xproj", "{65AA7D67-8059-40CD-91F1-16D02687226C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Drawing", "Emby.Drawing\Emby.Drawing.csproj", "{08FFF49B-F175-4807-A2B5-73B0EBD9F716}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack", "ServiceStack\ServiceStack.csproj", "{680A1709-25EB-4D52-A87F-EE03FFD94BAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketHttpListener.Portable", "SocketHttpListener.Portable\SocketHttpListener.Portable.csproj", "{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release Mono|Any CPU = Release Mono|Any CPU
Release|Any CPU = Release|Any CPU
Signed|Any CPU = Signed|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DDAFF431-0B3D-4857-8762-990A32DC8472}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@ -61,114 +72,192 @@ Global
{DDAFF431-0B3D-4857-8762-990A32DC8472}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{DDAFF431-0B3D-4857-8762-990A32DC8472}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DDAFF431-0B3D-4857-8762-990A32DC8472}.Release|Any CPU.Build.0 = Release|Any CPU
{DDAFF431-0B3D-4857-8762-990A32DC8472}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{DDAFF431-0B3D-4857-8762-990A32DC8472}.Signed|Any CPU.Build.0 = Release|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.Build.0 = Release|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Signed|Any CPU.Build.0 = Release|Any CPU
{9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release Mono|Any CPU.ActiveCfg = Release Mono|Any CPU
{9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release Mono|Any CPU.Build.0 = Release Mono|Any CPU
{9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Release|Any CPU.Build.0 = Release|Any CPU
{9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{9142EEFA-7570-41E1-BFCC-468BB571AF2F}.Signed|Any CPU.Build.0 = Release|Any CPU
{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Release Mono|Any CPU.ActiveCfg = Release Mono|Any CPU
{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Release Mono|Any CPU.Build.0 = Release Mono|Any CPU
{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Release|Any CPU.Build.0 = Release|Any CPU
{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}.Signed|Any CPU.Build.0 = Release|Any CPU
{23499896-B135-4527-8574-C26E926EA99E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23499896-B135-4527-8574-C26E926EA99E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23499896-B135-4527-8574-C26E926EA99E}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{23499896-B135-4527-8574-C26E926EA99E}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{23499896-B135-4527-8574-C26E926EA99E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23499896-B135-4527-8574-C26E926EA99E}.Release|Any CPU.Build.0 = Release|Any CPU
{23499896-B135-4527-8574-C26E926EA99E}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{23499896-B135-4527-8574-C26E926EA99E}.Signed|Any CPU.Build.0 = Release|Any CPU
{7EF9F3E0-697D-42F3-A08F-19DEB5F84392}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EF9F3E0-697D-42F3-A08F-19DEB5F84392}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EF9F3E0-697D-42F3-A08F-19DEB5F84392}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{7EF9F3E0-697D-42F3-A08F-19DEB5F84392}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{7EF9F3E0-697D-42F3-A08F-19DEB5F84392}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7EF9F3E0-697D-42F3-A08F-19DEB5F84392}.Release|Any CPU.Build.0 = Release|Any CPU
{7EF9F3E0-697D-42F3-A08F-19DEB5F84392}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{7EF9F3E0-697D-42F3-A08F-19DEB5F84392}.Signed|Any CPU.Build.0 = Release|Any CPU
{5624B7B5-B5A7-41D8-9F10-CC5611109619}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5624B7B5-B5A7-41D8-9F10-CC5611109619}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release Mono|Any CPU.ActiveCfg = Release Mono|Any CPU
{5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release Mono|Any CPU.Build.0 = Release Mono|Any CPU
{5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5624B7B5-B5A7-41D8-9F10-CC5611109619}.Release|Any CPU.Build.0 = Release|Any CPU
{5624B7B5-B5A7-41D8-9F10-CC5611109619}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{5624B7B5-B5A7-41D8-9F10-CC5611109619}.Signed|Any CPU.Build.0 = Release|Any CPU
{713F42B5-878E-499D-A878-E4C652B1D5E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{713F42B5-878E-499D-A878-E4C652B1D5E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{713F42B5-878E-499D-A878-E4C652B1D5E8}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{713F42B5-878E-499D-A878-E4C652B1D5E8}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{713F42B5-878E-499D-A878-E4C652B1D5E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{713F42B5-878E-499D-A878-E4C652B1D5E8}.Release|Any CPU.Build.0 = Release|Any CPU
{713F42B5-878E-499D-A878-E4C652B1D5E8}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{713F42B5-878E-499D-A878-E4C652B1D5E8}.Signed|Any CPU.Build.0 = Release|Any CPU
{88AE38DF-19D7-406F-A6A9-09527719A21E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88AE38DF-19D7-406F-A6A9-09527719A21E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88AE38DF-19D7-406F-A6A9-09527719A21E}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{88AE38DF-19D7-406F-A6A9-09527719A21E}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{88AE38DF-19D7-406F-A6A9-09527719A21E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88AE38DF-19D7-406F-A6A9-09527719A21E}.Release|Any CPU.Build.0 = Release|Any CPU
{88AE38DF-19D7-406F-A6A9-09527719A21E}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{88AE38DF-19D7-406F-A6A9-09527719A21E}.Signed|Any CPU.Build.0 = Release|Any CPU
{442B5058-DCAF-4263-BB6A-F21E31120A1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{442B5058-DCAF-4263-BB6A-F21E31120A1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{442B5058-DCAF-4263-BB6A-F21E31120A1B}.Release Mono|Any CPU.ActiveCfg = Release Mono|Any CPU
{442B5058-DCAF-4263-BB6A-F21E31120A1B}.Release Mono|Any CPU.Build.0 = Release Mono|Any CPU
{442B5058-DCAF-4263-BB6A-F21E31120A1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{442B5058-DCAF-4263-BB6A-F21E31120A1B}.Release|Any CPU.Build.0 = Release|Any CPU
{442B5058-DCAF-4263-BB6A-F21E31120A1B}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{442B5058-DCAF-4263-BB6A-F21E31120A1B}.Signed|Any CPU.Build.0 = Release|Any CPU
{4A4402D4-E910-443B-B8FC-2C18286A2CA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A4402D4-E910-443B-B8FC-2C18286A2CA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A4402D4-E910-443B-B8FC-2C18286A2CA0}.Release Mono|Any CPU.ActiveCfg = Release Mono|Any CPU
{4A4402D4-E910-443B-B8FC-2C18286A2CA0}.Release Mono|Any CPU.Build.0 = Release Mono|Any CPU
{4A4402D4-E910-443B-B8FC-2C18286A2CA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A4402D4-E910-443B-B8FC-2C18286A2CA0}.Release|Any CPU.Build.0 = Release|Any CPU
{4A4402D4-E910-443B-B8FC-2C18286A2CA0}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{4A4402D4-E910-443B-B8FC-2C18286A2CA0}.Signed|Any CPU.Build.0 = Release|Any CPU
{5A27010A-09C6-4E86-93EA-437484C10917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A27010A-09C6-4E86-93EA-437484C10917}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A27010A-09C6-4E86-93EA-437484C10917}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{5A27010A-09C6-4E86-93EA-437484C10917}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{5A27010A-09C6-4E86-93EA-437484C10917}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A27010A-09C6-4E86-93EA-437484C10917}.Release|Any CPU.Build.0 = Release|Any CPU
{0A82260B-4C22-4FD2-869A-E510044E3502}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A82260B-4C22-4FD2-869A-E510044E3502}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A82260B-4C22-4FD2-869A-E510044E3502}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{0A82260B-4C22-4FD2-869A-E510044E3502}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{0A82260B-4C22-4FD2-869A-E510044E3502}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A82260B-4C22-4FD2-869A-E510044E3502}.Release|Any CPU.Build.0 = Release|Any CPU
{5A27010A-09C6-4E86-93EA-437484C10917}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{5A27010A-09C6-4E86-93EA-437484C10917}.Signed|Any CPU.Build.0 = Release|Any CPU
{89AB4548-770D-41FD-A891-8DAFF44F452C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89AB4548-770D-41FD-A891-8DAFF44F452C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89AB4548-770D-41FD-A891-8DAFF44F452C}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{89AB4548-770D-41FD-A891-8DAFF44F452C}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{89AB4548-770D-41FD-A891-8DAFF44F452C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89AB4548-770D-41FD-A891-8DAFF44F452C}.Release|Any CPU.Build.0 = Release|Any CPU
{89AB4548-770D-41FD-A891-8DAFF44F452C}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{89AB4548-770D-41FD-A891-8DAFF44F452C}.Signed|Any CPU.Build.0 = Release|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Release Mono|Any CPU.ActiveCfg = Release Mono|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Release Mono|Any CPU.Build.0 = Release Mono|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Release|Any CPU.Build.0 = Release|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{4FD51AC5-2C16-4308-A993-C3A84F3B4582}.Signed|Any CPU.Build.0 = Release|Any CPU
{0BD82FA6-EB8A-4452-8AF5-74F9C3849451}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0BD82FA6-EB8A-4452-8AF5-74F9C3849451}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BD82FA6-EB8A-4452-8AF5-74F9C3849451}.Release Mono|Any CPU.ActiveCfg = Release Mono|Any CPU
{0BD82FA6-EB8A-4452-8AF5-74F9C3849451}.Release Mono|Any CPU.Build.0 = Release Mono|Any CPU
{0BD82FA6-EB8A-4452-8AF5-74F9C3849451}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BD82FA6-EB8A-4452-8AF5-74F9C3849451}.Release|Any CPU.Build.0 = Release|Any CPU
{D08B8079-08B3-48F2-83C4-E9CCCE48AFF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D08B8079-08B3-48F2-83C4-E9CCCE48AFF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D08B8079-08B3-48F2-83C4-E9CCCE48AFF1}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{D08B8079-08B3-48F2-83C4-E9CCCE48AFF1}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{D08B8079-08B3-48F2-83C4-E9CCCE48AFF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D08B8079-08B3-48F2-83C4-E9CCCE48AFF1}.Release|Any CPU.Build.0 = Release|Any CPU
{0BD82FA6-EB8A-4452-8AF5-74F9C3849451}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{0BD82FA6-EB8A-4452-8AF5-74F9C3849451}.Signed|Any CPU.Build.0 = Release|Any CPU
{21002819-C39A-4D3E-BE83-2A276A77FB1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21002819-C39A-4D3E-BE83-2A276A77FB1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21002819-C39A-4D3E-BE83-2A276A77FB1F}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{21002819-C39A-4D3E-BE83-2A276A77FB1F}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{21002819-C39A-4D3E-BE83-2A276A77FB1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21002819-C39A-4D3E-BE83-2A276A77FB1F}.Release|Any CPU.Build.0 = Release|Any CPU
{21002819-C39A-4D3E-BE83-2A276A77FB1F}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{21002819-C39A-4D3E-BE83-2A276A77FB1F}.Signed|Any CPU.Build.0 = Release|Any CPU
{805844AB-E92F-45E6-9D99-4F6D48D129A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{805844AB-E92F-45E6-9D99-4F6D48D129A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{805844AB-E92F-45E6-9D99-4F6D48D129A5}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{805844AB-E92F-45E6-9D99-4F6D48D129A5}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{805844AB-E92F-45E6-9D99-4F6D48D129A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{805844AB-E92F-45E6-9D99-4F6D48D129A5}.Release|Any CPU.Build.0 = Release|Any CPU
{805844AB-E92F-45E6-9D99-4F6D48D129A5}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{805844AB-E92F-45E6-9D99-4F6D48D129A5}.Signed|Any CPU.Build.0 = Release|Any CPU
{2E781478-814D-4A48-9D80-BFF206441A65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E781478-814D-4A48-9D80-BFF206441A65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E781478-814D-4A48-9D80-BFF206441A65}.Release Mono|Any CPU.ActiveCfg = Release Mono|Any CPU
{2E781478-814D-4A48-9D80-BFF206441A65}.Release Mono|Any CPU.Build.0 = Release Mono|Any CPU
{2E781478-814D-4A48-9D80-BFF206441A65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E781478-814D-4A48-9D80-BFF206441A65}.Release|Any CPU.Build.0 = Release|Any CPU
{2E781478-814D-4A48-9D80-BFF206441A65}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{2E781478-814D-4A48-9D80-BFF206441A65}.Signed|Any CPU.Build.0 = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Release|Any CPU.Build.0 = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC}.Signed|Any CPU.Build.0 = Release|Any CPU
{E383961B-9356-4D5D-8233-9A1079D03055}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E383961B-9356-4D5D-8233-9A1079D03055}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E383961B-9356-4D5D-8233-9A1079D03055}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{E383961B-9356-4D5D-8233-9A1079D03055}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{E383961B-9356-4D5D-8233-9A1079D03055}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E383961B-9356-4D5D-8233-9A1079D03055}.Release|Any CPU.Build.0 = Release|Any CPU
{E383961B-9356-4D5D-8233-9A1079D03055}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{E383961B-9356-4D5D-8233-9A1079D03055}.Signed|Any CPU.Build.0 = Release|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Release|Any CPU.Build.0 = Release|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Signed|Any CPU.Build.0 = Release|Any CPU
{08FFF49B-F175-4807-A2B5-73B0EBD9F716}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08FFF49B-F175-4807-A2B5-73B0EBD9F716}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08FFF49B-F175-4807-A2B5-73B0EBD9F716}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{08FFF49B-F175-4807-A2B5-73B0EBD9F716}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{08FFF49B-F175-4807-A2B5-73B0EBD9F716}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08FFF49B-F175-4807-A2B5-73B0EBD9F716}.Release|Any CPU.Build.0 = Release|Any CPU
{08FFF49B-F175-4807-A2B5-73B0EBD9F716}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{08FFF49B-F175-4807-A2B5-73B0EBD9F716}.Signed|Any CPU.Build.0 = Release|Any CPU
{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Release|Any CPU.Build.0 = Release|Any CPU
{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Any CPU.ActiveCfg = Signed|Any CPU
{680A1709-25EB-4D52-A87F-EE03FFD94BAA}.Signed|Any CPU.Build.0 = Signed|Any CPU
{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Release|Any CPU.Build.0 = Release|Any CPU
{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Signed|Any CPU.ActiveCfg = Release|Any CPU
{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E}.Signed|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -186,12 +275,17 @@ Global
{442B5058-DCAF-4263-BB6A-F21E31120A1B} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{4A4402D4-E910-443B-B8FC-2C18286A2CA0} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{5A27010A-09C6-4E86-93EA-437484C10917} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{0A82260B-4C22-4FD2-869A-E510044E3502} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{89AB4548-770D-41FD-A891-8DAFF44F452C} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{4FD51AC5-2C16-4308-A993-C3A84F3B4582} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{0BD82FA6-EB8A-4452-8AF5-74F9C3849451} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{D08B8079-08B3-48F2-83C4-E9CCCE48AFF1} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{21002819-C39A-4D3E-BE83-2A276A77FB1F} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{805844AB-E92F-45E6-9D99-4F6D48D129A5} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{2E781478-814D-4A48-9D80-BFF206441A65} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{4ACAB6A2-AC9A-4B50-BAEC-1FE4A1F3B8BC} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{E383961B-9356-4D5D-8233-9A1079D03055} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{65AA7D67-8059-40CD-91F1-16D02687226C} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{08FFF49B-F175-4807-A2B5-73B0EBD9F716} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{680A1709-25EB-4D52-A87F-EE03FFD94BAA} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
{4F26D5D8-A7B0-42B3-BA42-7CB7D245934E} = {8ADD772F-F0A4-4A53-9B2F-AF4A4C585839}
EndGlobalSection
EndGlobal

View File

@ -54,12 +54,5 @@ namespace MediaBrowser.Common.Net
bool TryParseIpAddress(string ipAddress, out IpAddressInfo ipAddressInfo);
Task<IpAddressInfo[]> GetHostAddressesAsync(string host);
/// <summary>
/// Generates a self signed certificate at the locatation specified by <paramref name="certificatePath"/>.
/// </summary>
/// <param name="certificatePath">The path to generate the certificate.</param>
/// <param name="hostname">The common name for the certificate.</param>
void GenerateSelfSignedSslCertificate(string certificatePath, string hostname);
}
}

View File

@ -1,8 +1,7 @@
using MediaBrowser.Controller.Drawing;
using System;
using MediaBrowser.Model.Drawing;
using System;
namespace Emby.Drawing
namespace MediaBrowser.Controller.Drawing
{
public interface IImageEncoder : IDisposable
{

View File

@ -27,12 +27,6 @@ namespace MediaBrowser.Controller
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
bool SupportsAutoRunAtStartup { get; }
/// <summary>
/// Gets a value indicating whether [supports library monitor].
/// </summary>
/// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value>
bool SupportsLibraryMonitor { get; }
/// <summary>
/// Gets the HTTP server port.
/// </summary>

View File

@ -88,6 +88,7 @@
<Compile Include="Dlna\IEventManager.cs" />
<Compile Include="Dlna\IMediaReceiverRegistrar.cs" />
<Compile Include="Dlna\IUpnpService.cs" />
<Compile Include="Drawing\IImageEncoder.cs" />
<Compile Include="Drawing\IImageProcessor.cs" />
<Compile Include="Drawing\ImageCollageOptions.cs" />
<Compile Include="Drawing\ImageProcessingOptions.cs" />

View File

@ -15,19 +15,11 @@ namespace MediaBrowser.Controller.Net
/// <value>The URL prefix.</value>
IEnumerable<string> UrlPrefixes { get; }
/// <summary>
/// Gets the certificate path.
/// </summary>
/// <value>The certificate path.</value>
string CertificatePath { get; }
/// <summary>
/// Starts the specified server name.
/// </summary>
/// <param name="urlPrefixes">The URL prefixes.</param>
/// <param name="certificatePath">If an https prefix is specified,
/// the ssl certificate localtion on the file system.</param>
void StartServer(IEnumerable<string> urlPrefixes, string certificatePath);
void StartServer(IEnumerable<string> urlPrefixes);
/// <summary>
/// Stops this instance.

View File

@ -15,9 +15,7 @@ namespace MediaBrowser.Controller.Net
/// Starts this instance.
/// </summary>
/// <param name="urlPrefixes">The URL prefixes.</param>
/// <param name="certificatePath">If an https prefix is specified,
/// the ssl certificate localtion on the file system.</param>
void Start(IEnumerable<string> urlPrefixes, string certificatePath);
void Start(IEnumerable<string> urlPrefixes);
/// <summary>
/// Sends a message to all clients currently connected via a web socket

View File

@ -11,28 +11,28 @@ using MediaBrowser.Model.Xml;
namespace MediaBrowser.LocalMetadata.Providers
{
public class PersonXmlProvider : BaseXmlProvider<Person>
{
private readonly ILogger _logger;
private readonly IProviderManager _providerManager;
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
//public class PersonXmlProvider : BaseXmlProvider<Person>
//{
// private readonly ILogger _logger;
// private readonly IProviderManager _providerManager;
// protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
public PersonXmlProvider(IFileSystem fileSystem, ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
: base(fileSystem)
{
_logger = logger;
_providerManager = providerManager;
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
}
// public PersonXmlProvider(IFileSystem fileSystem, ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
// : base(fileSystem)
// {
// _logger = logger;
// _providerManager = providerManager;
// XmlReaderSettingsFactory = xmlReaderSettingsFactory;
// }
protected override void Fetch(MetadataResult<Person> result, string path, CancellationToken cancellationToken)
{
new BaseItemXmlParser<Person>(_logger, _providerManager, XmlReaderSettingsFactory, FileSystem).Fetch(result, path, cancellationToken);
}
// protected override void Fetch(MetadataResult<Person> result, string path, CancellationToken cancellationToken)
// {
// new BaseItemXmlParser<Person>(_logger, _providerManager, XmlReaderSettingsFactory, FileSystem).Fetch(result, path, cancellationToken);
// }
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
{
return directoryService.GetFile(Path.Combine(info.Path, "person.xml"));
}
}
// protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
// {
// return directoryService.GetFile(Path.Combine(info.Path, "person.xml"));
// }
//}
}

View File

@ -10,48 +10,48 @@ using MediaBrowser.Model.Xml;
namespace MediaBrowser.LocalMetadata.Savers
{
/// <summary>
/// Class PersonXmlSaver
/// </summary>
public class PersonXmlSaver : BaseXmlSaver
{
public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{
if (!item.SupportsLocalMetadata)
{
return false;
}
///// <summary>
///// Class PersonXmlSaver
///// </summary>
//public class PersonXmlSaver : BaseXmlSaver
//{
// public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
// {
// if (!item.SupportsLocalMetadata)
// {
// return false;
// }
return item is Person && updateType >= ItemUpdateType.MetadataDownload;
}
// return item is Person && updateType >= ItemUpdateType.MetadataDownload;
// }
protected override List<string> GetTagsUsed()
{
var list = new List<string>
{
"PlaceOfBirth"
};
// protected override List<string> GetTagsUsed()
// {
// var list = new List<string>
// {
// "PlaceOfBirth"
// };
return list;
}
// return list;
// }
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
{
var person = (Person)item;
// protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
// {
// var person = (Person)item;
if (person.ProductionLocations.Count > 0)
{
writer.WriteElementString("PlaceOfBirth", person.ProductionLocations[0]);
}
}
// if (person.ProductionLocations.Count > 0)
// {
// writer.WriteElementString("PlaceOfBirth", person.ProductionLocations[0]);
// }
// }
protected override string GetLocalSavePath(IHasMetadata item)
{
return Path.Combine(item.Path, "person.xml");
}
// protected override string GetLocalSavePath(IHasMetadata item)
// {
// return Path.Combine(item.Path, "person.xml");
// }
public PersonXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
{
}
}
// public PersonXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
// {
// }
//}
}

Some files were not shown because too many files have changed in this diff Show More