// Venue.cs
//
// Copyright (C) 2008 Amr Hassan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
using System;
using System.Xml;
using System.Collections.Generic;
namespace Lastfm.Services
{
///
/// A Last.fm venue.
///
public class Venue : Base
{
///
/// The venue ID.
///
public int ID {get; private set;}
public Venue(int id, Session session)
:base(session)
{
ID = id;
}
internal override RequestParameters getParams ()
{
RequestParameters p = new Lastfm.RequestParameters();
p["venue"] = ID.ToString();
return p;
}
///
/// Returns the upcoming s that are being held in this venue.
///
///
/// A
///
public Event[] GetUpcomingEvents()
{
XmlDocument doc = request("venue.getEvents");
List list = new List();
foreach(XmlNode n in doc.GetElementsByTagName("event"))
list.Add(new Event(int.Parse(extract(n, "id")), Session));
return list.ToArray();
}
///
/// The past events held in this venue.
///
public VenuePastEvents PastEvents
{ get { return new VenuePastEvents(this, Session); } }
///
/// Returns the venue's name.
///
///
/// A
///
public string GetName()
{
// TODO: Replace this call when venue.getInfo comes out.
XmlDocument doc = request("venue.getEvents");
return doc.DocumentElement.GetElementsByTagName("events")[0].Attributes.GetNamedItem("venue").InnerText;
}
}
}