Merge pull request #2161 from MediaBrowser/dev

Dev
pull/702/head
Luke 8 years ago committed by GitHub
commit 480b9c323a

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

@ -506,6 +506,8 @@ namespace MediaBrowser.Controller.Library
/// <returns>QueryResult&lt;BaseItem&gt;.</returns>
QueryResult<BaseItem> QueryItems(InternalItemsQuery query);
string GetPathAfterNetworkSubstitution(string path);
/// <summary>
/// Substitutes the path.
/// </summary>

@ -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();
}

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

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

@ -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;
}
/// <summary>
/// Defines the entry point of the application.
/// </summary>
/// Defines the entry point of the application.
/// </summary>
public static void Main()
{
var options = new StartupOptions();

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

Loading…
Cancel
Save