[gnome-music] Add downloading of art work for arists view
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] Add downloading of art work for arists view
- Date: Wed, 15 May 2013 17:47:56 +0000 (UTC)
commit 70a6ecf15dcf6b5ccea861cdb3baa52af08f3f46
Author: Seif Lotfy <seif lotfy com>
Date: Wed May 15 19:47:05 2013 +0200
Add downloading of art work for arists view
src/widgets.js | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/src/widgets.js b/src/widgets.js
index 21aef63..fecbffe 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -333,9 +333,8 @@ const ArtistAlbumWidget = new Lang.Class({
this.ui = new Gtk.Builder();
this.ui.add_from_resource('/org/gnome/music/ArtistAlbumWidget.ui');
- let pixbuf = albumArtCache.lookup (128, artist, album.get_title());
- if (pixbuf == null)
- pixbuf = albumArtCache.makeDefaultIcon(128, 128);
+ let pixbuf = albumArtCache.makeDefaultIcon(128, 128);
+ GLib.idle_add(300, Lang.bind(this, this._updateAlbumArt));
this.ui.get_object("cover").set_from_pixbuf(pixbuf);
this.ui.get_object("title").set_label(album.get_title());
@@ -387,6 +386,35 @@ const ArtistAlbumWidget = new Lang.Class({
this.show_all();
this.emit("artist-album-loaded");
},
+
+ _updateAlbumArt: function() {
+ let pixbuf = albumArtCache.lookup (128, this.artist, this.album.get_title());
+ if (pixbuf != null)
+ this.ui.get_object("cover").set_from_pixbuf(pixbuf);
+ else {
+ var options = Grl.OperationOptions.new(null);
+ options.set_flags (Grl.ResolutionFlags.FULL | Grl.ResolutionFlags.IDLE_RELAY);
+ grilo.tracker.resolve(
+ this.album,
+ [Grl.METADATA_KEY_THUMBNAIL],
+ options,
+ Lang.bind(this,
+ function(source, param, item) {
+ var uri = this.album.get_thumbnail();
+ albumArtCache.getFromUri(uri,
+ this.artist,
+ this.album.get_title(),
+ 128,
+ 128,
+ Lang.bind(this,
+ function (pixbuf) {
+ pixbuf = albumArtCache.makeIconFrame(pixbuf);
+ this.ui.get_object("cover").set_from_pixbuf(pixbuf);
+ }))
+ }));
+ }
+ },
+
trackSelected: function(widget, iter) {
this.player.stop();
this.player.setPlaylist ("Artist", this.album, widget.model, widget.iter, 5);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]