updated Mono.Nat
This commit is contained in:
parent
a75ce4197d
commit
32320b329a
|
@ -48,9 +48,9 @@
|
||||||
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="NLog, Version=3.2.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
<Reference Include="NLog, Version=3.2.1.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\NLog.3.2.0.0\lib\net45\NLog.dll</HintPath>
|
<HintPath>..\packages\NLog.3.2.1\lib\net45\NLog.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpCompress, Version=0.10.2.0, Culture=neutral, PublicKeyToken=beaf6f427e128133, processorArchitecture=MSIL">
|
<Reference Include="SharpCompress, Version=0.10.2.0, Culture=neutral, PublicKeyToken=beaf6f427e128133, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="NLog" version="3.2.0.0" targetFramework="net45" />
|
<package id="NLog" version="3.2.1" targetFramework="net45" />
|
||||||
<package id="SimpleInjector" version="2.7.0" targetFramework="net45" />
|
<package id="SimpleInjector" version="2.7.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
|
|
9
MediaBrowser.Controller/Dlna/ISsdpHandler.cs
Normal file
9
MediaBrowser.Controller/Dlna/ISsdpHandler.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Dlna
|
||||||
|
{
|
||||||
|
public interface ISsdpHandler
|
||||||
|
{
|
||||||
|
event EventHandler<SsdpMessageEventArgs> MessageReceived;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.Ssdp
|
namespace MediaBrowser.Controller.Dlna
|
||||||
{
|
{
|
||||||
public class SsdpMessageEventArgs
|
public class SsdpMessageEventArgs
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@ namespace MediaBrowser.Dlna.Ssdp
|
||||||
public Dictionary<string, string> Headers { get; set; }
|
public Dictionary<string, string> Headers { get; set; }
|
||||||
|
|
||||||
public IPAddress LocalIp { get; set; }
|
public IPAddress LocalIp { get; set; }
|
||||||
|
public byte[] Message { get; set; }
|
||||||
|
|
||||||
public SsdpMessageEventArgs()
|
public SsdpMessageEventArgs()
|
||||||
{
|
{
|
|
@ -116,7 +116,9 @@
|
||||||
<Compile Include="Dlna\IDlnaManager.cs" />
|
<Compile Include="Dlna\IDlnaManager.cs" />
|
||||||
<Compile Include="Dlna\IEventManager.cs" />
|
<Compile Include="Dlna\IEventManager.cs" />
|
||||||
<Compile Include="Dlna\IMediaReceiverRegistrar.cs" />
|
<Compile Include="Dlna\IMediaReceiverRegistrar.cs" />
|
||||||
|
<Compile Include="Dlna\ISsdpHandler.cs" />
|
||||||
<Compile Include="Dlna\IUpnpService.cs" />
|
<Compile Include="Dlna\IUpnpService.cs" />
|
||||||
|
<Compile Include="Dlna\SsdpMessageEventArgs.cs" />
|
||||||
<Compile Include="Drawing\IImageProcessor.cs" />
|
<Compile Include="Drawing\IImageProcessor.cs" />
|
||||||
<Compile Include="Drawing\ImageCollageOptions.cs" />
|
<Compile Include="Drawing\ImageCollageOptions.cs" />
|
||||||
<Compile Include="Drawing\ImageProcessingOptions.cs" />
|
<Compile Include="Drawing\ImageProcessingOptions.cs" />
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Controller.Dlna;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Dlna.ContentDirectory;
|
using MediaBrowser.Dlna.ContentDirectory;
|
||||||
using MediaBrowser.Dlna.PlayTo;
|
using MediaBrowser.Dlna.PlayTo;
|
||||||
|
|
|
@ -37,13 +37,26 @@ namespace MediaBrowser.Dlna.Main
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
|
|
||||||
private SsdpHandler _ssdpHandler;
|
private readonly SsdpHandler _ssdpHandler;
|
||||||
private DeviceDiscovery _deviceDiscovery;
|
private DeviceDiscovery _deviceDiscovery;
|
||||||
|
|
||||||
private readonly List<string> _registeredServerIds = new List<string>();
|
private readonly List<string> _registeredServerIds = new List<string>();
|
||||||
private bool _dlnaServerStarted;
|
private bool _dlnaServerStarted;
|
||||||
|
|
||||||
public DlnaEntryPoint(IServerConfigurationManager config, ILogManager logManager, IServerApplicationHost appHost, INetworkManager network, ISessionManager sessionManager, IHttpClient httpClient, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IImageProcessor imageProcessor, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager)
|
public DlnaEntryPoint(IServerConfigurationManager config,
|
||||||
|
ILogManager logManager,
|
||||||
|
IServerApplicationHost appHost,
|
||||||
|
INetworkManager network,
|
||||||
|
ISessionManager sessionManager,
|
||||||
|
IHttpClient httpClient,
|
||||||
|
ILibraryManager libraryManager,
|
||||||
|
IUserManager userManager,
|
||||||
|
IDlnaManager dlnaManager,
|
||||||
|
IImageProcessor imageProcessor,
|
||||||
|
IUserDataManager userDataManager,
|
||||||
|
ILocalizationManager localization,
|
||||||
|
IMediaSourceManager mediaSourceManager,
|
||||||
|
ISsdpHandler ssdpHandler)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
|
@ -57,6 +70,7 @@ namespace MediaBrowser.Dlna.Main
|
||||||
_userDataManager = userDataManager;
|
_userDataManager = userDataManager;
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
|
_ssdpHandler = (SsdpHandler)ssdpHandler;
|
||||||
_logger = logManager.GetLogger("Dlna");
|
_logger = logManager.GetLogger("Dlna");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +123,6 @@ namespace MediaBrowser.Dlna.Main
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_ssdpHandler = new SsdpHandler(_logger, _config, GenerateServerSignature());
|
|
||||||
|
|
||||||
_ssdpHandler.Start();
|
_ssdpHandler.Start();
|
||||||
|
|
||||||
_deviceDiscovery = new DeviceDiscovery(_logger, _config, _ssdpHandler, _appHost);
|
_deviceDiscovery = new DeviceDiscovery(_logger, _config, _ssdpHandler, _appHost);
|
||||||
|
@ -123,7 +135,7 @@ namespace MediaBrowser.Dlna.Main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisposeSsdpHandler()
|
private void DisposeDeviceDiscovery()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -133,15 +145,6 @@ namespace MediaBrowser.Dlna.Main
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error disposing device discovery", ex);
|
_logger.ErrorException("Error disposing device discovery", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_ssdpHandler.Dispose();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.ErrorException("Error disposing ssdp handler", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartDlnaServer()
|
public void StartDlnaServer()
|
||||||
|
@ -184,29 +187,6 @@ namespace MediaBrowser.Dlna.Main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GenerateServerSignature()
|
|
||||||
{
|
|
||||||
var os = Environment.OSVersion;
|
|
||||||
var pstring = os.Platform.ToString();
|
|
||||||
switch (os.Platform)
|
|
||||||
{
|
|
||||||
case PlatformID.Win32NT:
|
|
||||||
case PlatformID.Win32S:
|
|
||||||
case PlatformID.Win32Windows:
|
|
||||||
pstring = "WIN";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return String.Format(
|
|
||||||
"{0}{1}/{2}.{3} UPnP/1.0 DLNADOC/1.5 MediaBrowser/{4}",
|
|
||||||
pstring,
|
|
||||||
IntPtr.Size * 8,
|
|
||||||
os.Version.Major,
|
|
||||||
os.Version.Minor,
|
|
||||||
_appHost.ApplicationVersion
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly object _syncLock = new object();
|
private readonly object _syncLock = new object();
|
||||||
private void StartPlayToManager()
|
private void StartPlayToManager()
|
||||||
{
|
{
|
||||||
|
@ -260,7 +240,7 @@ namespace MediaBrowser.Dlna.Main
|
||||||
{
|
{
|
||||||
DisposeDlnaServer();
|
DisposeDlnaServer();
|
||||||
DisposePlayToManager();
|
DisposePlayToManager();
|
||||||
DisposeSsdpHandler();
|
DisposeDeviceDiscovery();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisposeDlnaServer()
|
public void DisposeDlnaServer()
|
||||||
|
|
|
@ -135,7 +135,6 @@
|
||||||
<Compile Include="Server\Headers.cs" />
|
<Compile Include="Server\Headers.cs" />
|
||||||
<Compile Include="Server\UpnpDevice.cs" />
|
<Compile Include="Server\UpnpDevice.cs" />
|
||||||
<Compile Include="Ssdp\SsdpMessageBuilder.cs" />
|
<Compile Include="Ssdp\SsdpMessageBuilder.cs" />
|
||||||
<Compile Include="Ssdp\SsdpMessageEventArgs.cs" />
|
|
||||||
<Compile Include="Ssdp\SsdpHandler.cs" />
|
<Compile Include="Ssdp\SsdpHandler.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Controller.Dlna;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -183,7 +184,6 @@ namespace MediaBrowser.Dlna.Ssdp
|
||||||
}
|
}
|
||||||
|
|
||||||
}, _tokenSource.Token, TaskCreationOptions.LongRunning);
|
}, _tokenSource.Token, TaskCreationOptions.LongRunning);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Socket GetMulticastSocket(IPAddress localIpAddress, EndPoint localEndpoint)
|
private Socket GetMulticastSocket(IPAddress localIpAddress, EndPoint localEndpoint)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common;
|
||||||
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Events;
|
using MediaBrowser.Common.Events;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Controller.Dlna;
|
||||||
using MediaBrowser.Dlna.Server;
|
using MediaBrowser.Dlna.Server;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
@ -16,7 +18,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.Ssdp
|
namespace MediaBrowser.Dlna.Ssdp
|
||||||
{
|
{
|
||||||
public class SsdpHandler : IDisposable
|
public class SsdpHandler : IDisposable, ISsdpHandler
|
||||||
{
|
{
|
||||||
private Socket _socket;
|
private Socket _socket;
|
||||||
|
|
||||||
|
@ -39,13 +41,39 @@ namespace MediaBrowser.Dlna.Ssdp
|
||||||
private bool _isDisposed;
|
private bool _isDisposed;
|
||||||
private readonly ConcurrentDictionary<Guid, List<UpnpDevice>> _devices = new ConcurrentDictionary<Guid, List<UpnpDevice>>();
|
private readonly ConcurrentDictionary<Guid, List<UpnpDevice>> _devices = new ConcurrentDictionary<Guid, List<UpnpDevice>>();
|
||||||
|
|
||||||
public SsdpHandler(ILogger logger, IServerConfigurationManager config, string serverSignature)
|
private readonly IApplicationHost _appHost;
|
||||||
|
|
||||||
|
public SsdpHandler(ILogger logger, IServerConfigurationManager config, IApplicationHost appHost)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_config = config;
|
_config = config;
|
||||||
_serverSignature = serverSignature;
|
_appHost = appHost;
|
||||||
|
|
||||||
_config.NamedConfigurationUpdated += _config_ConfigurationUpdated;
|
_config.NamedConfigurationUpdated += _config_ConfigurationUpdated;
|
||||||
|
_serverSignature = GenerateServerSignature();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GenerateServerSignature()
|
||||||
|
{
|
||||||
|
var os = Environment.OSVersion;
|
||||||
|
var pstring = os.Platform.ToString();
|
||||||
|
switch (os.Platform)
|
||||||
|
{
|
||||||
|
case PlatformID.Win32NT:
|
||||||
|
case PlatformID.Win32S:
|
||||||
|
case PlatformID.Win32Windows:
|
||||||
|
pstring = "WIN";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.Format(
|
||||||
|
"{0}{1}/{2}.{3} UPnP/1.0 DLNADOC/1.5 MediaBrowser/{4}",
|
||||||
|
pstring,
|
||||||
|
IntPtr.Size * 8,
|
||||||
|
os.Version.Major,
|
||||||
|
os.Version.Minor,
|
||||||
|
_appHost.ApplicationVersion
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _config_ConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
|
void _config_ConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using MediaBrowser.Controller.Dlna;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -34,7 +35,8 @@ namespace MediaBrowser.Dlna.Ssdp
|
||||||
return new SsdpMessageEventArgs
|
return new SsdpMessageEventArgs
|
||||||
{
|
{
|
||||||
Method = method,
|
Method = method,
|
||||||
Headers = headers
|
Headers = headers,
|
||||||
|
Message = data
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Controller.Dlna;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using Mono.Nat;
|
using Mono.Nat;
|
||||||
|
@ -7,6 +8,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
@ -17,15 +19,17 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||||
private readonly IServerApplicationHost _appHost;
|
private readonly IServerApplicationHost _appHost;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly ISsdpHandler _ssdp;
|
||||||
|
|
||||||
private Timer _timer;
|
private Timer _timer;
|
||||||
private bool _isStarted;
|
private bool _isStarted;
|
||||||
|
|
||||||
public ExternalPortForwarding(ILogManager logmanager, IServerApplicationHost appHost, IServerConfigurationManager config)
|
public ExternalPortForwarding(ILogManager logmanager, IServerApplicationHost appHost, IServerConfigurationManager config, ISsdpHandler ssdp)
|
||||||
{
|
{
|
||||||
_logger = logmanager.GetLogger("PortMapper");
|
_logger = logmanager.GetLogger("PortMapper");
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_ssdp = ssdp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _lastConfigIdentifier;
|
private string _lastConfigIdentifier;
|
||||||
|
@ -75,10 +79,10 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
_logger.Debug("Starting NAT discovery");
|
_logger.Debug("Starting NAT discovery");
|
||||||
//NatUtility.EnabledProtocols = new List<NatProtocol>
|
NatUtility.EnabledProtocols = new List<NatProtocol>
|
||||||
//{
|
{
|
||||||
// NatProtocol.Pmp
|
NatProtocol.Pmp
|
||||||
//};
|
};
|
||||||
NatUtility.DeviceFound += NatUtility_DeviceFound;
|
NatUtility.DeviceFound += NatUtility_DeviceFound;
|
||||||
|
|
||||||
// Mono.Nat does never rise this event. The event is there however it is useless.
|
// Mono.Nat does never rise this event. The event is there however it is useless.
|
||||||
|
@ -93,11 +97,23 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||||
|
|
||||||
_timer = new Timer(s => _createdRules = new List<string>(), null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
|
_timer = new Timer(s => _createdRules = new List<string>(), null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
|
||||||
|
|
||||||
|
_ssdp.MessageReceived += _ssdp_MessageReceived;
|
||||||
|
|
||||||
_lastConfigIdentifier = GetConfigIdentifier();
|
_lastConfigIdentifier = GetConfigIdentifier();
|
||||||
|
|
||||||
_isStarted = true;
|
_isStarted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _ssdp_MessageReceived(object sender, SsdpMessageEventArgs e)
|
||||||
|
{
|
||||||
|
var endpoint = e.EndPoint as IPEndPoint;
|
||||||
|
|
||||||
|
if (endpoint != null && e.LocalIp != null)
|
||||||
|
{
|
||||||
|
NatUtility.Handle(e.LocalIp, e.Message, endpoint, NatProtocol.Upnp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NatUtility_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
void NatUtility_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
var ex = e.ExceptionObject as Exception;
|
var ex = e.ExceptionObject as Exception;
|
||||||
|
@ -183,6 +199,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
||||||
_timer = null;
|
_timer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ssdp.MessageReceived -= _ssdp_MessageReceived;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// This is not a significant improvement
|
// This is not a significant improvement
|
||||||
|
|
|
@ -8,7 +8,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Model.FileOrganization;
|
using MediaBrowser.Model.FileOrganization;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Naming.IO;
|
|
||||||
using MediaBrowser.Server.Implementations.Library;
|
using MediaBrowser.Server.Implementations.Library;
|
||||||
using MediaBrowser.Server.Implementations.Logging;
|
using MediaBrowser.Server.Implementations.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
@ -60,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||||
var namingOptions = ((LibraryManager) _libraryManager).GetNamingOptions();
|
var namingOptions = ((LibraryManager) _libraryManager).GetNamingOptions();
|
||||||
var resolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
|
var resolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
|
||||||
|
|
||||||
var episodeInfo = resolver.Resolve(path, FileInfoType.File) ??
|
var episodeInfo = resolver.Resolve(path, false) ??
|
||||||
new Naming.TV.EpisodeInfo();
|
new Naming.TV.EpisodeInfo();
|
||||||
|
|
||||||
var seriesName = episodeInfo.SeriesName;
|
var seriesName = episodeInfo.SeriesName;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using Interfaces.IO;
|
||||||
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Progress;
|
using MediaBrowser.Common.Progress;
|
||||||
using MediaBrowser.Common.ScheduledTasks;
|
using MediaBrowser.Common.ScheduledTasks;
|
||||||
|
@ -17,7 +18,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Naming.Audio;
|
using MediaBrowser.Naming.Audio;
|
||||||
using MediaBrowser.Naming.Common;
|
using MediaBrowser.Naming.Common;
|
||||||
using MediaBrowser.Naming.IO;
|
|
||||||
using MediaBrowser.Naming.TV;
|
using MediaBrowser.Naming.TV;
|
||||||
using MediaBrowser.Naming.Video;
|
using MediaBrowser.Naming.Video;
|
||||||
using MediaBrowser.Server.Implementations.Library.Validators;
|
using MediaBrowser.Server.Implementations.Library.Validators;
|
||||||
|
@ -1767,14 +1767,13 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
var resolver = new EpisodeResolver(GetNamingOptions(),
|
var resolver = new EpisodeResolver(GetNamingOptions(),
|
||||||
new PatternsLogger());
|
new PatternsLogger());
|
||||||
|
|
||||||
var fileType = episode.VideoType == VideoType.BluRay || episode.VideoType == VideoType.Dvd || episode.VideoType == VideoType.HdDvd ?
|
var isFolder = episode.VideoType == VideoType.BluRay || episode.VideoType == VideoType.Dvd ||
|
||||||
FileInfoType.Directory :
|
episode.VideoType == VideoType.HdDvd;
|
||||||
FileInfoType.File;
|
|
||||||
|
|
||||||
var locationType = episode.LocationType;
|
var locationType = episode.LocationType;
|
||||||
|
|
||||||
var episodeInfo = locationType == LocationType.FileSystem || locationType == LocationType.Offline ?
|
var episodeInfo = locationType == LocationType.FileSystem || locationType == LocationType.Offline ?
|
||||||
resolver.Resolve(episode.Path, fileType) :
|
resolver.Resolve(episode.Path, isFolder) :
|
||||||
new Naming.TV.EpisodeInfo();
|
new Naming.TV.EpisodeInfo();
|
||||||
|
|
||||||
if (episodeInfo == null)
|
if (episodeInfo == null)
|
||||||
|
@ -1928,10 +1927,10 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
var videoListResolver = new VideoListResolver(GetNamingOptions(), new PatternsLogger());
|
var videoListResolver = new VideoListResolver(GetNamingOptions(), new PatternsLogger());
|
||||||
|
|
||||||
var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new PortableFileInfo
|
var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new FileMetadata
|
||||||
{
|
{
|
||||||
FullName = i.FullName,
|
Id = i.FullName,
|
||||||
Type = GetFileType(i)
|
IsFolder = ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
||||||
|
|
||||||
}).ToList());
|
}).ToList());
|
||||||
|
|
||||||
|
@ -1962,16 +1961,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
}).OrderBy(i => i.Path).ToList();
|
}).OrderBy(i => i.Path).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileInfoType GetFileType(FileSystemInfo info)
|
|
||||||
{
|
|
||||||
if ((info.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
|
||||||
{
|
|
||||||
return FileInfoType.Directory;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FileInfoType.File;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Video> FindExtras(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
public IEnumerable<Video> FindExtras(BaseItem owner, List<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var files = fileSystemChildren.OfType<DirectoryInfo>()
|
var files = fileSystemChildren.OfType<DirectoryInfo>()
|
||||||
|
@ -1981,10 +1970,10 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
var videoListResolver = new VideoListResolver(GetNamingOptions(), new PatternsLogger());
|
var videoListResolver = new VideoListResolver(GetNamingOptions(), new PatternsLogger());
|
||||||
|
|
||||||
var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new PortableFileInfo
|
var videos = videoListResolver.Resolve(fileSystemChildren.Select(i => new FileMetadata
|
||||||
{
|
{
|
||||||
FullName = i.FullName,
|
Id = i.FullName,
|
||||||
Type = GetFileType(i)
|
IsFolder = ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
||||||
|
|
||||||
}).ToList());
|
}).ToList());
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using Interfaces.IO;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -6,7 +7,6 @@ using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Naming.IO;
|
|
||||||
using MediaBrowser.Naming.Video;
|
using MediaBrowser.Naming.Video;
|
||||||
using MediaBrowser.Server.Implementations.Logging;
|
using MediaBrowser.Server.Implementations.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
@ -118,10 +118,10 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||||
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
||||||
|
|
||||||
var resolver = new VideoListResolver(namingOptions, new PatternsLogger());
|
var resolver = new VideoListResolver(namingOptions, new PatternsLogger());
|
||||||
var resolverResult = resolver.Resolve(files.Select(i => new PortableFileInfo
|
var resolverResult = resolver.Resolve(files.Select(i => new FileMetadata
|
||||||
{
|
{
|
||||||
FullName = i.FullName,
|
Id = i.FullName,
|
||||||
Type = FileInfoType.File
|
IsFolder = false
|
||||||
|
|
||||||
}).ToList(), suppportMultiEditions).ToList();
|
}).ToList(), suppportMultiEditions).ToList();
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Naming.Common;
|
using MediaBrowser.Naming.Common;
|
||||||
using MediaBrowser.Naming.IO;
|
|
||||||
using MediaBrowser.Naming.TV;
|
using MediaBrowser.Naming.TV;
|
||||||
using MediaBrowser.Server.Implementations.Logging;
|
using MediaBrowser.Server.Implementations.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
@ -153,7 +152,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||||
}
|
}
|
||||||
|
|
||||||
var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
|
var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
|
||||||
var episodeInfo = episodeResolver.Resolve(fullName, FileInfoType.File, false);
|
var episodeInfo = episodeResolver.Resolve(fullName, false, false);
|
||||||
if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue)
|
if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -50,11 +50,11 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MediaBrowser.Naming, Version=1.0.5509.27636, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MediaBrowser.Naming, Version=1.0.5509.27636, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.32\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.34\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Mono.Nat, Version=1.2.23.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Mono.Nat, Version=1.2.24.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Mono.Nat.1.2.23.0\lib\net40\Mono.Nat.dll</HintPath>
|
<HintPath>..\packages\Mono.Nat.1.2.24.0\lib\net40\Mono.Nat.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MoreLinq, Version=1.1.17511.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL">
|
<Reference Include="MoreLinq, Version=1.1.17511.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
|
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
|
||||||
<package id="MediaBrowser.Naming" version="1.0.0.32" targetFramework="net45" />
|
<package id="MediaBrowser.Naming" version="1.0.0.34" targetFramework="net45" />
|
||||||
<package id="Mono.Nat" version="1.2.23.0" targetFramework="net45" />
|
<package id="Mono.Nat" version="1.2.24.0" targetFramework="net45" />
|
||||||
<package id="morelinq" version="1.1.0" targetFramework="net45" />
|
<package id="morelinq" version="1.1.0" targetFramework="net45" />
|
||||||
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
|
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
|
||||||
<package id="SocketHttpListener" version="1.0.0.5" targetFramework="net45" />
|
<package id="SocketHttpListener" version="1.0.0.5" targetFramework="net45" />
|
||||||
|
|
|
@ -48,6 +48,7 @@ using MediaBrowser.Dlna.ConnectionManager;
|
||||||
using MediaBrowser.Dlna.ContentDirectory;
|
using MediaBrowser.Dlna.ContentDirectory;
|
||||||
using MediaBrowser.Dlna.Main;
|
using MediaBrowser.Dlna.Main;
|
||||||
using MediaBrowser.Dlna.MediaReceiverRegistrar;
|
using MediaBrowser.Dlna.MediaReceiverRegistrar;
|
||||||
|
using MediaBrowser.Dlna.Ssdp;
|
||||||
using MediaBrowser.LocalMetadata.Providers;
|
using MediaBrowser.LocalMetadata.Providers;
|
||||||
using MediaBrowser.MediaEncoding.BdInfo;
|
using MediaBrowser.MediaEncoding.BdInfo;
|
||||||
using MediaBrowser.MediaEncoding.Encoder;
|
using MediaBrowser.MediaEncoding.Encoder;
|
||||||
|
@ -520,6 +521,8 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
MediaEncoder, ChapterManager);
|
MediaEncoder, ChapterManager);
|
||||||
RegisterSingleInstance(EncodingManager);
|
RegisterSingleInstance(EncodingManager);
|
||||||
|
|
||||||
|
RegisterSingleInstance<ISsdpHandler>(new SsdpHandler(LogManager.GetLogger("SsdpHandler"), ServerConfigurationManager, this));
|
||||||
|
|
||||||
var activityLogRepo = await GetActivityLogRepository().ConfigureAwait(false);
|
var activityLogRepo = await GetActivityLogRepository().ConfigureAwait(false);
|
||||||
RegisterSingleInstance(activityLogRepo);
|
RegisterSingleInstance(activityLogRepo);
|
||||||
RegisterSingleInstance<IActivityManager>(new ActivityManager(LogManager.GetLogger("ActivityManager"), activityLogRepo, UserManager));
|
RegisterSingleInstance<IActivityManager>(new ActivityManager(LogManager.GetLogger("ActivityManager"), activityLogRepo, UserManager));
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<copyright>Copyright © Emby 2013</copyright>
|
<copyright>Copyright © Emby 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.622" />
|
<dependency id="MediaBrowser.Common" version="3.0.622" />
|
||||||
<dependency id="NLog" version="3.2.0.0" />
|
<dependency id="NLog" version="3.2.1" />
|
||||||
<dependency id="SimpleInjector" version="2.7.0" />
|
<dependency id="SimpleInjector" version="2.7.0" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user