#!/usr/bin/env python2.5
import hildon
import gtk, gobject
-from tracker_backend import TrackerBackend
from album_art_spec import getCoverArtThumbFileName
from download_dialog import MussorgskyAlbumArtDownloadDialog
+def escape_html (text):
+ return text.replace ("&","&").replace ("<", "<").replace (">", ">").replace ("\"", ""e;")
+
class MussorgskyAlbumArtPanel (hildon.StackableWindow):
- def __init__ (self):
+ def __init__ (self, album_artists):
hildon.StackableWindow.__init__ (self)
self.set_title ("Album art handling")
self.set_border_width (12)
self.__create_view ()
self.model = gtk.ListStore (str, gtk.gdk.Pixbuf, str, str)
- self.tracker = TrackerBackend ()
-
- pairs = self.tracker.get_all_pairs_artist_album ()
- for p in pairs:
+ for p in album_artists:
if (not p[1]):
continue
album_art_path = getCoverArtThumbFileName (p[1])
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size (album_art_path, 124, 124)
except gobject.GError:
pixbuf = None
- t = ("<b>%s</b>\n<small>%s</small>" % (p[1], p[0]), pixbuf, p[0], p[1])
+ t = ("<b>%s</b>\n<small>%s</small>" % (escape_html(p[1]), escape_html(p[0])), pixbuf, p[0], p[1])
self.model.append (t)
if __name__ == "__main__":
- window = MussorgskyAlbumArtPanel ()
+ artists_albums = [("Artist &%d" % i, "Album <%d>" % i) for i in range (0, 100)]
+
+
+ window = MussorgskyAlbumArtPanel (artists_albums)
window.connect ("destroy", gtk.main_quit )
window.show_all ()
gtk.main ()