MusicBrainzAlbumProvider.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Net;
  7. using System.Text;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. using System.Xml;
  11. using MediaBrowser.Common;
  12. using MediaBrowser.Common.Net;
  13. using MediaBrowser.Controller.Entities.Audio;
  14. using MediaBrowser.Controller.Providers;
  15. using MediaBrowser.Model.Entities;
  16. using MediaBrowser.Model.Providers;
  17. using MediaBrowser.Model.Serialization;
  18. using MediaBrowser.Model.Xml;
  19. using Microsoft.Extensions.Logging;
  20. namespace MediaBrowser.Providers.Music
  21. {
  22. public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, AlbumInfo>, IHasOrder
  23. {
  24. internal static MusicBrainzAlbumProvider Current;
  25. private readonly IHttpClient _httpClient;
  26. private readonly IApplicationHost _appHost;
  27. private readonly ILogger _logger;
  28. private readonly IJsonSerializer _json;
  29. private readonly IXmlReaderSettingsFactory _xmlSettings;
  30. public static string MusicBrainzBaseUrl = "https://www.musicbrainz.org";
  31. public MusicBrainzAlbumProvider(IHttpClient httpClient, IApplicationHost appHost, ILogger logger, IJsonSerializer json, IXmlReaderSettingsFactory xmlSettings)
  32. {
  33. _httpClient = httpClient;
  34. _appHost = appHost;
  35. _logger = logger;
  36. _json = json;
  37. _xmlSettings = xmlSettings;
  38. Current = this;
  39. }
  40. public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(AlbumInfo searchInfo, CancellationToken cancellationToken)
  41. {
  42. var releaseId = searchInfo.GetReleaseId();
  43. var releaseGroupId = searchInfo.GetReleaseGroupId();
  44. string url = null;
  45. var isNameSearch = false;
  46. bool forceMusicBrainzProper = false;
  47. if (!string.IsNullOrEmpty(releaseId))
  48. {
  49. url = string.Format("/ws/2/release/?query=reid:{0}", releaseId);
  50. }
  51. else if (!string.IsNullOrEmpty(releaseGroupId))
  52. {
  53. url = string.Format("/ws/2/release?release-group={0}", releaseGroupId);
  54. forceMusicBrainzProper = true;
  55. }
  56. else
  57. {
  58. var artistMusicBrainzId = searchInfo.GetMusicBrainzArtistId();
  59. if (!string.IsNullOrWhiteSpace(artistMusicBrainzId))
  60. {
  61. url = string.Format("/ws/2/release/?query=\"{0}\" AND arid:{1}",
  62. WebUtility.UrlEncode(searchInfo.Name),
  63. artistMusicBrainzId);
  64. }
  65. else
  66. {
  67. isNameSearch = true;
  68. // I'm sure there is a better way but for now it resolves search for 12" Mixes
  69. var queryName = searchInfo.Name.Replace("\"", string.Empty);
  70. url = string.Format("/ws/2/release/?query=\"{0}\" AND artist:\"{1}\"",
  71. WebUtility.UrlEncode(queryName),
  72. WebUtility.UrlEncode(searchInfo.GetAlbumArtist()));
  73. }
  74. }
  75. if (!string.IsNullOrWhiteSpace(url))
  76. {
  77. using (var response = await GetMusicBrainzResponse(url, isNameSearch, forceMusicBrainzProper, cancellationToken).ConfigureAwait(false))
  78. {
  79. using (var stream = response.Content)
  80. {
  81. return GetResultsFromResponse(stream);
  82. }
  83. }
  84. }
  85. return new List<RemoteSearchResult>();
  86. }
  87. private List<RemoteSearchResult> GetResultsFromResponse(Stream stream)
  88. {
  89. using (var oReader = new StreamReader(stream, Encoding.UTF8))
  90. {
  91. var settings = _xmlSettings.Create(false);
  92. settings.CheckCharacters = false;
  93. settings.IgnoreProcessingInstructions = true;
  94. settings.IgnoreComments = true;
  95. using (var reader = XmlReader.Create(oReader, settings))
  96. {
  97. var results = ReleaseResult.Parse(reader);
  98. return results.Select(i =>
  99. {
  100. var result = new RemoteSearchResult
  101. {
  102. Name = i.Title,
  103. ProductionYear = i.Year
  104. };
  105. if (i.Artists.Count > 0)
  106. {
  107. result.AlbumArtist = new RemoteSearchResult
  108. {
  109. SearchProviderName = Name,
  110. Name = i.Artists[0].Item1
  111. };
  112. result.AlbumArtist.SetProviderId(MetadataProviders.MusicBrainzArtist, i.Artists[0].Item2);
  113. }
  114. if (!string.IsNullOrWhiteSpace(i.ReleaseId))
  115. {
  116. result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseId);
  117. }
  118. if (!string.IsNullOrWhiteSpace(i.ReleaseGroupId))
  119. {
  120. result.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, i.ReleaseGroupId);
  121. }
  122. return result;
  123. }).ToList();
  124. }
  125. }
  126. }
  127. public async Task<MetadataResult<MusicAlbum>> GetMetadata(AlbumInfo id, CancellationToken cancellationToken)
  128. {
  129. var releaseId = id.GetReleaseId();
  130. var releaseGroupId = id.GetReleaseGroupId();
  131. var result = new MetadataResult<MusicAlbum>
  132. {
  133. Item = new MusicAlbum()
  134. };
  135. // If we have a release group Id but not a release Id...
  136. if (string.IsNullOrWhiteSpace(releaseId) && !string.IsNullOrWhiteSpace(releaseGroupId))
  137. {
  138. releaseId = await GetReleaseIdFromReleaseGroupId(releaseGroupId, cancellationToken).ConfigureAwait(false);
  139. result.HasMetadata = true;
  140. }
  141. if (string.IsNullOrWhiteSpace(releaseId))
  142. {
  143. var artistMusicBrainzId = id.GetMusicBrainzArtistId();
  144. var releaseResult = await GetReleaseResult(artistMusicBrainzId, id.GetAlbumArtist(), id.Name, cancellationToken).ConfigureAwait(false);
  145. if (releaseResult != null)
  146. {
  147. if (!string.IsNullOrWhiteSpace(releaseResult.ReleaseId))
  148. {
  149. releaseId = releaseResult.ReleaseId;
  150. result.HasMetadata = true;
  151. }
  152. if (!string.IsNullOrWhiteSpace(releaseResult.ReleaseGroupId))
  153. {
  154. releaseGroupId = releaseResult.ReleaseGroupId;
  155. result.HasMetadata = true;
  156. }
  157. result.Item.ProductionYear = releaseResult.Year;
  158. result.Item.Overview = releaseResult.Overview;
  159. }
  160. }
  161. // If we have a release Id but not a release group Id...
  162. if (!string.IsNullOrWhiteSpace(releaseId) && string.IsNullOrWhiteSpace(releaseGroupId))
  163. {
  164. releaseGroupId = await GetReleaseGroupFromReleaseId(releaseId, cancellationToken).ConfigureAwait(false);
  165. result.HasMetadata = true;
  166. }
  167. if (!string.IsNullOrWhiteSpace(releaseId) || !string.IsNullOrWhiteSpace(releaseGroupId))
  168. {
  169. result.HasMetadata = true;
  170. }
  171. if (result.HasMetadata)
  172. {
  173. if (!string.IsNullOrEmpty(releaseId))
  174. {
  175. result.Item.SetProviderId(MetadataProviders.MusicBrainzAlbum, releaseId);
  176. }
  177. if (!string.IsNullOrEmpty(releaseGroupId))
  178. {
  179. result.Item.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, releaseGroupId);
  180. }
  181. }
  182. return result;
  183. }
  184. public string Name => "MusicBrainz";
  185. private Task<ReleaseResult> GetReleaseResult(string artistMusicBrainId, string artistName, string albumName, CancellationToken cancellationToken)
  186. {
  187. if (!string.IsNullOrEmpty(artistMusicBrainId))
  188. {
  189. return GetReleaseResult(albumName, artistMusicBrainId, cancellationToken);
  190. }
  191. if (string.IsNullOrWhiteSpace(artistName))
  192. {
  193. return Task.FromResult(new ReleaseResult());
  194. }
  195. return GetReleaseResultByArtistName(albumName, artistName, cancellationToken);
  196. }
  197. private async Task<ReleaseResult> GetReleaseResult(string albumName, string artistId, CancellationToken cancellationToken)
  198. {
  199. var url = string.Format("/ws/2/release/?query=\"{0}\" AND arid:{1}",
  200. WebUtility.UrlEncode(albumName),
  201. artistId);
  202. using (var response = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false))
  203. {
  204. using (var stream = response.Content)
  205. {
  206. using (var oReader = new StreamReader(stream, Encoding.UTF8))
  207. {
  208. var settings = _xmlSettings.Create(false);
  209. settings.CheckCharacters = false;
  210. settings.IgnoreProcessingInstructions = true;
  211. settings.IgnoreComments = true;
  212. using (var reader = XmlReader.Create(oReader, settings))
  213. {
  214. return ReleaseResult.Parse(reader).FirstOrDefault();
  215. }
  216. }
  217. }
  218. }
  219. }
  220. private async Task<ReleaseResult> GetReleaseResultByArtistName(string albumName, string artistName, CancellationToken cancellationToken)
  221. {
  222. var url = string.Format("/ws/2/release/?query=\"{0}\" AND artist:\"{1}\"",
  223. WebUtility.UrlEncode(albumName),
  224. WebUtility.UrlEncode(artistName));
  225. using (var response = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false))
  226. {
  227. using (var stream = response.Content)
  228. {
  229. using (var oReader = new StreamReader(stream, Encoding.UTF8))
  230. {
  231. var settings = _xmlSettings.Create(false);
  232. settings.CheckCharacters = false;
  233. settings.IgnoreProcessingInstructions = true;
  234. settings.IgnoreComments = true;
  235. using (var reader = XmlReader.Create(oReader, settings))
  236. {
  237. return ReleaseResult.Parse(reader).FirstOrDefault();
  238. }
  239. }
  240. }
  241. }
  242. }
  243. private class ReleaseResult
  244. {
  245. public string ReleaseId;
  246. public string ReleaseGroupId;
  247. public string Title;
  248. public string Overview;
  249. public int? Year;
  250. public List<ValueTuple<string, string>> Artists = new List<ValueTuple<string, string>>();
  251. public static List<ReleaseResult> Parse(XmlReader reader)
  252. {
  253. reader.MoveToContent();
  254. reader.Read();
  255. // Loop through each element
  256. while (!reader.EOF && reader.ReadState == ReadState.Interactive)
  257. {
  258. if (reader.NodeType == XmlNodeType.Element)
  259. {
  260. switch (reader.Name)
  261. {
  262. case "release-list":
  263. {
  264. if (reader.IsEmptyElement)
  265. {
  266. reader.Read();
  267. continue;
  268. }
  269. using (var subReader = reader.ReadSubtree())
  270. {
  271. return ParseReleaseList(subReader);
  272. }
  273. }
  274. default:
  275. {
  276. reader.Skip();
  277. break;
  278. }
  279. }
  280. }
  281. else
  282. {
  283. reader.Read();
  284. }
  285. }
  286. return new List<ReleaseResult>();
  287. }
  288. private static List<ReleaseResult> ParseReleaseList(XmlReader reader)
  289. {
  290. var list = new List<ReleaseResult>();
  291. reader.MoveToContent();
  292. reader.Read();
  293. // Loop through each element
  294. while (!reader.EOF && reader.ReadState == ReadState.Interactive)
  295. {
  296. if (reader.NodeType == XmlNodeType.Element)
  297. {
  298. switch (reader.Name)
  299. {
  300. case "release":
  301. {
  302. if (reader.IsEmptyElement)
  303. {
  304. reader.Read();
  305. continue;
  306. }
  307. var releaseId = reader.GetAttribute("id");
  308. using (var subReader = reader.ReadSubtree())
  309. {
  310. var release = ParseRelease(subReader, releaseId);
  311. if (release != null)
  312. {
  313. list.Add(release);
  314. }
  315. }
  316. break;
  317. }
  318. default:
  319. {
  320. reader.Skip();
  321. break;
  322. }
  323. }
  324. }
  325. else
  326. {
  327. reader.Read();
  328. }
  329. }
  330. return list;
  331. }
  332. private static ReleaseResult ParseRelease(XmlReader reader, string releaseId)
  333. {
  334. var result = new ReleaseResult
  335. {
  336. ReleaseId = releaseId
  337. };
  338. reader.MoveToContent();
  339. reader.Read();
  340. // http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
  341. // Loop through each element
  342. while (!reader.EOF && reader.ReadState == ReadState.Interactive)
  343. {
  344. if (reader.NodeType == XmlNodeType.Element)
  345. {
  346. switch (reader.Name)
  347. {
  348. case "title":
  349. {
  350. result.Title = reader.ReadElementContentAsString();
  351. break;
  352. }
  353. case "date":
  354. {
  355. var val = reader.ReadElementContentAsString();
  356. if (DateTime.TryParse(val, out var date))
  357. {
  358. result.Year = date.Year;
  359. }
  360. break;
  361. }
  362. case "annotation":
  363. {
  364. result.Overview = reader.ReadElementContentAsString();
  365. break;
  366. }
  367. case "release-group":
  368. {
  369. result.ReleaseGroupId = reader.GetAttribute("id");
  370. reader.Skip();
  371. break;
  372. }
  373. case "artist-credit":
  374. {
  375. // TODO
  376. /*
  377. * <artist-credit>
  378. <name-credit>
  379. <artist id="e225cda5-882d-4b80-b8a3-b36d7175b1ea">
  380. <name>SARCASTIC+ZOOKEEPER</name>
  381. <sort-name>SARCASTIC+ZOOKEEPER</sort-name>
  382. </artist>
  383. </name-credit>
  384. </artist-credit>
  385. */
  386. using (var subReader = reader.ReadSubtree())
  387. {
  388. var artist = ParseArtistCredit(subReader);
  389. if (!string.IsNullOrEmpty(artist.Item1))
  390. {
  391. result.Artists.Add(artist);
  392. }
  393. }
  394. break;
  395. }
  396. default:
  397. {
  398. reader.Skip();
  399. break;
  400. }
  401. }
  402. }
  403. else
  404. {
  405. reader.Read();
  406. }
  407. }
  408. return result;
  409. }
  410. }
  411. private static ValueTuple<string, string> ParseArtistCredit(XmlReader reader)
  412. {
  413. reader.MoveToContent();
  414. reader.Read();
  415. // http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
  416. // Loop through each element
  417. while (!reader.EOF && reader.ReadState == ReadState.Interactive)
  418. {
  419. if (reader.NodeType == XmlNodeType.Element)
  420. {
  421. switch (reader.Name)
  422. {
  423. case "name-credit":
  424. {
  425. using (var subReader = reader.ReadSubtree())
  426. {
  427. return ParseArtistNameCredit(subReader);
  428. }
  429. }
  430. default:
  431. {
  432. reader.Skip();
  433. break;
  434. }
  435. }
  436. }
  437. else
  438. {
  439. reader.Read();
  440. }
  441. }
  442. return new ValueTuple<string, string>();
  443. }
  444. private static ValueTuple<string, string> ParseArtistNameCredit(XmlReader reader)
  445. {
  446. reader.MoveToContent();
  447. reader.Read();
  448. string name = null;
  449. // http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
  450. // Loop through each element
  451. while (!reader.EOF && reader.ReadState == ReadState.Interactive)
  452. {
  453. if (reader.NodeType == XmlNodeType.Element)
  454. {
  455. switch (reader.Name)
  456. {
  457. case "artist":
  458. {
  459. var id = reader.GetAttribute("id");
  460. using (var subReader = reader.ReadSubtree())
  461. {
  462. return ParseArtistArtistCredit(subReader, id);
  463. }
  464. }
  465. default:
  466. {
  467. reader.Skip();
  468. break;
  469. }
  470. }
  471. }
  472. else
  473. {
  474. reader.Read();
  475. }
  476. }
  477. return new ValueTuple<string, string>(name, null);
  478. }
  479. private static ValueTuple<string, string> ParseArtistArtistCredit(XmlReader reader, string artistId)
  480. {
  481. reader.MoveToContent();
  482. reader.Read();
  483. string name = null;
  484. // http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
  485. // Loop through each element
  486. while (!reader.EOF && reader.ReadState == ReadState.Interactive)
  487. {
  488. if (reader.NodeType == XmlNodeType.Element)
  489. {
  490. switch (reader.Name)
  491. {
  492. case "name":
  493. {
  494. name = reader.ReadElementContentAsString();
  495. break;
  496. }
  497. default:
  498. {
  499. reader.Skip();
  500. break;
  501. }
  502. }
  503. }
  504. else
  505. {
  506. reader.Read();
  507. }
  508. }
  509. return new ValueTuple<string, string>(name, artistId);
  510. }
  511. private async Task<string> GetReleaseIdFromReleaseGroupId(string releaseGroupId, CancellationToken cancellationToken)
  512. {
  513. var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId);
  514. using (var response = await GetMusicBrainzResponse(url, true, true, cancellationToken).ConfigureAwait(false))
  515. {
  516. using (var stream = response.Content)
  517. {
  518. using (var oReader = new StreamReader(stream, Encoding.UTF8))
  519. {
  520. var settings = _xmlSettings.Create(false);
  521. settings.CheckCharacters = false;
  522. settings.IgnoreProcessingInstructions = true;
  523. settings.IgnoreComments = true;
  524. using (var reader = XmlReader.Create(oReader, settings))
  525. {
  526. var result = ReleaseResult.Parse(reader).FirstOrDefault();
  527. if (result != null)
  528. {
  529. return result.ReleaseId;
  530. }
  531. }
  532. }
  533. }
  534. }
  535. return null;
  536. }
  537. /// <summary>
  538. /// Gets the release group id internal.
  539. /// </summary>
  540. /// <param name="releaseEntryId">The release entry id.</param>
  541. /// <param name="cancellationToken">The cancellation token.</param>
  542. /// <returns>Task{System.String}.</returns>
  543. private async Task<string> GetReleaseGroupFromReleaseId(string releaseEntryId, CancellationToken cancellationToken)
  544. {
  545. var url = string.Format("/ws/2/release-group/?query=reid:{0}", releaseEntryId);
  546. using (var response = await GetMusicBrainzResponse(url, false, cancellationToken).ConfigureAwait(false))
  547. {
  548. using (var stream = response.Content)
  549. {
  550. using (var oReader = new StreamReader(stream, Encoding.UTF8))
  551. {
  552. var settings = _xmlSettings.Create(false);
  553. settings.CheckCharacters = false;
  554. settings.IgnoreProcessingInstructions = true;
  555. settings.IgnoreComments = true;
  556. using (var reader = XmlReader.Create(oReader, settings))
  557. {
  558. reader.MoveToContent();
  559. reader.Read();
  560. // Loop through each element
  561. while (!reader.EOF && reader.ReadState == ReadState.Interactive)
  562. {
  563. if (reader.NodeType == XmlNodeType.Element)
  564. {
  565. switch (reader.Name)
  566. {
  567. case "release-group-list":
  568. {
  569. if (reader.IsEmptyElement)
  570. {
  571. reader.Read();
  572. continue;
  573. }
  574. using (var subReader = reader.ReadSubtree())
  575. {
  576. return GetFirstReleaseGroupId(subReader);
  577. }
  578. }
  579. default:
  580. {
  581. reader.Skip();
  582. break;
  583. }
  584. }
  585. }
  586. else
  587. {
  588. reader.Read();
  589. }
  590. }
  591. return null;
  592. }
  593. }
  594. }
  595. }
  596. }
  597. private string GetFirstReleaseGroupId(XmlReader reader)
  598. {
  599. reader.MoveToContent();
  600. reader.Read();
  601. // Loop through each element
  602. while (!reader.EOF && reader.ReadState == ReadState.Interactive)
  603. {
  604. if (reader.NodeType == XmlNodeType.Element)
  605. {
  606. switch (reader.Name)
  607. {
  608. case "release-group":
  609. {
  610. return reader.GetAttribute("id");
  611. }
  612. default:
  613. {
  614. reader.Skip();
  615. break;
  616. }
  617. }
  618. }
  619. else
  620. {
  621. reader.Read();
  622. }
  623. }
  624. return null;
  625. }
  626. internal Task<HttpResponseInfo> GetMusicBrainzResponse(string url, bool isSearch, CancellationToken cancellationToken)
  627. {
  628. return GetMusicBrainzResponse(url, isSearch, false, cancellationToken);
  629. }
  630. /// <summary>
  631. /// Gets the music brainz response.
  632. /// </summary>
  633. internal async Task<HttpResponseInfo> GetMusicBrainzResponse(string url, bool isSearch, bool forceMusicBrainzProper, CancellationToken cancellationToken)
  634. {
  635. var urlInfo = new MbzUrl(MusicBrainzBaseUrl, 1000);
  636. var throttleMs = urlInfo.throttleMs;
  637. if (throttleMs > 0)
  638. {
  639. // MusicBrainz is extremely adamant about limiting to one request per second
  640. _logger.LogDebug("Throttling MusicBrainz by {0}ms", throttleMs.ToString(CultureInfo.InvariantCulture));
  641. await Task.Delay(throttleMs, cancellationToken).ConfigureAwait(false);
  642. }
  643. url = urlInfo.url.TrimEnd('/') + url;
  644. var options = new HttpRequestOptions
  645. {
  646. Url = url,
  647. CancellationToken = cancellationToken,
  648. UserAgent = _appHost.ApplicationUserAgent,
  649. BufferContent = throttleMs > 0
  650. };
  651. return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false);
  652. }
  653. public int Order => 0;
  654. public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
  655. {
  656. throw new NotImplementedException();
  657. }
  658. internal class MbzUrl
  659. {
  660. internal MbzUrl(string url, int throttleMs)
  661. {
  662. this.url = url;
  663. this.throttleMs = throttleMs;
  664. }
  665. public string url { get; set; }
  666. public int throttleMs { get; set; }
  667. }
  668. }
  669. }