[sushi] audio: re-use tags from SushiMediaBin
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] audio: re-use tags from SushiMediaBin
- Date: Wed, 19 Jun 2019 21:33:59 +0000 (UTC)
commit f1d76a19704a5a304bc25678104e13657407a4d4
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jun 19 14:31:38 2019 -0700
audio: re-use tags from SushiMediaBin
Instead of re-reading the file to fetch them again.
https://bugzilla.gnome.org/show_bug.cgi?id=654500
meson.build | 1 -
src/libsushi/meson.build | 1 -
src/ui/main.js | 1 -
src/viewers/audio.js | 30 ++++++++----------------------
4 files changed, 8 insertions(+), 25 deletions(-)
---
diff --git a/meson.build b/meson.build
index 79a7dd7..49f0b3f 100644
--- a/meson.build
+++ b/meson.build
@@ -14,7 +14,6 @@ gio_unix_dep = dependency('gio-unix-2.0', version: '>=2.29.14')
glib_dep = dependency('glib-2.0', version: '>=2.29.14')
gstreamer_dep = dependency('gstreamer-1.0')
gstreamer_audio_dep = dependency('gstreamer-audio-1.0')
-gstreamer_pbutils_dep = dependency('gstreamer-pbutils-1.0')
gstreamer_tag_dep = dependency('gstreamer-tag-1.0')
gstreamer_video_dep = dependency('gstreamer-video-1.0')
gtk_dep = dependency('gtk+-3.0', version: '>=3.13.2')
diff --git a/src/libsushi/meson.build b/src/libsushi/meson.build
index fcbf1b6..6aee692 100644
--- a/src/libsushi/meson.build
+++ b/src/libsushi/meson.build
@@ -7,7 +7,6 @@ libsushi_deps = [
glib_dep,
gstreamer_dep,
gstreamer_audio_dep,
- gstreamer_pbutils_dep,
gstreamer_tag_dep,
gstreamer_video_dep,
gtk_dep,
diff --git a/src/ui/main.js b/src/ui/main.js
index 88a4622..91e8174 100644
--- a/src/ui/main.js
+++ b/src/ui/main.js
@@ -34,7 +34,6 @@ pkg.require({
GLib: '2.0',
GObject: '2.0',
Gst: '1.0',
- GstPbutils: '1.0',
GstTag: '1.0',
Gtk: '3.0',
GtkSource: '4',
diff --git a/src/viewers/audio.js b/src/viewers/audio.js
index 6ad2def..04ac3fc 100644
--- a/src/viewers/audio.js
+++ b/src/viewers/audio.js
@@ -23,7 +23,7 @@
*
*/
-const {Gdk, GdkPixbuf, Gio, GLib, GObject, Gst, GstPbutils, GstTag, Gtk, Soup, Sushi} = imports.gi;
+const {Gdk, GdkPixbuf, Gio, GLib, GObject, Gst, GstTag, Gtk, Soup, Sushi} = imports.gi;
const Constants = imports.util.constants;
const Renderer = imports.ui.renderer;
@@ -247,13 +247,16 @@ var Klass = GObject.registerClass({
_init(file) {
super._init();
- this._discoverAudioTags(file);
+ this._coverFetched = false;
let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
spacing: 6 });
this.add(box);
this._player = new AudioPlayer(file);
+ this._player.connect('tags-change', (p) => {
+ this._updateFromTags(this._player.get_audio_tags());
+ });
this.add_overlay(this._player);
this._autoplayId = GLib.idle_add(0, () => {
@@ -289,30 +292,11 @@ var Klass = GObject.registerClass({
this.isReady();
}
- _discoverAudioTags(file) {
- this._discoverer = new GstPbutils.Discoverer();
- this._discoverer.connect('discovered', (d, info, err) => {
- if (err) {
- logError(err, `Unable to discover audio tags for ${file.get_uri()}`);
- return;
- }
-
- let tags = info.get_tags();
- if (tags)
- this._updateFromTags(tags);
- });
- this._discoverer.start();
- this._discoverer.discover_uri_async(file.get_uri());
- }
-
_onDestroy() {
if (this._autoplayId > 0) {
GLib.source_remove(this._autoplayId);
this._autoplayId = 0;
}
-
- this._discoverer.stop();
- this._discoverer = null;
}
_setCover(cover) {
@@ -360,8 +344,10 @@ var Klass = GObject.registerClass({
this._titleLabel.set_markup('<b>' + titleName + '</b>');
- if (artistName && albumName)
+ if (artistName && albumName && !this._coverFetched) {
fetchCoverArt(tags, this._onCoverArtFetched.bind(this));
+ this._coverFetched = true;
+ }
}
get resizable() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]