From e92071330897bf08fe898b0fdac1665f9f99d547 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 28 Jan 2014 20:45:48 -0500 Subject: [PATCH] fix musicbrainx user agent --- .../Music/MusicBrainzAlbumProvider.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs index e678271f2..52405a63b 100644 --- a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Net; +using MediaBrowser.Common; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -20,11 +21,13 @@ namespace MediaBrowser.Providers.Music internal static MusicBrainzAlbumProvider Current; private readonly IHttpClient _httpClient; + private readonly IApplicationHost _appHost; - public MusicBrainzAlbumProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IHttpClient httpClient) + public MusicBrainzAlbumProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IHttpClient httpClient, IApplicationHost appHost) : base(logManager, configurationManager) { _httpClient = httpClient; + _appHost = appHost; Current = this; } @@ -189,11 +192,13 @@ namespace MediaBrowser.Providers.Music var doc = new XmlDocument(); + var userAgent = _appHost.Name + "/" + _appHost.ApplicationVersion; + using (var xml = await _httpClient.Get(new HttpRequestOptions { Url = url, CancellationToken = cancellationToken, - UserAgent = Environment.MachineName + UserAgent = userAgent }).ConfigureAwait(false)) {