public static List<TaggableSource> GetEventfulVenues(Calinfo calinfo, int min_per_venue, Dictionary<string, string> settings) { var collector = new Collector(calinfo, settings); string args = collector.MakeEventfulArgs(calinfo.where, 100, ""); string method = "venues/search"; var xdoc = collector.CallEventfulApi(method, args); var str_page_count = XmlUtils.GetXeltValue(xdoc.Root, ElmcityUtils.Configurator.no_ns, "page_count"); int page_count = Convert.ToInt16(str_page_count); var ns = ElmcityUtils.Configurator.no_ns; var results = from venue in collector.EventfulIterator(page_count, args, "venues/search", "venue") select new { id = venue.Attribute("id").Value, name = XmlUtils.GetXeltValue(venue, ns, "name"), city_name = XmlUtils.GetXeltValue(venue, ns, "city_name").ToLower(), count = Convert.ToInt32(XmlUtils.GetXeltValue(venue, ns, "event_count")), home_url = XmlUtils.GetXeltValue(venue, ns, "url") }; var venues = new List<TaggableSource>(); var name_and_pk = "eventfulsources"; Parallel.ForEach(source: results, body: (venue) => { //if (venue.city_name != calinfo.City) if ( ! calinfo.City.Contains(venue.city_name) ) return; if (venue.count < min_per_venue) return; var home_url = Regex.Replace(venue.home_url, "\\?.+", ""); var ical_url = home_url.Replace("eventful.com/", "eventful.com/ical/"); var taggable = new TaggableSource(venue.name, calinfo.id, home_url, ical_url, venue.city_name); RememberTaggable(name_and_pk, venue.id, taggable); venues.Add(taggable); }); return venues; }
public void EventfulQueryYieldsValidFirstEvent() { var collector = new Collector(test_calinfo, settings); var events = (IEnumerable<XElement>)collector.EventfulIterator(1, test_eventful_args, "events/search", "event"); var es = new ZonedEventStore(test_calinfo, SourceType.ical); collector.AddEventfulEvent(es, test_venue, events.First()); Assert.That(es.events[0].title != ""); }
public void EventfulQueryYieldsNonzeroEvents() { var collector = new Collector(test_calinfo, settings); var events = (IEnumerable<XElement>)collector.EventfulIterator(1, test_eventful_args, "events/search", "event"); Assert.That(events.Count() > 0); }