~pyjamateam/pyjama/main

« back to all changes in this revision

Viewing changes to modules/clMain.py

  • Committer: Daniel Nögel
  • Date: 2010-01-29 15:50:06 UTC
  • Revision ID: daniel@kassandra-20100129155006-5q3e3n7kadvtr7gc
* fixed the the image-bug
* you need to delete all files from ~/.pyjama/images in order to make it work

Show diffs side-by-side

added added

removed removed

Lines of Context:
839
839
    # - None if an error occures
840
840
    # - The file's URI as string if downloading was succesfull
841
841
    def get_album_image(self, album_id, size = 100):
842
 
        download_from = "http://imgjam.com/albums/%s/covers/1.%i.jpg"  % (album_id, size)
 
842
        #~ print album_id
 
843
        download_from = "http://imgjam.com/albums/s%s/%s/covers/1.%i.jpg"  % (str(album_id)[0:2], album_id, size)
843
844
        name = "http://api.jamendo.com/get2/image/album/redirect/?id=%s&imagesize=%i" % (album_id, size)
844
845
        md5hash = hashlib.md5(name).hexdigest()
845
846
        fh = os.path.join(self.home, "images", md5hash)
846
847
        if not os.path.exists(fh):
847
848
            try:
848
 
                print "download"
 
849
                print("Downloading '%s'" % download_from)
849
850
                urllib.urlretrieve(download_from, fh)
850
851
            except IOError:
851
852
                print ("Could not load image")