Merge pull request #2979 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-10-27 00:15:18 -04:00 committed by GitHub
commit 472afb7722
8 changed files with 52 additions and 85 deletions

View File

@ -860,55 +860,35 @@ namespace Emby.Dlna.Didl
{
AddCommonFields(item, itemStubType, context, writer, filter);
var audio = item as Audio;
var hasArtists = item as IHasArtist;
var hasAlbumArtists = item as IHasAlbumArtist;
if (audio != null)
if (hasArtists != null)
{
foreach (var artist in audio.Artists)
foreach (var artist in hasArtists.Artists)
{
AddValue(writer, "upnp", "artist", artist, NS_UPNP);
}
AddValue(writer, "dc", "creator", artist, NS_DC);
if (!string.IsNullOrEmpty(audio.Album))
{
AddValue(writer, "upnp", "album", audio.Album, NS_UPNP);
}
foreach (var artist in audio.AlbumArtists)
{
AddAlbumArtist(writer, artist);
// If it doesn't support album artists (musicvideo), then tag as both
if (hasAlbumArtists == null)
{
AddAlbumArtist(writer, artist);
}
}
}
var album = item as MusicAlbum;
if (album != null)
if (hasAlbumArtists != null)
{
foreach (var artist in album.AlbumArtists)
foreach (var albumArtist in hasAlbumArtists.AlbumArtists)
{
AddAlbumArtist(writer, artist);
AddValue(writer, "upnp", "artist", artist, NS_UPNP);
}
foreach (var artist in album.Artists)
{
AddValue(writer, "upnp", "artist", artist, NS_UPNP);
AddAlbumArtist(writer, albumArtist);
}
}
var musicVideo = item as MusicVideo;
if (musicVideo != null)
if (!string.IsNullOrWhiteSpace(item.Album))
{
foreach (var artist in musicVideo.Artists)
{
AddValue(writer, "upnp", "artist", artist, NS_UPNP);
AddAlbumArtist(writer, artist);
}
if (!string.IsNullOrEmpty(musicVideo.Album))
{
AddValue(writer, "upnp", "album", musicVideo.Album, NS_UPNP);
}
AddValue(writer, "upnp", "album", item.Album, NS_UPNP);
}
if (item.IndexNumber.HasValue)

View File

@ -124,18 +124,6 @@ namespace Emby.Server.Implementations.HttpClientManager
}
}
private void AddIpv4Option(HttpWebRequest request, HttpRequestOptions options)
{
request.ServicePoint.BindIPEndPointDelegate = (servicePount, remoteEndPoint, retryCount) =>
{
if (remoteEndPoint.AddressFamily == AddressFamily.InterNetwork)
{
return new IPEndPoint(IPAddress.Any, 0);
}
throw new InvalidOperationException("no IPv4 address");
};
}
private WebRequest GetRequest(HttpRequestOptions options, string method)
{
var url = options.Url;
@ -153,11 +141,6 @@ namespace Emby.Server.Implementations.HttpClientManager
if (httpWebRequest != null)
{
if (options.PreferIpv4)
{
AddIpv4Option(httpWebRequest, options);
}
AddRequestHeaders(httpWebRequest, options);
if (options.EnableHttpCompression)

View File

@ -506,7 +506,7 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException("type");
}
if (ConfigurationManager.Configuration.EnableLocalizedGuids && key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
{
// Try to normalize paths located underneath program-data in an attempt to make them more portable
key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)

View File

@ -103,7 +103,9 @@ namespace Emby.Server.Implementations.Networking
}
return endpoint.StartsWith("localhost", StringComparison.OrdinalIgnoreCase) ||
endpoint.StartsWith("127.0.0.1", StringComparison.OrdinalIgnoreCase) ||
endpoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) ||
endpoint.StartsWith("192.168", StringComparison.OrdinalIgnoreCase) ||
endpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase) ||
IsInPrivateAddressSpaceAndLocalSubnet(endpoint);
}
@ -111,7 +113,6 @@ namespace Emby.Server.Implementations.Networking
{
var endpointFirstPart = endpoint.Split('.')[0];
string subnet_Match = "";
if (
endpoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) ||
endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) ||
@ -119,38 +120,40 @@ namespace Emby.Server.Implementations.Networking
endpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase)
)
{
foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
foreach (UnicastIPAddressInformation unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0])
{
int subnet_Test = 0;
foreach (string part in unicastIPAddressInformation.IPv4Mask.ToString().Split('.'))
{
if (part.Equals("0")) break;
subnet_Test++;
}
var subnets = GetSubnets(endpointFirstPart);
subnet_Match = String.Join(".", unicastIPAddressInformation.Address.ToString().Split('.').Take(subnet_Test).ToArray());
}
foreach (var subnet_Match in subnets)
{
//Logger.Debug("subnet_Match:" + subnet_Match);
if (endpoint.StartsWith(subnet_Match + ".", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
}
return endpoint.StartsWith(subnet_Match + ".", StringComparison.OrdinalIgnoreCase);
return false;
}
private Dictionary<string, string> _subnetLookup = new Dictionary<string, string>(StringComparer.Ordinal);
private string GetSubnet(string endpointFirstPart)
private Dictionary<string, List<string>> _subnetLookup = new Dictionary<string, List<string>>(StringComparer.Ordinal);
private List<string> GetSubnets(string endpointFirstPart)
{
string subnet_Match = "";
List<string> subnets;
lock (_subnetLookup)
{
if (_subnetLookup.TryGetValue(endpointFirstPart, out subnet_Match))
if (_subnetLookup.TryGetValue(endpointFirstPart, out subnets))
{
return subnet_Match;
return subnets;
}
subnets = new List<string>();
foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
{
foreach (UnicastIPAddressInformation unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
{
if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0])
{
int subnet_Test = 0;
@ -160,16 +163,21 @@ namespace Emby.Server.Implementations.Networking
subnet_Test++;
}
subnet_Match = String.Join(".", unicastIPAddressInformation.Address.ToString().Split('.').Take(subnet_Test).ToArray());
var subnet_Match = String.Join(".", unicastIPAddressInformation.Address.ToString().Split('.').Take(subnet_Test).ToArray());
// TODO: Is this check necessary?
if (adapter.OperationalStatus == OperationalStatus.Up)
{
subnets.Add(subnet_Match);
}
}
if (!string.IsNullOrWhiteSpace(subnet_Match))
{
_subnetLookup[endpointFirstPart] = subnet_Match;
}
}
}
return subnet_Match;
_subnetLookup[endpointFirstPart] = subnets;
return subnets;
}
}
private bool Is172AddressPrivate(string endpoint)

View File

@ -91,7 +91,6 @@ namespace MediaBrowser.Api
{
config.EnableCaseSensitiveItemIds = true;
config.SkipDeserializationForBasicTypes = true;
config.EnableLocalizedGuids = true;
config.EnableSimpleArtistDetection = true;
config.EnableNormalizedItemByNameIds = true;
config.DisableLiveTvChannelUserDataName = true;

View File

@ -101,7 +101,6 @@ namespace MediaBrowser.Common.Net
public TimeSpan CacheLength { get; set; }
public int TimeoutMs { get; set; }
public bool PreferIpv4 { get; set; }
public bool EnableDefaultUserAgent { get; set; }
public bool AppendCharsetToMimeType { get; set; }

View File

@ -46,7 +46,6 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
/// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>
public bool EnableHttps { get; set; }
public bool EnableLocalizedGuids { get; set; }
public bool EnableNormalizedItemByNameIds { get; set; }
/// <summary>
@ -198,7 +197,6 @@ namespace MediaBrowser.Model.Configuration
LocalNetworkAddresses = new string[] { };
CodecsUsed = new string[] { };
ImageExtractionTimeoutMs = 0;
EnableLocalizedGuids = true;
PathSubstitutions = new PathSubstitution[] { };
EnableSimpleArtistDetection = true;

View File

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.33.20")]
[assembly: AssemblyVersion("3.2.34.1")]