|
|
|
@ -29,7 +29,6 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
private readonly IApplicationHost _appHost;
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
private readonly IJsonSerializer _json;
|
|
|
|
|
private readonly IXmlReaderSettingsFactory _xmlSettings;
|
|
|
|
|
|
|
|
|
|
public readonly string MusicBrainzBaseUrl;
|
|
|
|
|
|
|
|
|
@ -38,15 +37,15 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
IApplicationHost appHost,
|
|
|
|
|
ILogger logger,
|
|
|
|
|
IJsonSerializer json,
|
|
|
|
|
IXmlReaderSettingsFactory xmlSettings,
|
|
|
|
|
IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
_httpClient = httpClient;
|
|
|
|
|
_appHost = appHost;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_json = json;
|
|
|
|
|
_xmlSettings = xmlSettings;
|
|
|
|
|
|
|
|
|
|
MusicBrainzBaseUrl = configuration["MusicBrainz:BaseUrl"];
|
|
|
|
|
|
|
|
|
|
Current = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -109,11 +108,13 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
{
|
|
|
|
|
using (var oReader = new StreamReader(stream, Encoding.UTF8))
|
|
|
|
|
{
|
|
|
|
|
var settings = _xmlSettings.Create(false);
|
|
|
|
|
|
|
|
|
|
settings.CheckCharacters = false;
|
|
|
|
|
settings.IgnoreProcessingInstructions = true;
|
|
|
|
|
settings.IgnoreComments = true;
|
|
|
|
|
var settings = new XmlReaderSettings()
|
|
|
|
|
{
|
|
|
|
|
ValidationType = ValidationType.None,
|
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
IgnoreComments = true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using (var reader = XmlReader.Create(oReader, settings))
|
|
|
|
|
{
|
|
|
|
@ -248,16 +249,16 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
artistId);
|
|
|
|
|
|
|
|
|
|
using (var response = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false))
|
|
|
|
|
{
|
|
|
|
|
using (var stream = response.Content)
|
|
|
|
|
{
|
|
|
|
|
using (var oReader = new StreamReader(stream, Encoding.UTF8))
|
|
|
|
|
{
|
|
|
|
|
var settings = _xmlSettings.Create(false);
|
|
|
|
|
|
|
|
|
|
settings.CheckCharacters = false;
|
|
|
|
|
settings.IgnoreProcessingInstructions = true;
|
|
|
|
|
settings.IgnoreComments = true;
|
|
|
|
|
var settings = new XmlReaderSettings()
|
|
|
|
|
{
|
|
|
|
|
ValidationType = ValidationType.None,
|
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
IgnoreComments = true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using (var reader = XmlReader.Create(oReader, settings))
|
|
|
|
|
{
|
|
|
|
@ -265,8 +266,6 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task<ReleaseResult> GetReleaseResultByArtistName(string albumName, string artistName, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
@ -275,16 +274,16 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
WebUtility.UrlEncode(artistName));
|
|
|
|
|
|
|
|
|
|
using (var response = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false))
|
|
|
|
|
{
|
|
|
|
|
using (var stream = response.Content)
|
|
|
|
|
{
|
|
|
|
|
using (var oReader = new StreamReader(stream, Encoding.UTF8))
|
|
|
|
|
{
|
|
|
|
|
var settings = _xmlSettings.Create(false);
|
|
|
|
|
|
|
|
|
|
settings.CheckCharacters = false;
|
|
|
|
|
settings.IgnoreProcessingInstructions = true;
|
|
|
|
|
settings.IgnoreComments = true;
|
|
|
|
|
var settings = new XmlReaderSettings()
|
|
|
|
|
{
|
|
|
|
|
ValidationType = ValidationType.None,
|
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
IgnoreComments = true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using (var reader = XmlReader.Create(oReader, settings))
|
|
|
|
|
{
|
|
|
|
@ -292,8 +291,6 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class ReleaseResult
|
|
|
|
|
{
|
|
|
|
@ -598,16 +595,16 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId);
|
|
|
|
|
|
|
|
|
|
using (var response = await GetMusicBrainzResponse(url, true, true, cancellationToken).ConfigureAwait(false))
|
|
|
|
|
{
|
|
|
|
|
using (var stream = response.Content)
|
|
|
|
|
{
|
|
|
|
|
using (var oReader = new StreamReader(stream, Encoding.UTF8))
|
|
|
|
|
{
|
|
|
|
|
var settings = _xmlSettings.Create(false);
|
|
|
|
|
|
|
|
|
|
settings.CheckCharacters = false;
|
|
|
|
|
settings.IgnoreProcessingInstructions = true;
|
|
|
|
|
settings.IgnoreComments = true;
|
|
|
|
|
var settings = new XmlReaderSettings()
|
|
|
|
|
{
|
|
|
|
|
ValidationType = ValidationType.None,
|
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
IgnoreComments = true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using (var reader = XmlReader.Create(oReader, settings))
|
|
|
|
|
{
|
|
|
|
@ -619,8 +616,6 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
@ -636,16 +631,16 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
var url = string.Format("/ws/2/release-group/?query=reid:{0}", releaseEntryId);
|
|
|
|
|
|
|
|
|
|
using (var response = await GetMusicBrainzResponse(url, false, cancellationToken).ConfigureAwait(false))
|
|
|
|
|
{
|
|
|
|
|
using (var stream = response.Content)
|
|
|
|
|
{
|
|
|
|
|
using (var oReader = new StreamReader(stream, Encoding.UTF8))
|
|
|
|
|
{
|
|
|
|
|
var settings = _xmlSettings.Create(false);
|
|
|
|
|
|
|
|
|
|
settings.CheckCharacters = false;
|
|
|
|
|
settings.IgnoreProcessingInstructions = true;
|
|
|
|
|
settings.IgnoreComments = true;
|
|
|
|
|
var settings = new XmlReaderSettings()
|
|
|
|
|
{
|
|
|
|
|
ValidationType = ValidationType.None,
|
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
IgnoreComments = true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using (var reader = XmlReader.Create(oReader, settings))
|
|
|
|
|
{
|
|
|
|
@ -687,8 +682,6 @@ namespace MediaBrowser.Providers.Music
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetFirstReleaseGroupId(XmlReader reader)
|
|
|
|
|
{
|
|
|
|
|