update portable projects

This commit is contained in:
Luke Pulverenti 2016-11-11 12:33:10 -05:00
parent 13ec531b14
commit 5655787c1a
38 changed files with 639 additions and 236 deletions

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; }
@ -193,22 +191,29 @@ 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,
IEnvironmentInfo environmentInfo)
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;
@ -236,9 +241,6 @@ namespace Emby.Common.Implementations
JsonSerializer = CreateJsonSerializer();
MemoryStreamProvider = CreateMemoryStreamProvider();
SystemEvents = CreateSystemEvents();
OnLoggerLoaded(true);
LogManager.LoggerLoaded += (s, e) => OnLoggerLoaded(false);
@ -270,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);
@ -524,7 +523,7 @@ return null;
RegisterSingleInstance(JsonSerializer);
RegisterSingleInstance(XmlSerializer);
RegisterSingleInstance(MemoryStreamProvider);
RegisterSingleInstance(MemoryStreamFactory);
RegisterSingleInstance(SystemEvents);
RegisterSingleInstance(LogManager);
@ -535,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();
@ -591,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

@ -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

@ -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,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;
@ -66,7 +63,6 @@ using Emby.Common.Implementations;
using Emby.Common.Implementations.Archiving;
using Emby.Common.Implementations.Networking;
using Emby.Common.Implementations.Reflection;
using Emby.Common.Implementations.Security;
using Emby.Common.Implementations.Serialization;
using Emby.Common.Implementations.TextEncoding;
using Emby.Common.Implementations.Updates;
@ -135,13 +131,13 @@ using MediaBrowser.Model.Services;
using MediaBrowser.Model.Social;
using MediaBrowser.Model.Text;
using MediaBrowser.Model.Xml;
using MediaBrowser.Server.Startup.Common.IO;
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
@ -267,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.
@ -278,14 +278,30 @@ namespace MediaBrowser.Server.Startup.Common
INativeApp nativeApp,
IPowerManagement powerManagement,
string releaseAssetFilename,
IEnvironmentInfo environmentInfo)
: base(applicationPaths, logManager, fileSystem, environmentInfo)
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();
}
@ -298,7 +314,7 @@ namespace MediaBrowser.Server.Startup.Common
{
get
{
return _version ?? (_version = NativeApp.GetType().Assembly.GetName().Version);
return _version ?? (_version = GetAssembly(NativeApp.GetType()).GetName().Version);
}
}
@ -324,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>
@ -408,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
@ -574,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);
@ -591,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);
@ -603,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 = HttpServerFactory.CreateServer(this, LogManager, ServerConfigurationManager, NetworkManager, MemoryStreamProvider, "Emby", "web/index.html", textEncoding, SocketFactory, CryptographyProvider, JsonSerializer, XmlSerializer, EnvironmentInfo, Certificate);
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>();
@ -625,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);
@ -713,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);
@ -742,7 +748,7 @@ namespace MediaBrowser.Server.Startup.Common
{
X509Certificate2 localCert = new X509Certificate2(certificateLocation);
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
if (localCert.PrivateKey == null)
if (!localCert.HasPrivateKey)
{
//throw new FileNotFoundException("Secure requested, no private key included", certificateLocation);
return null;
@ -766,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>
@ -831,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);
@ -846,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);
@ -1071,7 +1047,7 @@ namespace MediaBrowser.Server.Startup.Common
try
{
CertificateGenerator.CreateSelfSignCertificatePfx(certPath, certHost, Logger);
_certificateGenerator(certPath, certHost);
}
catch (Exception ex)
{
@ -1182,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);
list.Add(GetAssembly(typeof(TaskManager)));
// Emby.Server implementations
list.Add(typeof(InstallationManager).Assembly);
list.Add(GetAssembly(typeof(InstallationManager)));
// Emby.Server.Core
list.Add(typeof(ServerApplicationPaths).Assembly);
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;
}

View File

@ -16,6 +16,14 @@
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<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" />

View File

@ -20,7 +20,7 @@ using MediaBrowser.Model.Text;
using ServiceStack.Text.Jsv;
using SocketHttpListener.Primitives;
namespace MediaBrowser.Server.Startup.Common
namespace Emby.Server.Core
{
/// <summary>
/// Class ServerFactory

View File

@ -67,12 +67,6 @@ namespace Emby.Server.Core
/// <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

@ -31,8 +31,33 @@
},
"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": "1.0.50"
}
},
"netstandard1.6": {
"imports": "dnxcore50",
@ -41,6 +66,10 @@
"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",
"SocketHttpListener.Portable": "1.0.50",
"MediaBrowser.Model": {
"target": "project"
},
@ -61,6 +90,30 @@
},
"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"
}
}
}

View File

@ -278,9 +278,6 @@
<Reference Include="ServiceStack">
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.dll</HintPath>
</Reference>
<Reference Include="SocketHttpListener.Portable">
<HintPath>..\ThirdParty\emby\SocketHttpListener.Portable.dll</HintPath>
</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>

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

@ -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

@ -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)
// {
// }
//}
}

View File

@ -0,0 +1,46 @@
using Emby.Drawing;
using Emby.Drawing.Net;
using Emby.Drawing.ImageMagick;
using Emby.Server.Core;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Server.Startup.Common
{
public class ImageEncoderHelper
{
public static IImageEncoder GetImageEncoder(ILogger logger,
ILogManager logManager,
IFileSystem fileSystem,
StartupOptions startupOptions,
IHttpClient httpClient,
IServerConfigurationManager config)
{
if (!startupOptions.ContainsOption("-enablegdi"))
{
try
{
return new ImageMagickEncoder(logManager.GetLogger("ImageMagick"), config.ApplicationPaths, httpClient, fileSystem, config);
}
catch
{
logger.Error("Error loading ImageMagick. Will revert to GDI.");
}
}
try
{
return new GDIImageEncoder(fileSystem, logManager.GetLogger("GDI"));
}
catch
{
logger.Error("Error loading GDI. Will revert to NullImageEncoder.");
}
return new NullImageEncoder();
}
}
}

View File

@ -60,8 +60,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll</HintPath>
</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>
<Reference Include="Patterns.Logging, Version=1.0.6159.22455, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Patterns.Logging.1.0.0.7\lib\netstandard1.3\Patterns.Logging.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@ -76,9 +76,9 @@
<HintPath>..\packages\SimpleInjector.3.2.4\lib\net45\SimpleInjector.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SocketHttpListener.Portable, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\emby\SocketHttpListener.Portable.dll</HintPath>
<Reference Include="SocketHttpListener, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SocketHttpListener.Portable.1.0.50\lib\portable-net45+win8\SocketHttpListener.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
@ -93,7 +93,6 @@
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="ApplicationHost.cs" />
<Compile Include="ApplicationPathHelper.cs" />
<Compile Include="Cryptography\ASN1.cs" />
<Compile Include="Cryptography\ASN1Convert.cs" />
@ -113,7 +112,7 @@
<Compile Include="Cryptography\X509Extension.cs" />
<Compile Include="Cryptography\X509Extensions.cs" />
<Compile Include="Cryptography\X520Attributes.cs" />
<Compile Include="HttpServerFactory.cs" />
<Compile Include="ImageEncoderHelper.cs" />
<Compile Include="IO\MemoryStreamProvider.cs" />
<Compile Include="LiveTv\TunerHosts\SatIp\ChannelScan.cs" />
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\ReportBlock.cs" />
@ -145,6 +144,14 @@
<Project>{805844ab-e92f-45e6-9d99-4f6d48d129a5}</Project>
<Name>Emby.Dlna</Name>
</ProjectReference>
<ProjectReference Include="..\Emby.Drawing.ImageMagick\Emby.Drawing.ImageMagick.csproj">
<Project>{6cfee013-6e7c-432b-ac37-cabf0880c69a}</Project>
<Name>Emby.Drawing.ImageMagick</Name>
</ProjectReference>
<ProjectReference Include="..\Emby.Drawing.Net\Emby.Drawing.Net.csproj">
<Project>{c97a239e-a96c-4d64-a844-ccf8cc30aecb}</Project>
<Name>Emby.Drawing.Net</Name>
</ProjectReference>
<ProjectReference Include="..\Emby.Drawing\Emby.Drawing.csproj">
<Project>{08fff49b-f175-4807-a2b5-73b0ebd9f716}</Project>
<Name>Emby.Drawing</Name>

View File

@ -4,7 +4,8 @@
<package id="MediaBrowser.Naming" version="1.0.0.59" targetFramework="net46" />
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.1.0.0" targetFramework="net46" />
<package id="Mono.Posix" version="4.0.0.0" targetFramework="net45" />
<package id="Patterns.Logging" version="1.0.0.6" targetFramework="net46" />
<package id="Patterns.Logging" version="1.0.0.7" targetFramework="net46" />
<package id="ServiceStack.Text" version="4.5.4" targetFramework="net46" />
<package id="SimpleInjector" version="3.2.4" targetFramework="net46" />
<package id="SocketHttpListener.Portable" version="1.0.50" targetFramework="net46" />
</packages>

View File

@ -74,6 +74,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Dlna", "Emby.Dlna\Emby
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.ImageMagick", "Emby.Drawing.ImageMagick\Emby.Drawing.ImageMagick.csproj", "{6CFEE013-6E7C-432B-AC37-CABF0880C69A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.Drawing.Net", "Emby.Drawing.Net\Emby.Drawing.Net.csproj", "{C97A239E-A96C-4D64-A844-CCF8CC30AECB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -718,6 +722,66 @@ Global
{65AA7D67-8059-40CD-91F1-16D02687226C}.Release|x64.Build.0 = Release|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Release|x86.ActiveCfg = Release|Any CPU
{65AA7D67-8059-40CD-91F1-16D02687226C}.Release|x86.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|Win32.ActiveCfg = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|Win32.Build.0 = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|x64.ActiveCfg = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|x64.Build.0 = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|x86.ActiveCfg = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Debug|x86.Build.0 = Debug|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|Mixed Platforms.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|Mixed Platforms.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|Win32.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|Win32.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|x64.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|x64.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|x86.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release Mono|x86.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|Any CPU.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|Win32.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|Win32.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|x64.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|x64.Build.0 = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|x86.ActiveCfg = Release|Any CPU
{6CFEE013-6E7C-432B-AC37-CABF0880C69A}.Release|x86.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|Win32.ActiveCfg = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|Win32.Build.0 = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|x64.ActiveCfg = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|x64.Build.0 = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|x86.ActiveCfg = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Debug|x86.Build.0 = Debug|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|Mixed Platforms.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|Mixed Platforms.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|Win32.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|Win32.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|x64.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|x64.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|x86.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release Mono|x86.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|Any CPU.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|Win32.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|Win32.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|x64.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|x64.Build.0 = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|x86.ActiveCfg = Release|Any CPU
{C97A239E-A96C-4D64-A844-CCF8CC30AECB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE