better cover art loading
This commit is contained in:
parent
f97b8ab17c
commit
0fd5298a31
1 changed files with 13 additions and 14 deletions
|
@ -67,26 +67,25 @@ class Ui.Window : Adw.ApplicationWindow {
|
||||||
}
|
}
|
||||||
this.cancel_loading_art = new GLib.Cancellable ();
|
this.cancel_loading_art = new GLib.Cancellable ();
|
||||||
|
|
||||||
if (this.song != null) {
|
this.playing_cover_art = null; // TODO: preload next art somehow
|
||||||
this.cover_art_loading = true;
|
this.cover_art_loading = true;
|
||||||
|
|
||||||
string song_id = this.song.id;
|
string song_id = this.song.id;
|
||||||
this.api.cover_art.begin (song_id, this.cancel_loading_art, (obj, res) => {
|
this.api.cover_art.begin (song_id, this.cancel_loading_art, (obj, res) => {
|
||||||
try {
|
try {
|
||||||
this.playing_cover_art = Gdk.Texture.for_pixbuf (this.api.cover_art.end (res));
|
this.playing_cover_art = Gdk.Texture.for_pixbuf (this.api.cover_art.end (res));
|
||||||
|
this.cover_art_loading = false;
|
||||||
|
} catch (Error e) {
|
||||||
|
if (!(e is IOError.CANCELLED)) {
|
||||||
|
warning ("could not load cover for %s: %s", song_id, e.message);
|
||||||
this.cover_art_loading = false;
|
this.cover_art_loading = false;
|
||||||
} catch (Error e) {
|
|
||||||
if (!(e is IOError.CANCELLED)) {
|
|
||||||
warning ("could not load cover for %s: %s", song_id, e.message);
|
|
||||||
this.cover_art_loading = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.playbin.stopped.connect (() => {
|
this.playbin.stopped.connect (() => {
|
||||||
this.playing_cover_art = Gdk.Paintable.empty (1, 1);
|
this.playing_cover_art = null;
|
||||||
this.song = null;
|
this.song = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue