diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 55aaf04ff..2a49168ed 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -2111,10 +2111,7 @@ namespace MediaBrowser.Controller.Entities
{
if (locationType == LocationType.FileSystem || locationType == LocationType.Offline)
{
- foreach (var map in ConfigurationManager.Configuration.PathSubstitutions)
- {
- path = LibraryManager.SubstitutePath(path, map.From, map.To);
- }
+ return LibraryManager.GetPathAfterNetworkSubstitution(path);
}
return path;
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs
index 04268bcea..d5c2fcd20 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -506,6 +506,8 @@ namespace MediaBrowser.Controller.Library
/// QueryResult<BaseItem>.
QueryResult QueryItems(InternalItemsQuery query);
+ string GetPathAfterNetworkSubstitution(string path);
+
///
/// Substitutes the path.
///
diff --git a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs
index af03f325f..0ab41020e 100644
--- a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs
+++ b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs
@@ -343,7 +343,8 @@ namespace MediaBrowser.Dlna.Main
if (_Publisher != null)
{
var devices = _Publisher.Devices.ToList();
- foreach (var device in devices)
+
+ Parallel.ForEach(devices, device =>
{
try
{
@@ -353,7 +354,18 @@ namespace MediaBrowser.Dlna.Main
{
_logger.ErrorException("Error sending bye bye", ex);
}
- }
+ });
+ //foreach (var device in devices)
+ //{
+ // try
+ // {
+ // _Publisher.RemoveDevice(device);
+ // }
+ // catch (Exception ex)
+ // {
+ // _logger.ErrorException("Error sending bye bye", ex);
+ // }
+ //}
_Publisher.Dispose();
}
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index 9284f4fc7..3236c38d5 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -1516,10 +1516,7 @@ namespace MediaBrowser.Server.Implementations.Dto
if (locationType == LocationType.FileSystem || locationType == LocationType.Offline)
{
- foreach (var map in _config.Configuration.PathSubstitutions)
- {
- path = _libraryManager.SubstitutePath(path, map.From, map.To);
- }
+ path = _libraryManager.GetPathAfterNetworkSubstitution(path);
}
return path;
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index 442e2ebe5..bd408c9d3 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -2527,6 +2527,16 @@ namespace MediaBrowser.Server.Implementations.Library
}).OrderBy(i => i.Path).ToList();
}
+ public string GetPathAfterNetworkSubstitution(string path)
+ {
+ foreach (var map in ConfigurationManager.Configuration.PathSubstitutions)
+ {
+ path = SubstitutePath(path, map.From, map.To);
+ }
+
+ return path;
+ }
+
public string SubstitutePath(string path, string from, string to)
{
if (string.IsNullOrWhiteSpace(path))
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index cdacdc81f..5d4fba32d 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -15,6 +15,7 @@ using System.Linq;
using System.Management;
using System.Runtime.InteropServices;
using System.ServiceProcess;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -37,9 +38,31 @@ namespace MediaBrowser.ServerApplication
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool SetDllDirectory(string lpPathName);
+ public static bool TryGetLocalFromUncDirectory(string local, out string unc)
+ {
+ if ((local == null) || (local == ""))
+ {
+ unc = "";
+ throw new ArgumentNullException("local");
+ }
+
+ ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Name FROM Win32_share WHERE path ='" + local.Replace("\\", "\\\\") + "'");
+ ManagementObjectCollection coll = searcher.Get();
+ if (coll.Count == 1)
+ {
+ foreach (ManagementObject share in searcher.Get())
+ {
+ unc = share["Name"] as String;
+ unc = "\\\\" + SystemInformation.ComputerName + "\\" + unc;
+ return true;
+ }
+ }
+ unc = "";
+ return false;
+ }
///
- /// Defines the entry point of the application.
- ///
+ /// Defines the entry point of the application.
+ ///
public static void Main()
{
var options = new StartupOptions();
diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
index 290ea588e..dc208d495 100644
--- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
+++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
@@ -1040,12 +1040,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
private static string GetPathToSave(string path, ILibraryManager libraryManager, IServerConfigurationManager config)
{
- foreach (var map in config.Configuration.PathSubstitutions)
- {
- path = libraryManager.SubstitutePath(path, map.From, map.To);
- }
-
- return path;
+ return libraryManager.GetPathAfterNetworkSubstitution(path);
}
private static bool IsPersonType(PersonInfo person, string type)