blob: c0a681b11888bd9ccea8f6a9bd6380a384cf3f03 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
From 7e756d97b13be1301c487375a5589060a8befb76 Mon Sep 17 00:00:00 2001
From: Gabriel Burt <gabriel.burt@gmail.com>
Date: Wed, 04 May 2011 21:03:32 +0000
Subject: MusicBrainz: Allow specifying a UserAgent
MB now requires a UserAgent to be set. This change will let Banshee set
one.
---
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs
index 1a2732a..d83261e 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs
@@ -389,7 +389,8 @@ namespace MusicBrainz
if (min_interval > time)
Thread.Sleep ((min_interval - time).Milliseconds);
- WebRequest request = WebRequest.Create (url);
+ var request = WebRequest.Create (url) as HttpWebRequest;
+ request.UserAgent = MusicBrainzService.UserAgent;
if (cache_implemented == null) {
try {
request.CachePolicy = MusicBrainzService.CachePolicy;
diff --git a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzService.cs b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzService.cs
index 5e860db..f868e2b 100644
--- a/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzService.cs
+++ b/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzService.cs
@@ -36,6 +36,8 @@ namespace MusicBrainz
}
}
+ public static string UserAgent { get; set; }
+
static RequestCachePolicy cache_policy;
public static RequestCachePolicy CachePolicy {
get { return cache_policy; }
--
cgit v0.9
|