Merge pull request #2257 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-10-28 15:57:49 -04:00 committed by GitHub
commit 6367da37a6
23 changed files with 689 additions and 918 deletions

View File

@ -62,11 +62,6 @@
<Compile Include="TSStreamFile.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Release (
xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i
)</PostBuildEvent>
</PropertyGroup>
<!-- 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

@ -61,11 +61,6 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Release (
xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i
)</PostBuildEvent>
</PropertyGroup>
<!-- 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

@ -1,6 +1,5 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
using MediaBrowser.Common.Implementations.Archiving;
using MediaBrowser.Common.Implementations.Devices;
using MediaBrowser.Common.Implementations.IO;
using MediaBrowser.Common.Implementations.ScheduledTasks;
@ -158,12 +157,6 @@ namespace MediaBrowser.Common.Implementations
protected IFileSystem FileSystemManager { get; private set; }
/// <summary>
/// Gets or sets the zip client.
/// </summary>
/// <value>The zip client.</value>
protected IZipClient ZipClient { get; private set; }
protected IIsoManager IsoManager { get; private set; }
/// <summary>
@ -243,14 +236,7 @@ namespace MediaBrowser.Common.Implementations
JsonSerializer = CreateJsonSerializer();
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
MemoryStreamProvider = new RecyclableMemoryStreamProvider();
}
else
{
MemoryStreamProvider = new MemoryStreamProvider();
}
MemoryStreamProvider = CreateMemoryStreamProvider();
OnLoggerLoaded(true);
LogManager.LoggerLoaded += (s, e) => OnLoggerLoaded(false);
@ -283,6 +269,8 @@ namespace MediaBrowser.Common.Implementations
progress.Report(100);
}
protected abstract IMemoryStreamProvider CreateMemoryStreamProvider();
protected virtual void OnLoggerLoaded(bool isFirstLoad)
{
Logger.Info("Application version: {0}", ApplicationVersion);
@ -531,9 +519,6 @@ namespace MediaBrowser.Common.Implementations
InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager);
RegisterSingleInstance(InstallationManager);
ZipClient = new ZipClient(FileSystemManager);
RegisterSingleInstance(ZipClient);
IsoManager = new IsoManager();
RegisterSingleInstance(IsoManager);

View File

@ -45,30 +45,21 @@
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.1.0.0\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.3.8\lib\net45\NLog.dll</HintPath>
<HintPath>..\packages\NLog.4.3.10\lib\net45\NLog.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.10.2.0, Culture=neutral, PublicKeyToken=beaf6f427e128133, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="SimpleInjector, Version=3.2.2.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
<HintPath>..\packages\SimpleInjector.3.2.2\lib\net45\SimpleInjector.dll</HintPath>
<Reference Include="SimpleInjector, Version=3.2.4.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
<HintPath>..\packages\SimpleInjector.3.2.4\lib\net45\SimpleInjector.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="ServiceStack.Text">
@ -79,7 +70,6 @@
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Archiving\ZipClient.cs" />
<Compile Include="BaseApplicationHost.cs" />
<Compile Include="BaseApplicationPaths.cs" />
<Compile Include="Configuration\BaseConfigurationManager.cs" />
@ -91,7 +81,6 @@
<Compile Include="IO\IsoManager.cs" />
<Compile Include="IO\LnkShortcutHandler.cs" />
<Compile Include="IO\ManagedFileSystem.cs" />
<Compile Include="IO\MemoryStreamProvider.cs" />
<Compile Include="IO\WindowsFileSystem.cs" />
<Compile Include="Logging\LogHelper.cs" />
<Compile Include="Logging\NLogger.cs" />

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.1.0.0" targetFramework="net45" />
<package id="NLog" version="4.3.8" targetFramework="net45" />
<package id="NLog" version="4.3.10" targetFramework="net46" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
<package id="SimpleInjector" version="3.2.2" targetFramework="net45" />
<package id="SimpleInjector" version="3.2.4" targetFramework="net46" />
</packages>

View File

@ -39,8 +39,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Rssdp.NetFx40">
<HintPath>..\ThirdParty\rssdp\Rssdp.NetFx40.dll</HintPath>
<Reference Include="Rssdp.Native">
<HintPath>..\ThirdParty\rssdp\Rssdp.Native.dll</HintPath>
</Reference>
<Reference Include="Rssdp.Portable">
<HintPath>..\ThirdParty\rssdp\Rssdp.Portable.dll</HintPath>

View File

@ -23,97 +23,116 @@ using MediaBrowser.Model.Xml;
namespace MediaBrowser.LocalMetadata.Savers
{
public abstract class BaseNfoSaver : IMetadataFileSaver
public abstract class BaseXmlSaver : IMetadataFileSaver
{
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
private static readonly Dictionary<string, string> CommonTags = new[] {
"plot",
"customrating",
"lockdata",
"type",
"dateadded",
"title",
"rating",
"year",
"sorttitle",
"mpaa",
"mpaadescription",
"aspectratio",
"website",
"collectionnumber",
"tmdbid",
"rottentomatoesid",
"language",
"tvcomid",
"budget",
"revenue",
"tagline",
"studio",
"genre",
"tag",
"runtime",
"actor",
"criticratingsummary",
"criticrating",
"fileinfo",
"director",
"writer",
"trailer",
"premiered",
"releasedate",
"outline",
"id",
"votes",
"credits",
"originaltitle",
"watched",
"playcount",
"lastplayed",
"art",
"resume",
"biography",
"formed",
"review",
"style",
"imdbid",
"imdb_id",
"plotkeyword",
"country",
"audiodbalbumid",
"audiodbartistid",
"awardsummary",
"enddate",
"lockedfields",
"metascore",
"zap2itid",
"tvrageid",
"gamesdbid",
"Added",
"AspectRatio",
"AudioDbAlbumId",
"AudioDbArtistId",
"AwardSummary",
"BirthDate",
"Budget",
// Deprecated. No longer saving in this field.
"certification",
"musicbrainzartistid",
"musicbrainzalbumartistid",
"musicbrainzalbumid",
"musicbrainzreleasegroupid",
"tvdbid",
"collectionitem",
"Chapters",
"ContentRating",
"Countries",
"CustomRating",
"CriticRating",
"CriticRatingSummary",
"DeathDate",
"DisplayOrder",
"EndDate",
"Genres",
"Genre",
"GamesDbId",
// Deprecated. No longer saving in this field.
"IMDB_ID",
"isuserfavorite",
"userrating",
"IMDB",
// Deprecated. No longer saving in this field.
"IMDbId",
"countrycode"
"Language",
"LocalTitle",
"OriginalTitle",
"LockData",
"LockedFields",
"Format3D",
"Metascore",
// Deprecated. No longer saving in this field.
"MPAARating",
"MPAADescription",
"MusicBrainzArtistId",
"MusicBrainzAlbumArtistId",
"MusicBrainzAlbumId",
"MusicBrainzReleaseGroupId",
// Deprecated. No longer saving in this field.
"MusicbrainzId",
"Overview",
"ShortOverview",
"Persons",
"PlotKeywords",
"PremiereDate",
"ProductionYear",
"Rating",
"Revenue",
"RottenTomatoesId",
"RunningTime",
// Deprecated. No longer saving in this field.
"Runtime",
"SortTitle",
"Studios",
"Tags",
// Deprecated. No longer saving in this field.
"TagLine",
"Taglines",
"TMDbCollectionId",
"TMDbId",
// Deprecated. No longer saving in this field.
"Trailer",
"Trailers",
"TVcomId",
"TvDbId",
"Type",
"TVRageId",
"VoteCount",
"Website",
"Zap2ItId",
"CollectionItems",
"PlaylistItems",
"Shares"
}.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
protected BaseNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
public BaseXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
{
FileSystem = fileSystem;
ConfigurationManager = configurationManager;
LibraryManager = libraryManager;
UserManager = userManager;
UserDataManager = userDataManager;
Logger = logger;
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
UserDataManager = userDataManager;
UserManager = userManager;
LibraryManager = libraryManager;
ConfigurationManager = configurationManager;
FileSystem = fileSystem;
}
protected IFileSystem FileSystem { get; private set; }
@ -136,15 +155,7 @@ namespace MediaBrowser.LocalMetadata.Savers
{
get
{
return SaverName;
}
}
public static string SaverName
{
get
{
return "Emby Xml";
return XmlProviderUtils.Name;
}
}

View File

@ -9,40 +9,28 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using System.Xml;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Xml;
namespace MediaBrowser.LocalMetadata.Savers
{
public class FolderXmlSaver : IMetadataFileSaver
public class FolderXmlSaver : BaseXmlSaver
{
public string Name
protected override string GetLocalSavePath(IHasMetadata item)
{
get
{
return XmlProviderUtils.Name;
}
return Path.Combine(item.Path, "folder.xml");
}
private readonly IServerConfigurationManager _config;
private readonly ILibraryManager _libraryManager;
private readonly IFileSystem _fileSystem;
public FolderXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager, IFileSystem fileSystem)
protected override string GetRootElementName(IHasMetadata item)
{
_config = config;
_libraryManager = libraryManager;
_fileSystem = fileSystem;
return "Item";
}
/// <summary>
/// Determines whether [is enabled for] [the specified item].
/// </summary>
/// <param name="item">The item.</param>
/// <param name="updateType">Type of the update.</param>
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{
if (!item.SupportsLocalMetadata)
{
@ -63,35 +51,12 @@ namespace MediaBrowser.LocalMetadata.Savers
return false;
}
/// <summary>
/// Saves the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
public void Save(IHasMetadata item, CancellationToken cancellationToken)
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
{
var builder = new StringBuilder();
builder.Append("<Item>");
XmlSaverHelpers.AddCommonNodes((Folder)item, _libraryManager, builder);
builder.Append("</Item>");
var xmlFilePath = GetSavePath(item);
XmlSaverHelpers.Save(builder, xmlFilePath, new List<string>(), _config, _fileSystem);
}
/// <summary>
/// Gets the save path.
/// </summary>
/// <param name="item">The item.</param>
/// <returns>System.String.</returns>
public string GetSavePath(IHasMetadata item)
public FolderXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
{
return Path.Combine(item.Path, "folder.xml");
}
}
}

View File

@ -3,43 +3,20 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using System.Collections.Generic;
using System.IO;
using System.Security;
using System.Text;
using System.Threading;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using System.Xml;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Xml;
namespace MediaBrowser.LocalMetadata.Savers
{
public class GameSystemXmlSaver : IMetadataFileSaver
public class GameSystemXmlSaver : BaseXmlSaver
{
public string Name
public GameSystemXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
{
get
{
return XmlProviderUtils.Name;
}
}
private readonly IServerConfigurationManager _config;
private readonly ILibraryManager _libraryManager;
private readonly IFileSystem _fileSystem;
public GameSystemXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager, IFileSystem fileSystem)
{
_config = config;
_libraryManager = libraryManager;
_fileSystem = fileSystem;
}
/// <summary>
/// Determines whether [is enabled for] [the specified item].
/// </summary>
/// <param name="item">The item.</param>
/// <param name="updateType">Type of the update.</param>
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{
if (!item.SupportsLocalMetadata)
{
@ -49,42 +26,34 @@ namespace MediaBrowser.LocalMetadata.Savers
return item is GameSystem && updateType >= ItemUpdateType.MetadataDownload;
}
/// <summary>
/// Saves the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
public void Save(IHasMetadata item, CancellationToken cancellationToken)
protected override List<string> GetTagsUsed()
{
var list = new List<string>
{
"GameSystem"
};
return list;
}
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
{
var gameSystem = (GameSystem)item;
var builder = new StringBuilder();
builder.Append("<Item>");
if (!string.IsNullOrEmpty(gameSystem.GameSystemName))
{
builder.Append("<GameSystem>" + SecurityElement.Escape(gameSystem.GameSystemName) + "</GameSystem>");
writer.WriteElementString("GameSystem", gameSystem.GameSystemName);
}
XmlSaverHelpers.AddCommonNodes(gameSystem, _libraryManager, builder);
builder.Append("</Item>");
var xmlFilePath = GetSavePath(item);
XmlSaverHelpers.Save(builder, xmlFilePath, new List<string>(), _config, _fileSystem);
}
/// <summary>
/// Gets the save path.
/// </summary>
/// <param name="item">The item.</param>
/// <returns>System.String.</returns>
public string GetSavePath(IHasMetadata item)
protected override string GetLocalSavePath(IHasMetadata item)
{
return Path.Combine(item.Path, "gamesystem.xml");
}
protected override string GetRootElementName(IHasMetadata item)
{
return "Item";
}
}
}

View File

@ -26,7 +26,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
return new Tuple<List<string>, List<string>>(decoders, encoders);
}
public bool ValidateVersion(string encoderAppPath)
public bool ValidateVersion(string encoderAppPath, bool logOutput)
{
string output = string.Empty;
try
@ -37,6 +37,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
}
if (logOutput)
{
_logger.Info("ffmpeg info: {0}", output ?? string.Empty);
}
if (string.IsNullOrWhiteSpace(output))
{
return false;

View File

@ -241,7 +241,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
path = newPaths.Item1;
if (!ValidateVersion(path))
if (!ValidateVersion(path, true))
{
throw new ResourceNotFoundException("ffmpeg version 3.0 or greater is required.");
}
@ -253,9 +253,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
Init();
}
private bool ValidateVersion(string path)
private bool ValidateVersion(string path, bool logOutput)
{
return new EncoderValidator(_logger).ValidateVersion(path);
return new EncoderValidator(_logger).ValidateVersion(path, logOutput);
}
private void ConfigureEncoderPaths()
@ -307,7 +307,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
string encoderPath = null;
string probePath = null;
if (_hasExternalEncoder && ValidateVersion(_originalFFMpegPath))
if (_hasExternalEncoder && ValidateVersion(_originalFFMpegPath, true))
{
encoderPath = _originalFFMpegPath;
probePath = _originalFFProbePath;
@ -315,7 +315,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
if (string.IsNullOrWhiteSpace(encoderPath))
{
if (ValidateVersion("ffmpeg") && ValidateVersion("ffprobe"))
if (ValidateVersion("ffmpeg", true) && ValidateVersion("ffprobe", false))
{
encoderPath = "ffmpeg";
probePath = "ffprobe";

View File

@ -16,7 +16,7 @@ namespace MediaBrowser.Model.LiveTv
public string RecordingEncodingFormat { get; set; }
public bool EnableRecordingSubfolders { get; set; }
public bool EnableOriginalAudioWithEncodedRecordings { get; set; }
public bool EnableOriginalVideoWithEncodedRecordings { get; set; }
public string RecordedVideoCodec { get; set; }
public List<TunerHostInfo> TunerHosts { get; set; }
public List<ListingsProviderInfo> ListingProviders { get; set; }

View File

@ -160,5 +160,17 @@ namespace MediaBrowser.Model.Services
//}
}
}
private string GetQueryStringValue(NameValuePair pair)
{
return pair.Name + "=" + pair.Value;
}
public override String ToString()
{
var vals = this.Select(GetQueryStringValue).ToArray();
return string.Join("&", vals);
}
}
}

View File

@ -1,13 +1,13 @@
using MediaBrowser.Model.IO;
using System.IO;
using MediaBrowser.Model.IO;
using SharpCompress.Archive.Rar;
using SharpCompress.Archive.SevenZip;
using SharpCompress.Archive.Tar;
using SharpCompress.Common;
using SharpCompress.Reader;
using SharpCompress.Reader.Zip;
using System.IO;
namespace MediaBrowser.Common.Implementations.Archiving
namespace MediaBrowser.Server.Implementations.Archiving
{
/// <summary>
/// Class DotNetZipClient

View File

@ -1,9 +1,8 @@
using System.IO;
using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using Microsoft.IO;
namespace MediaBrowser.Common.Implementations.IO
namespace MediaBrowser.Server.Implementations.IO
{
public class RecyclableMemoryStreamProvider : IMemoryStreamProvider
{

View File

@ -53,7 +53,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
var format = _liveTvOptions.RecordingEncodingFormat;
if (string.Equals(format, "mkv", StringComparison.OrdinalIgnoreCase) || _liveTvOptions.EnableOriginalVideoWithEncodedRecordings)
if (string.Equals(format, "mkv", StringComparison.OrdinalIgnoreCase) || string.Equals(_liveTvOptions.RecordedVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
return "mkv";
}
@ -205,7 +205,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private bool EncodeVideo(MediaSourceInfo mediaSource)
{
if (_liveTvOptions.EnableOriginalAudioWithEncodedRecordings)
if (string.Equals(_liveTvOptions.RecordedVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
return false;
}

View File

@ -57,14 +57,22 @@
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.55\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.1.0.0\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Api.Swagger">
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.Api.Swagger.dll</HintPath>
</Reference>
<Reference Include="SimpleInjector, Version=3.2.2.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
<HintPath>..\packages\SimpleInjector.3.2.2\lib\net45\SimpleInjector.dll</HintPath>
<Reference Include="SharpCompress, Version=0.10.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="SimpleInjector, Version=3.2.4.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
<HintPath>..\packages\SimpleInjector.3.2.4\lib\net45\SimpleInjector.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SocketHttpListener, Version=1.0.6109.26162, Culture=neutral, processorArchitecture=MSIL">
@ -103,6 +111,7 @@
</Compile>
<Compile Include="Activity\ActivityManager.cs" />
<Compile Include="Activity\ActivityRepository.cs" />
<Compile Include="Archiving\ZipClient.cs" />
<Compile Include="Branding\BrandingConfigurationFactory.cs" />
<Compile Include="Channels\ChannelConfigurations.cs" />
<Compile Include="Channels\ChannelDynamicMediaSourceProvider.cs" />
@ -170,6 +179,7 @@
<Compile Include="Intros\DefaultIntroProvider.cs" />
<Compile Include="IO\FileRefresher.cs" />
<Compile Include="IO\LibraryMonitor.cs" />
<Compile Include="IO\MemoryStreamProvider.cs" />
<Compile Include="IO\ThrottledStream.cs" />
<Compile Include="Library\CoreResolutionIgnoreRule.cs" />
<Compile Include="Library\LibraryManager.cs" />

View File

@ -87,9 +87,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
private IDbCommand _deleteAncestorsCommand;
private IDbCommand _saveAncestorCommand;
private IDbCommand _deleteUserDataKeysCommand;
private IDbCommand _saveUserDataKeysCommand;
private IDbCommand _deleteItemValuesCommand;
private IDbCommand _saveItemValuesCommand;
@ -169,8 +166,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
"create index if not exists idx_AncestorIds1 on AncestorIds(AncestorId)",
"create index if not exists idx_AncestorIds2 on AncestorIds(AncestorIdText)",
"create table if not exists UserDataKeys (ItemId GUID, UserDataKey TEXT Priority INT, PRIMARY KEY (ItemId, UserDataKey))",
"create table if not exists ItemValues (ItemId GUID, Type INT, Value TEXT, CleanValue TEXT)",
"create table if not exists ProviderIds (ItemId GUID, Name TEXT, Value TEXT, PRIMARY KEY (ItemId, Name))",
@ -192,6 +187,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
"create index if not exists idx_mediastreams1 on mediastreams(ItemId)",
//"drop table if exists UserDataKeys"
};
_connection.RunQueries(queries, Logger);
@ -289,7 +286,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.AddColumn(Logger, "TypedBaseItems", "ThemeSongIds", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "ThemeVideoIds", "Text");
_connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT");
_connection.AddColumn(Logger, "ItemValues", "CleanValue", "Text");
_connection.AddColumn(Logger, ChaptersTableName, "ImageDateModified", "DATETIME");
@ -316,6 +312,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
"drop index if exists idx_ItemValues3",
"drop index if exists idx_ItemValues4",
"drop index if exists idx_ItemValues5",
"drop index if exists idx_UserDataKeys3",
"drop table if exists UserDataKeys",
"create index if not exists idx_PathTypedBaseItems on TypedBaseItems(Path)",
"create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)",
@ -347,10 +345,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
// items by name
"create index if not exists idx_ItemValues6 on ItemValues(ItemId,Type,CleanValue)",
"create index if not exists idx_ItemValues7 on ItemValues(Type,CleanValue,ItemId)",
// covering index
"create index if not exists idx_UserDataKeys3 on UserDataKeys(ItemId,Priority,UserDataKey)"
"create index if not exists idx_ItemValues7 on ItemValues(Type,CleanValue,ItemId)"
};
_connection.RunQueries(postQueries, Logger);
@ -653,17 +648,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
_updateInheritedTagsCommand.Parameters.Add(_updateInheritedTagsCommand, "@Guid");
_updateInheritedTagsCommand.Parameters.Add(_updateInheritedTagsCommand, "@InheritedTags");
// user data
_deleteUserDataKeysCommand = _connection.CreateCommand();
_deleteUserDataKeysCommand.CommandText = "delete from UserDataKeys where ItemId=@Id";
_deleteUserDataKeysCommand.Parameters.Add(_deleteUserDataKeysCommand, "@Id");
_saveUserDataKeysCommand = _connection.CreateCommand();
_saveUserDataKeysCommand.CommandText = "insert into UserDataKeys (ItemId, UserDataKey, Priority) values (@ItemId, @UserDataKey, @Priority)";
_saveUserDataKeysCommand.Parameters.Add(_saveUserDataKeysCommand, "@ItemId");
_saveUserDataKeysCommand.Parameters.Add(_saveUserDataKeysCommand, "@UserDataKey");
_saveUserDataKeysCommand.Parameters.Add(_saveUserDataKeysCommand, "@Priority");
// item values
_deleteItemValuesCommand = _connection.CreateCommand();
_deleteItemValuesCommand.CommandText = "delete from ItemValues where ItemId=@Id";
@ -1071,7 +1055,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
UpdateAncestors(item.Id, item.GetAncestorIds().Distinct().ToList(), transaction);
}
UpdateUserDataKeys(item.Id, item.GetUserDataKeys().Distinct(StringComparer.OrdinalIgnoreCase).ToList(), transaction);
UpdateImages(item.Id, item.ImageInfos, transaction);
UpdateProviderIds(item.Id, item.ProviderIds, transaction);
UpdateItemValues(item.Id, GetItemValuesToSave(item), transaction);
@ -2343,12 +2326,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
return string.Empty;
}
if (_config.Configuration.SchemaVersion >= 96)
{
return " left join UserDataDb.UserData on UserDataKey=UserDataDb.UserData.Key And (UserId=@UserId)";
}
return " left join UserDataDb.UserData on (select UserDataKey from UserDataKeys where ItemId=Guid order by Priority LIMIT 1)=UserDataDb.UserData.Key And (UserId=@UserId)";
return " left join UserDataDb.UserData on UserDataKey=UserDataDb.UserData.Key And (UserId=@UserId)";
}
private string GetGroupBy(InternalItemsQuery query)
@ -4176,11 +4154,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
_deleteAncestorsCommand.Transaction = transaction;
_deleteAncestorsCommand.ExecuteNonQuery();
// Delete user data keys
_deleteUserDataKeysCommand.GetParameter(0).Value = id;
_deleteUserDataKeysCommand.Transaction = transaction;
_deleteUserDataKeysCommand.ExecuteNonQuery();
// Delete item values
_deleteItemValuesCommand.GetParameter(0).Value = id;
_deleteItemValuesCommand.Transaction = transaction;
@ -4949,39 +4922,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
}
private void UpdateUserDataKeys(Guid itemId, List<string> keys, IDbTransaction transaction)
{
if (itemId == Guid.Empty)
{
throw new ArgumentNullException("itemId");
}
if (keys == null)
{
throw new ArgumentNullException("keys");
}
CheckDisposed();
// First delete
_deleteUserDataKeysCommand.GetParameter(0).Value = itemId;
_deleteUserDataKeysCommand.Transaction = transaction;
_deleteUserDataKeysCommand.ExecuteNonQuery();
var index = 0;
foreach (var key in keys)
{
_saveUserDataKeysCommand.GetParameter(0).Value = itemId;
_saveUserDataKeysCommand.GetParameter(1).Value = key;
_saveUserDataKeysCommand.GetParameter(2).Value = index;
index++;
_saveUserDataKeysCommand.Transaction = transaction;
_saveUserDataKeysCommand.ExecuteNonQuery();
}
}
public async Task UpdatePeople(Guid itemId, List<PersonInfo> people)
{
if (itemId == Guid.Empty)

View File

@ -4,7 +4,8 @@
<package id="ini-parser" version="2.3.0" targetFramework="net45" />
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
<package id="MediaBrowser.Naming" version="1.0.0.55" targetFramework="net45" />
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.1.0.0" targetFramework="net46" />
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
<package id="SimpleInjector" version="3.2.2" targetFramework="net45" />
<package id="SimpleInjector" version="3.2.4" targetFramework="net46" />
<package id="SocketHttpListener" version="1.0.0.40" targetFramework="net45" />
</packages>

View File

@ -117,6 +117,7 @@ using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.Social;
using MediaBrowser.Model.Xml;
using MediaBrowser.Server.Implementations.Archiving;
using MediaBrowser.Server.Implementations.Reflection;
using MediaBrowser.Server.Implementations.Xml;
using OpenSubtitlesHandler;
@ -222,6 +223,12 @@ namespace MediaBrowser.Server.Startup.Common
private IMediaSourceManager MediaSourceManager { get; set; }
private IPlaylistManager PlaylistManager { get; set; }
/// <summary>
/// Gets or sets the zip client.
/// </summary>
/// <value>The zip client.</value>
protected IZipClient ZipClient { get; private set; }
private readonly StartupOptions _startupOptions;
private readonly string _releaseAssetFilename;
@ -380,6 +387,16 @@ namespace MediaBrowser.Server.Startup.Common
LogManager.RemoveConsoleOutput();
}
protected override IMemoryStreamProvider CreateMemoryStreamProvider()
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
return new RecyclableMemoryStreamProvider();
}
return new MemoryStreamProvider();
}
protected override IJsonSerializer CreateJsonSerializer()
{
var result = base.CreateJsonSerializer();
@ -625,6 +642,9 @@ namespace MediaBrowser.Server.Startup.Common
{
await base.RegisterResources(progress).ConfigureAwait(false);
ZipClient = new ZipClient(FileSystemManager);
RegisterSingleInstance(ZipClient);
RegisterSingleInstance<IHttpResultFactory>(new HttpResultFactory(LogManager, FileSystemManager, JsonSerializer));
RegisterSingleInstance<IServerApplicationHost>(this);

View File

@ -19,12 +19,13 @@ namespace MediaBrowser.XbmcMetadata.Providers
private readonly IProviderManager _providerManager;
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
public AlbumNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager)
public AlbumNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
: base(fileSystem)
{
_logger = logger;
_config = config;
_providerManager = providerManager;
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
}
protected override void Fetch(MetadataResult<MusicAlbum> result, string path, CancellationToken cancellationToken)

View File

@ -1,11 +1,11 @@
{
{
"supports": {
"net46.app": {},
"dnxcore50.app": {}
},
"dependencies": {
"Microsoft.NETCore": "5.0.0",
"Microsoft.NETCore.Portable.Compatibility": "1.0.0"
"Microsoft.NETCore.Portable.Compatibility": "1.0.1"
},
"frameworks": {
"dotnet": {

File diff suppressed because it is too large Load Diff