- Added ID3 album image loading
This commit is contained in:
parent
1b368ad3f9
commit
00198d9618
|
@ -16,7 +16,7 @@ class MusicObjectRow(ImageRow):
|
|||
self.objectLibrary.append(object)
|
||||
|
||||
|
||||
def load_image_range(self, start, end, thread_data = None):
|
||||
def load_image_range(self, start, end, as_thread = False, thread_data = None):
|
||||
|
||||
for i in range(start, end):
|
||||
object = self.objectLibrary[i]
|
||||
|
@ -27,18 +27,19 @@ class MusicObjectRow(ImageRow):
|
|||
if pixbuf == object.PENDING_DOWNLOAD:
|
||||
object.connect("image-found", self.set_image_cb, object, tmpImage)
|
||||
elif not pixbuf is None:
|
||||
#tmpImage.set_pixbuf(pixbuf)
|
||||
tmpImage = ImageFrame(pixbuf, self.image_size, use_reflection=True)
|
||||
|
||||
#If we're performing this loading as a seperate thread, we need to lock the Clutter threads
|
||||
if as_thread: clutter.threads_enter()
|
||||
tmpImage = ImageFrame(pixbuf, self.image_size, use_reflection=False)
|
||||
if as_thread: clutter.threads_leave()
|
||||
|
||||
self.add_texture_group(tmpImage)
|
||||
|
||||
#clutter.threads_leave()
|
||||
print "Finished threads"
|
||||
|
||||
#print "Finished threads"
|
||||
|
||||
#Just a callback function to call 'load_image_range()' in a new thread
|
||||
def load_image_range_cb(self, timeline):
|
||||
thread.start_new_thread(self.load_image_range, (self.num_columns, len(self.objectLibrary)-1))
|
||||
thread.start_new_thread(self.load_image_range, (self.num_columns, len(self.objectLibrary)-1, True))
|
||||
|
||||
#A simple callback funtion to set the image of an artist/album after it has completed a download
|
||||
def set_image_cb(self, data, music_object, tmpImage):
|
||||
|
|
|
@ -57,29 +57,20 @@ class song:
|
|||
|
||||
tag = eyeD3.Tag()
|
||||
filename = self.base_dir + "/" + self.filename
|
||||
print filename
|
||||
#print filename
|
||||
|
||||
#Make sure the file exists and we can read it
|
||||
if not os.access(filename, os.R_OK):
|
||||
return None
|
||||
|
||||
tag.link(filename)
|
||||
"""
|
||||
print tag.getArtist()
|
||||
print tag.getAlbum()
|
||||
print tag.getTitle()
|
||||
"""
|
||||
|
||||
images = tag.getImages()
|
||||
for img in images:
|
||||
#str(img.picTypeToString(img.pictureType) + " Image"), \
|
||||
#print "%s: [Size: %d bytes] [Type: %s]" % "test", len(img.imageData), img.mimeType
|
||||
#print img.picTypeToString(img.pictureType) + " Image"
|
||||
|
||||
print "Image Mine Type: " + str(img.mimeType)
|
||||
for img in images:
|
||||
#print "Image Mine Type: " + str(img.mimeType)
|
||||
data = img.imageData
|
||||
loader = gtk.gdk.PixbufLoader()
|
||||
loader.write(pixbuf)
|
||||
loader.write(data)
|
||||
loader.close()
|
||||
return loader.get_pixbuf()
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class Module:
|
|||
self.lastFM = lastFM_interface()
|
||||
self.base_dir = self.dbMgr.get_setting("MusicLocation")
|
||||
self.images_dir = self.get_images_dir()
|
||||
#print "Music Base Dir: " + self.base_dir
|
||||
print "Music Base Dir: " + self.base_dir
|
||||
|
||||
self.is_playing = False
|
||||
#self.load_albums()
|
||||
|
@ -78,6 +78,9 @@ class Module:
|
|||
for album in albums:
|
||||
name_string += album.name
|
||||
self.tmpLabel.set_text(name_string)
|
||||
pixbuf = albums[0].get_image()
|
||||
if not pixbuf is None:
|
||||
self.main_img.set_pixbuf(pixbuf)
|
||||
|
||||
def begin(self, glossMgr):
|
||||
|
||||
|
@ -111,6 +114,12 @@ class Module:
|
|||
self.tmpLabel.show()
|
||||
self.stage.add(self.tmpLabel)
|
||||
|
||||
#The preview img
|
||||
self.main_img = clutter.Texture()
|
||||
self.main_img.set_position(0, 400)
|
||||
self.main_img.show()
|
||||
self.stage.add(self.main_img)
|
||||
|
||||
self.timeline_backdrop.start()
|
||||
|
||||
#Load the rest of the images
|
||||
|
|
Loading…
Reference in New Issue