1 # -*- coding: utf-8 -*-
4 from PySide import QtCore
5 from PySide import QtGui
6 from PySide import QtDeclarative
8 from albumArt import AlbumArt
10 class AlbumItem (QtCore.QObject):
12 def __init__ (self, title, artist):
13 QtCore.QObject.__init__(self)
16 self.aa = AlbumArt (self._title, self._artist)
17 self.require_download = False
18 if os.path.exists (self.aa.get_media_art_path ()):
19 self._album_art = self.aa.get_media_art_path ()
20 elif os.path.exists (self.aa.get_generated ()):
21 self._album_art = self.aa.get_generated ()
22 self.require_download = True
24 self.require_download = True
25 self._album_art = None
34 return self._album_art
36 def _setAlbumArt (self, path):
37 print "Setting the new album art to", path
38 self.require_download = False
39 self._album_art = path
40 self.album_art_changed.emit ()
45 prop_changed = QtCore.Signal ()
46 album_art_changed = QtCore.Signal ()
48 title = QtCore.Property (unicode, _title, notify=prop_changed)
49 artist = QtCore.Property (unicode, _artist, notify=prop_changed)
50 album_art = QtCore.Property (unicode,
53 notify=album_art_changed)