public IEnumerable<string> ExtractTracksFromUrl(ThatRecordPart thatRecordPart){ _recordWebsiteRepository.Load(thatRecordPart); var website = _recordWebsiteRepository.GetRecordWebsite(thatRecordPart.RecordUrl); if(website==RecordWebsite.Unknown) { return Enumerable.Empty<string>(); } var extractor = TrackSampleExtractorFactory.Create(website); if(extractor == null) { return Enumerable.Empty<string>(); } return extractor.ExtractTrackSamples(thatRecordPart.RecordUrl); }
public void Load(ThatRecordPart thatRecordPart) { var settings = thatRecordPart.Settings.GetModel<ThatRecordPartSettings>(); var xmlPath = thatRecordPart.Settings.GetModel<ThatRecordPartSettings>().XmlFilePathForRecordWebsiteUrls; var xmlContent = File.ReadAllText(xmlPath); var xDocument = XDocument.Parse(xmlContent); try { RecordWebsites = xDocument.Root.Elements() .Select(x => new KeyValuePair<string, RecordWebsite>(x.Attribute("url").Value, (RecordWebsite)Enum.Parse(typeof(RecordWebsite), x.Attribute("name").Value, true))) .ToList(); } catch (NullReferenceException e) { return; } }