muh6mm3d / pylast

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

User.get_now_playing() can raise IndexError #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please type example code that produces the issue:
network = pylast.LastFMNetwork(api_key, api_secret, username, password_hash)
user = network.get_user('UserWithNothingScrobbled')
current_track = user.get_now_playing()

What is the expected output? What do you see instead?
current_track should be None, but instead an IndexError is raised.

What versions of Pylast and Python are you using?
r61c1a6a2c853 and 3.2/3.3.

Please provide any additional information below.
On line 2885, doc.getElementsByTagName('track') returns an empty list if no 
tracks have been scrobbled by that user and trying to get the first item raises 
an IndexError.

Original issue reported on code.google.com by bahamutzero8825 on 4 Aug 2012 at 5:31

GoogleCodeExporter commented 9 years ago
Fixed in my fork: https://github.com/hugovk/pylast/issues/81

Original comment by hugovk@gmail.com on 1 Mar 2014 at 2:58