[sushi/drop-libmusicbrainz: 2/2] Drop libmusicbrainz dependency




commit 5f2995abf97ca6d068046fedf598bb9a82dc88d3
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Jul 14 16:25:28 2021 +0200

    Drop libmusicbrainz dependency
    
    Sushi now uses its own internal method for querying the MusicBrainz
    API.

 flatpak/org.gnome.NautilusPreviewer.json |  11 ----
 meson.build                              |   1 -
 src/libsushi/meson.build                 |   1 -
 src/libsushi/sushi-utils.c               | 110 -------------------------------
 4 files changed, 123 deletions(-)
---
diff --git a/flatpak/org.gnome.NautilusPreviewer.json b/flatpak/org.gnome.NautilusPreviewer.json
index 22502f7..4291a26 100644
--- a/flatpak/org.gnome.NautilusPreviewer.json
+++ b/flatpak/org.gnome.NautilusPreviewer.json
@@ -86,17 +86,6 @@
                 }
             ]
         },
-        {
-            "name": "libmusicbrainz",
-            "buildsystem": "cmake",
-            "sources": [
-                {
-                    "type": "archive",
-                    "url": 
"https://github.com/metabrainz/libmusicbrainz/releases/download/release-5.1.0/libmusicbrainz-5.1.0.tar.gz";,
-                    "sha256": "6749259e89bbb273f3f5ad7acdffb7c47a2cf8fcaeab4c4695484cef5f4c6b46"
-                }
-            ]
-        },
         {
             "name": "gtksourceview",
             "config-opts": [
diff --git a/meson.build b/meson.build
index 21a292a..c712397 100644
--- a/meson.build
+++ b/meson.build
@@ -21,7 +21,6 @@ gtk_x11_dep = dependency('gtk+-x11-3.0', required: get_option('X11'))
 gtk_wayland_dep = dependency('gtk+-wayland-3.0', version: '>= 3.21.5', required: get_option('wayland'))
 gtksourceview_dep = dependency('gtksourceview-4', version: '>=4.0.3')
 harfbuzz_dep = dependency('harfbuzz', version: '>=0.9.9')
-musicbrainz_dep = dependency('libmusicbrainz5')
 webkit_dep = dependency('webkit2gtk-4.0')
 
 bindir = join_paths(get_option('prefix'), get_option('bindir'))
diff --git a/src/libsushi/meson.build b/src/libsushi/meson.build
index fe2e874..8740954 100644
--- a/src/libsushi/meson.build
+++ b/src/libsushi/meson.build
@@ -39,7 +39,6 @@ libsushi_deps = [
   gstreamer_video_dep,
   gtk_dep,
   harfbuzz_dep,
-  musicbrainz_dep
 ]
 
 libsushi_sources = [
diff --git a/src/libsushi/sushi-utils.c b/src/libsushi/sushi-utils.c
index 5096fe4..d39b3f4 100644
--- a/src/libsushi/sushi-utils.c
+++ b/src/libsushi/sushi-utils.c
@@ -27,7 +27,6 @@
 
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
-#include <musicbrainz5/mb5_c.h>
 
 #ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
@@ -400,112 +399,3 @@ sushi_pixbuf_from_gst_sample (GstSample *sample,
 
   return pixbuf;
 }
-
-typedef struct {
-  gchar *artist;
-  gchar *album;
-} FetchUriTaskData;
-
-static void
-fetch_uri_task_data_free (gpointer user_data)
-{
-  FetchUriTaskData *data = user_data;
-
-  g_free (data->artist);
-  g_free (data->album);
-
-  g_slice_free (FetchUriTaskData, data);
-}
-
-static FetchUriTaskData *
-fetch_uri_task_data_new (const gchar *artist,
-                         const gchar *album)
-{
-  FetchUriTaskData *retval;
-
-  retval = g_slice_new0 (FetchUriTaskData);
-  retval->artist = g_strdup (artist);
-  retval->album = g_strdup (album);
-
-  return retval;
-}
-
-static void
-fetch_uri_job (GTask *task,
-               gpointer source_object,
-               gpointer task_data,
-               GCancellable *cancellable)
-{
-  FetchUriTaskData *data = task_data;
-  g_autofree gchar *retval = NULL;
-  g_auto(GStrv) param_names = NULL, param_values = NULL;
-  Mb5Metadata metadata;
-  Mb5Query query;
-  Mb5Release release;
-  Mb5ReleaseList release_list;
-
-  query = mb5_query_new ("sushi", NULL, 0);
-
-  param_names = g_new (gchar*, 3);
-  param_values = g_new (gchar*, 3);
-
-  param_names[0] = g_strdup ("query");
-  param_values[0] = g_strdup_printf ("artist:\"%s\" AND release:\"%s\"", data->artist, data->album);
-
-  param_names[1] = g_strdup ("limit");
-  param_values[1] = g_strdup ("10");
-
-  param_names[2] = NULL;
-  param_values[2] = NULL;
-
-  metadata = mb5_query_query (query, "release", "", "",
-                              2, param_names, param_values);
-
-  mb5_query_delete (query);
-
-  if (metadata) {
-    release_list = mb5_metadata_get_releaselist (metadata);
-    int i;
-    int release_list_length = mb5_release_list_size (release_list);
-    for (i = 0; i < release_list_length; i++) {
-      gchar asin[255];
-
-      release = mb5_release_list_item (release_list, i);
-      mb5_release_get_asin (release, asin, 255);
-
-      if (asin != NULL && asin[0] != '\0') {
-        retval = g_strdup (asin);
-        break;
-      }
-    }
-  }
-  mb5_metadata_delete (metadata);
-
-  if (retval == NULL)
-    g_task_return_new_error (task,
-                             G_IO_ERROR,
-                             G_IO_ERROR_NOT_FOUND, "%s",
-                             "Error getting the ASIN from MusicBrainz");
-  else
-    g_task_return_pointer (task, g_steal_pointer (&retval), g_free);
-}
-
-gchar *
-sushi_get_asin_for_track_finish (GAsyncResult *result,
-                                 GError **error)
-{
-  return g_task_propagate_pointer (G_TASK (result), error);
-}
-
-void
-sushi_get_asin_for_track (const gchar *artist,
-                          const gchar *album,
-                          GAsyncReadyCallback callback,
-                          gpointer user_data)
-{
-  g_autoptr(GTask) task = g_task_new (NULL, NULL, callback, user_data);
-  FetchUriTaskData *data = fetch_uri_task_data_new (artist, album);
-
-  g_task_set_task_data (task, data, fetch_uri_task_data_free);
-  g_task_run_in_thread (task, fetch_uri_job);
-}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]