public HexerciseControllerService(dynamic parameters) { var inputParser = new InputParser(parameters); _mbid = inputParser.GetMbid(); _analysis = GetAcousticbrainzAnalysis(); _colourCalculator = new PredominantPropertyColourCalculator(); _trackColour = _colourCalculator.From(_analysis); }
public void Should_convert_from_7dID_to_MBID_correctly() { var sevenDigitalId = new SevenDigitalId(12345); var actualMbid = sevenDigitalId.ToMbid(); var expectedMbid = new Mbid("BFF3BC49-7E55-4701-8A86-1F8B86784166"); Assert.That(actualMbid.ToString(), Is.EqualTo(expectedMbid.ToString())); }
public AcousticbrainzResult GetAnalysisOf(Mbid mbid) { var highLevelJson = Analysis(mbid, "/high-level"); var lowLevelJson = Analysis(mbid, "/low-level"); return new AcousticbrainzResult { HighLevelJson = highLevelJson, LowLevelJson = lowLevelJson, }; }
private string Analysis(Mbid mbid, string level) { var url = new Uri(_acousticbrainzUrl, mbid + level); try { return WebRequest.Create(url).GetResponse().Body(); } catch (WebException e) { var status = e.Response.StatusCode(); if (status.Equals(HttpStatusCode.NotFound)) throw new NoDataForTrackException(mbid); throw; } }
public NoDataForTrackException(Mbid mbid) { _mbid = mbid; }
public void Setup() { _testMbid = new Mbid("0310e92c-331c-4f61-bc4d-3c3ba6e88aec"); }