#!/usr/bin/env python2.5
import gtk, gobject
from album_art import MussorgskyAlbumArt
+from utils import escape_html
class MussorgskyAlbumArtDownloadDialog (gtk.Dialog):
self.downloader = MussorgskyAlbumArt ()
self.set_title ("Downloading album art")
self.connect ("response", self.handle_response)
- self.create_view ()
+ self.__create_view ()
self.cancel = False
- def create_view (self):
+ def __create_view (self):
hbox = gtk.HBox (homogeneous=False)
try:
(image, thumb) = self.downloader.get_album_art (artist, album)
if thumb:
- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size (thumb, 124, 124)
- artist_albums_model.set_value (it, 1, pixbuf)
- except LookupError, e:
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size (thumb, 124, 124)
+ artist_albums_model.set_value (it, 1, pixbuf)
+ except Exception, e:
print "Error processing %s - %s" % (artist, album)
print str(e)
self.album_art.set_from_stock (gtk.STOCK_CDROM, gtk.ICON_SIZE_DIALOG)
+ current += 1
+ it = artist_albums_model.iter_next (it)
continue
- self.status_label.set_text ("Retrieved (%d/%d)" % (current, TOTAL))
- self.current_label.set_markup ("<b>%s - %s</b>" % (artist, album))
+ #self.status_label.set_text ("Retrieved (%d/%d)" % (current, TOTAL))
+ self.set_title ("Downloading album art (%d/%d)" % (current, TOTAL))
+ self.current_label.set_markup ("<b>%s - %s</b>" % (escape_html(artist), escape_html(album)))
if (thumb):
self.album_art.set_from_file (thumb)
if __name__ == "__main__":
- PAIRS_NO = [("Led Zeppelin", "Led Zeppelin IV"),
- ("Pink Floyd", "The Wall"),
- ("Deep purple", "Made in Japan"),
- ("", "Freakin' out"),
- ("Dinah Washington", "")]
-
PAIRS_store = gtk.ListStore (str, gtk.gdk.Pixbuf, str, str)
for i in range (0, 100):
PAIRS_store.append (("blablabal", None, "Artist %d" % i, "Album %d" %i))