Please type example code that produces the issue:
def get_upcoming_events(self):
"""Returns a list of the upcoming Events for this artist."""
doc = self._request('artist.getEvents', True)
ids = _extract_all(doc, 'id')
events = []
for e_id in ids:
events.append(Event(e_id, self.network))
return events
What is the expected output? What do you see instead?
Because the pylast code just calls getElementsByTagName on 'id', the xml
response not only return the event ID, but also return venue ID. So when you
iterate through the events and query the event on its ID, it will return
'Invalid event ID'
What versions of Pylast and Python are you using?
Please provide any additional information below.
How I worked around it:
Instead of getting it by ID, I got a list of all events. Then I traverse
through the list of events and get the event's ID and append it to the ids list.
def get_upcoming_events(self):
"""Returns a list of the upcoming Events for this artist."""
doc = self._request('artist.getEvents', True)
ids = []
events = doc.getElementsByTagName('event')
for event in events:
eventelements = event.childNodes
eventelements = [event for event in eventelements if event.nodeType == 1]
for eventelement in eventelements:
if eventelement.tagName == 'id':
ids.append(eventelement.firstChild.data)
events = []
for e_id in ids:
events.append(Event(e_id, self.network))
return events
Original issue reported on code.google.com by wanling....@gmail.com on 2 Apr 2012 at 3:14
Original issue reported on code.google.com by
wanling....@gmail.com
on 2 Apr 2012 at 3:14