muh6mm3d / pylast

Automatically exported from code.google.com/p/pylast
Apache License 2.0
0 stars 0 forks source link

"list index out of range" in User.get_recent_tracks() #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please type example code that produces the issue:

my_user.get_recent_tracks() 

What is the expected output? What do you see instead?

Traceback (most recent call last):
  File "./lastadd.py", line 31, in <module>
    print user.get_recent_tracks()
  File "/usr/lib/python2.5/site-packages/pylast.py", line 2800, in
get_recent_tracks
    timestamp = track.getElementsByTagName("date")[0].getAttribute("uts")
IndexError: list index out of range

What version of pyLast is this?

0.4

Please provide any additional information below.

Looking at the code, I think the continue for attribute "nowplaying" should
be first in the track loop, so that no element gets extracted for the now
playing track at all. This seems particularly important for the date
element which is not present in the now playing track, which results in the
above error.

Original issue reported on code.google.com by bello...@googlemail.com on 10 Jan 2010 at 4:01

GoogleCodeExporter commented 9 years ago
I am getting the same output when when calling user.get_recent_tracks() while a 
track
is played.
Now I check as a workaround user.get_now_playing() to be None...

Original comment by the...@gmail.com on 8 Feb 2010 at 4:21

GoogleCodeExporter commented 9 years ago
Fixed in r219

Original comment by amr.hassan on 19 Feb 2010 at 5:50