I am trying to make an mp3 artwork fetcher which uses last.fm. The
script fetched the currently playing song using Dbus from songbird music
player.
I get the following error:-
shadyabhi@shadyabhi-desktop:~/python$ ./last.py
Songbird is playing....
Title: Objection
Artist: Shakira
Traceback (most recent call last):
File "./last.py", line 32, in <module>
album_uri = album.get_cover_image(size=3)
AttributeError: 'NoneType' object has no attribute 'get_cover_image'
shadyabhi@shadyabhi-desktop:~/python$
My script is as follows:-
#!/usr/bin/python
import pylast
import getpass
import dbus
import eyeD3
import subprocess
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, APIC, error
bus = dbus.SessionBus()
player_obj = bus.get_object('org.mpris.songbird', '/Player')
status = player_obj.GetStatus()
if status[0] == 0:
print "Songbird is playing...."
current_playing_track = player_obj.GetMetadata()
print 'Title: '+current_playing_track['title']+'\nArtist:
'+current_playing_track['artist']
API_KEY="foo"
API_SECRET="foo"
username = "shadyabhi"
password_hash = 'foo'
network = pylast.get_lastfm_network(api_key = API_KEY, api_secret =
API_SECRET, username = username, password_hash = password_hash)
#Getting Album Info
track_obj =
network.get_track(current_playing_track['artist'],current_playing_track['title'])
album = track_obj.get_album()
album_uri = album.get_cover_image(size=3)
print album_uri
track_location = current_playing_track['location']
cmd = "axel -a "+album_uri
ret = subprocess.call(cmd.split())
What can be the reason for this error?
Thanx
--
Abhijeet Rastogi
(shadyabhi)
http://www.google.com/profiles/abhijeet.1989
-- Amr
> --
> You received this message because you are subscribed to the pylast mailing
> list.
> To post to this mailing list, send email to pyl...@googlegroups.com
> To unsubscribe from this group, send email to
> pylast+un...@googlegroups.com
> pylast is a python wrapper around last.fm's api. the project is hosted at
> http://code.google.com/p/pylast/ and the mailing list/group is at
> http://groups.google.com/group/pylast