Commit ac84484d authored by Carlos Garnacho's avatar Carlos Garnacho

Remove libmediaart code entirely

The libmediaart dependency was disabled in commit 6a050686, it
doesn't make sense to drag this code around.
parent 663170b5
......@@ -69,9 +69,6 @@
/* Define if we have libiptcdata */
#mesondefine HAVE_LIBIPTCDATA
/* Define if we have libmediaart */
#mesondefine HAVE_LIBMEDIAART
/* Define if we have libstemmer */
#mesondefine HAVE_LIBSTEMMER
......
......@@ -235,7 +235,6 @@ NETWORK_MANAGER_REQUIRED=0.8
GSTREAMER_REQUIRED=0.10.31
GUPNP_DLNA_REQUIRED=0.9.4
LIBPNG_REQUIRED=1.2
LIBMEDIAART_REQUIRED=1.9.0
JSON_GLIB_REQUIRED=1.0
LIBSOUP_REQUIRED=2.40
......@@ -1102,53 +1101,6 @@ fi
AM_CONDITIONAL(HAVE_NETWORK_MANAGER, test "x$have_network_manager" = "xyes")
##################################################################
# Check for libtracker-miner, tracker-extract: libmediaart
##################################################################
AC_ARG_ENABLE(libmediaart,
AS_HELP_STRING([--enable-libmediaart],
[enable libmediaart for caching published video/audio art [[default=auto]]]),
[enable_libmediaart=$enableval],
[enable_libmediaart=auto])
if test "x$enable_libmediaart" != "xno" ; then
PKG_CHECK_MODULES(LIBMEDIAART,
[libmediaart-2.0 >= $LIBMEDIAART_REQUIRED],
[have_libmediaart=yes],
[have_libmediaart=no])
LIBTRACKER_MINER_CFLAGS="$LIBTRACKER_MINER_CFLAGS $LIBMEDIAART_CFLAGS"
LIBTRACKER_MINER_LIBS="$LIBTRACKER_MINER_LIBS $LIBMEDIAART_LIBS"
LIBTRACKER_EXTRACT_CFLAGS="$LIBTRACKER_EXTRACT_CFLAGS $LIBMEDIAART_CFLAGS"
LIBTRACKER_EXTRACT_LIBS="$LIBTRACKER_EXTRACT_LIBS $LIBMEDIAART_LIBS"
TRACKER_EXTRACT_CFLAGS="$TRACKER_EXTRACT_CFLAGS $LIBMEDIAART_CFLAGS"
TRACKER_EXTRACT_LIBS="$TRACKER_EXTRACT_LIBS $LIBMEDIAART_LIBS"
TRACKER_MINER_FS_CFLAGS="$TRACKER_MINER_FS_CFLAGS $LIBMEDIAART_CFLAGS"
TRACKER_MINER_FS_LIBS="$TRACKER_MINER_FS_LIBS $LIBMEDIAART_LIBS"
# Used for .pc file...
LIBTRACKER_MINER_PC_REQUIRES="libmediaart-2.0"
AC_SUBST(LIBTRACKER_MINER_PC_REQUIRES)
# if test "x$have_libmediaart" = "xyes"; then
# AC_DEFINE(HAVE_LIBMEDIAART, [], [Define if we have libmediaart])
# fi
else
have_libmediaart="no (disabled)"
fi
if test "x$enable_libmediaart" = "xyes"; then
if test "x$have_libmediaart" != "xyes"; then
AC_MSG_ERROR([Could not find libmediaart >= $LIBMEDIAART_REQUIRED.])
fi
fi
AM_CONDITIONAL(HAVE_LIBMEDIAART, test "x$have_libmediaart" = "xyes")
##################################################################
# Check for libtracker-extract: libexif
##################################################################
......@@ -2725,7 +2677,6 @@ Feature Support:
Build with SQLite FTS support: $have_tracker_fts (built-in FTS: $have_builtin_fts5)
Build with Stemming support: $have_libstemmer
Cache media art $have_libmediaart (libmediaart)
Install artwork $have_artwork
Bash completion support: $with_bash_completion_dir ($BASH_COMPLETION_DIR)
......
......@@ -50,7 +50,6 @@ libgrss = dependency('libgrss', version: '> 0.7', required: false)
libgsf = dependency('libgsf-1', version: '> 1.14.24', required: false)
libgxps = dependency('libgxps', required: false)
libiptcdata = dependency('libiptcdata', required: false)
libmediaart = dependency('libmediaart', version: '> 1.9.0', required: false)
libosinfo = dependency('libosinfo', version: '> 0.2.9', required: false)
libpng = dependency('libpng', version: '> 0.89', required: false)
libsoup = dependency('libsoup-2.4', version: '> 2.40', required: true)
......@@ -423,7 +422,6 @@ conf.set10('HAVE_LIBICU', unicode_library_name == 'icu')
conf.set('HAVE_LIBICU_CHARSET_DETECTION', charset_library_name == 'icu')
conf.set('HAVE_LIBEXIF', libexif.found())
conf.set('HAVE_LIBIPTCDATA', libiptcdata.found())
conf.set('HAVE_LIBMEDIAART', libmediaart.found())
conf.set('HAVE_LIBSTEMMER', have_libstemmer)
conf.set('HAVE_LIBUNISTRING', unicode_library_name == 'unistring')
conf.set('HAVE_NETWORK_MANAGER', network_manager.found())
......@@ -454,7 +452,6 @@ conf.set('includedir', join_paths(get_option('prefix'), get_option('includedir')
conf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
conf.set('libexecdir', join_paths(get_option('prefix'), get_option('libexecdir')))
conf.set('prefix', get_option('prefix'))
conf.set('LIBTRACKER_MINER_PC_REQUIRES', 'libmediaart-2.0')
conf.set('TRACKER_API_VERSION', '1.0')
conf.set('VERSION', meson.project_version())
......@@ -547,7 +544,6 @@ summary = [
' Build with SQLite FTS support: @0@ (built-in FTS: @1@)'.format(
get_option('fts'), sqlite3_has_builtin_fts5),
' Build with Stemming support: ' + have_libstemmer.to_string(),
' Cache media art ' + libmediaart.found().to_string(),
' Bash completion support: ' + bash_completion_dir,
'\nData Miners / Writebacks:',
' FS (File System): ' + have_tracker_miner_fs.to_string(),
......
......@@ -44,10 +44,6 @@ struct _TrackerExtractInfo
GFile *file;
gchar *mimetype;
#ifdef HAVE_LIBMEDIAART
MediaArtProcess *media_art_process;
#endif
gint ref_count;
};
......@@ -80,10 +76,6 @@ tracker_extract_info_new (GFile *file,
info->resource = NULL;
#ifdef HAVE_LIBMEDIAART
info->media_art_process = NULL;
#endif
info->ref_count = 1;
return info;
......@@ -130,11 +122,6 @@ tracker_extract_info_unref (TrackerExtractInfo *info)
if (info->resource)
g_object_unref (info->resource);
#ifdef HAVE_LIBMEDIAART
if (info->media_art_process)
g_object_unref (info->media_art_process);
#endif
g_slice_free (TrackerExtractInfo, info);
}
}
......@@ -233,49 +220,3 @@ tracker_extract_info_set_resource (TrackerExtractInfo *info,
g_object_ref (resource);
info->resource = resource;
}
#ifdef HAVE_LIBMEDIAART
/**
* tracker_extract_info_get_media_art_process:
* @info: a #TrackerExtractInfo
*
* Returns the #MediaArtProcess object that can be used to retrieve
* and store media art caches found in extracted content.
*
* Returns: (transfer none): The #MediaArtProcess. This object should
* not be unreferenced.
*
* Since: 1.2
**/
MediaArtProcess *
tracker_extract_info_get_media_art_process (TrackerExtractInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
return info->media_art_process;
}
/**
* tracker_extract_info_set_media_art_process:
* @info: a #TrackerExtractInfo
* @media_art_process: a #MediaArtProcess.
*
* Use @media_art_process for caching and looking up media art.
*
* Since: 1.2
**/
void
tracker_extract_info_set_media_art_process (TrackerExtractInfo *info,
MediaArtProcess *media_art_process)
{
g_return_if_fail (info != NULL);
g_return_if_fail (MEDIA_ART_IS_PROCESS (media_art_process));
if (info->media_art_process) {
g_object_unref (info->media_art_process);
}
info->media_art_process = g_object_ref (media_art_process);
}
#endif /* HAVE_LIBMEDIAART */
......@@ -29,10 +29,6 @@
#include <libtracker-sparql/tracker-sparql.h>
#include <gio/gio.h>
#ifdef HAVE_LIBMEDIAART
#include <libmediaart/mediaart.h>
#endif
G_BEGIN_DECLS
typedef struct _TrackerExtractInfo TrackerExtractInfo;
......@@ -50,14 +46,6 @@ TrackerResource * tracker_extract_info_get_resource (TrackerExtrac
void tracker_extract_info_set_resource (TrackerExtractInfo *info,
TrackerResource *resource);
#ifdef HAVE_LIBMEDIAART
MediaArtProcess * tracker_extract_info_get_media_art_process (TrackerExtractInfo *info);
void tracker_extract_info_set_media_art_process (TrackerExtractInfo *info,
MediaArtProcess *media_art_process);
#endif /* HAVE_LIBMEDIAART */
G_END_DECLS
#endif /* __LIBTRACKER_EXTRACT_INFO_H__ */
......@@ -53,12 +53,6 @@ private_sources = \
tracker-utils.c \
tracker-utils.h
if HAVE_LIBMEDIAART
private_sources += \
tracker-media-art.c \
tracker-media-art.h
endif
miner_sources = \
$(libtracker_miner_monitor_sources) \
$(libtracker_miner_monitor_headers) \
......
......@@ -20,10 +20,6 @@ private_sources = [
'tracker-thumbnailer.c',
'tracker-utils.c']
if libmediaart.found()
private_sources.append(['tracker-media-art.c'])
endif
miner_headers = [
'tracker-enumerator.h',
'tracker-miner-online.h',
......
/*
* Copyright (C) 2008, Nokia <ivan.frade@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <glib.h>
#include <glib/gstdio.h>
#ifdef HAVE_LIBMEDIAART
#include <libmediaart/mediaart.h>
#endif
#include <libtracker-sparql/tracker-sparql.h>
#include "tracker-media-art.h"
/**
* SECTION:tracker-media-art
* @title: Media art management
* @short_description: Media art request and management.
* @include: libtracker-miner/tracker-media-art.h
*
* This is a convenience API using D-Bus to talk to the media management service.
**/
static gboolean had_any = FALSE;
static guint timer_id = 0;
static void
on_query_finished (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
#ifdef HAVE_LIBMEDIAART
GError *error = NULL;
TrackerSparqlCursor *cursor = NULL;
GDir *dir = NULL;
GHashTable *table = NULL;
const gchar *name;
gchar *dirname = NULL;
GList *to_remove = NULL;
cursor = tracker_sparql_connection_query_finish (TRACKER_SPARQL_CONNECTION (source_object),
res,
&error);
if (error) {
goto on_error;
}
dirname = g_build_filename (g_get_user_cache_dir (),
"media-art",
NULL);
if (!g_file_test (dirname, G_FILE_TEST_EXISTS)) {
/* Ignore this and just quit the function */
goto on_error;
}
dir = g_dir_open (dirname, 0, &error);
if (error) {
goto on_error;
}
table = g_hash_table_new_full (g_str_hash,
g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) NULL);
while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
gchar *target = NULL, *album_path = NULL;
const gchar *album, *artist;
album = tracker_sparql_cursor_get_string (cursor, 0, NULL);
artist = tracker_sparql_cursor_get_value_type (cursor, 1) != TRACKER_SPARQL_VALUE_TYPE_UNBOUND ? tracker_sparql_cursor_get_string (cursor, 1, NULL) : NULL;
/* The get_path API does stripping itself */
media_art_get_path (artist,
album,
"album",
&target);
g_hash_table_replace (table, target, target);
/* Also add the file to which the symlinks are made */
media_art_get_path (NULL,
album,
"album",
&album_path);
g_hash_table_replace (table, album_path, album_path);
}
/* Perhaps we should have an internal list of media art files that we made,
* instead of going over all the media art (which could also have been made
* by other softwares) */
for (name = g_dir_read_name (dir); name != NULL; name = g_dir_read_name (dir)) {
gpointer value;
gchar *full;
full = g_build_filename (dirname, name, NULL);
value = g_hash_table_lookup (table, full);
if (!value) {
g_message ("Removing media-art file %s: no album exists that has "
"any songs for this media-art cache", name);
to_remove = g_list_prepend (to_remove, (gpointer) full);
} else {
g_free (full);
}
}
g_list_foreach (to_remove, (GFunc) g_unlink, NULL);
g_list_foreach (to_remove, (GFunc) g_free, NULL);
g_list_free (to_remove);
on_error:
g_free (dirname);
if (table) {
g_hash_table_unref (table);
}
if (cursor) {
g_object_unref (cursor);
}
if (dir) {
g_dir_close (dir);
}
if (error) {
g_critical ("Error running cleanup of media-art: %s",
error->message ? error->message : "No error given");
g_error_free (error);
}
#endif /* HAVE_LIBMEDIAART */
}
/**
* tracker_media_art_queue_remove:
* @uri: URI of the file
* @mime_type: mime-type of the file
*
* Adds a new request to tell the media art subsystem that @uri was removed.
* Stored requests can be processed with tracker_media_art_queue_empty().
*
* Returns: #TRUE if successfully stored to be reported, #FALSE otherwise.
*
* Since: 0.10.4
*/
gboolean
tracker_media_art_queue_remove (const gchar *uri,
const gchar *mime_type)
{
/* mime_type can be NULL */
g_return_val_if_fail (uri != NULL, FALSE);
if (mime_type && (g_str_has_prefix (mime_type, "video/") || g_str_has_prefix (mime_type, "audio/"))) {
had_any = TRUE;
}
return TRUE;
}
static gboolean
on_timer_callback (gpointer data)
{
TrackerSparqlConnection *connection = data;
tracker_sparql_connection_query_async (connection,
"SELECT ?title nmm:artistName (?artist) WHERE { "
" ?mpiece nmm:musicAlbum ?album . "
" ?album nie:title ?title . "
" OPTIONAL { ?album nmm:albumArtist ?artist } "
"}",
NULL,
on_query_finished,
NULL);
return FALSE;
}
static void
on_timer_destroy (gpointer data)
{
TrackerSparqlConnection *connection = data;
g_object_unref (connection);
timer_id = 0;
}
/**
* tracker_media_art_queue_empty:
* @connection: a #TrackerSparqlConnection
*
* Using @connection, find all media art associated with content in
* Tracker (so as not to remove media art for other processes) and
* remove caches for that media art.
*
* Note, this highly depends on built in support for libmediaart. If
* there is no support, this API does nothing.
*
* Since: 0.10.4
*/
void
tracker_media_art_queue_empty (TrackerSparqlConnection *connection)
{
if (had_any && timer_id == 0) {
timer_id = g_timeout_add_seconds_full (G_PRIORITY_LOW,
1800 /* Half an hour worth of seconds*/,
on_timer_callback,
g_object_ref (connection),
on_timer_destroy);
had_any = FALSE;
}
}
/*
* Copyright (C) 2008, Nokia <ivan.frade@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef __LIBTRACKER_MINER_MEDIA_ART_H__
#define __LIBTRACKER_MINER_MEDIA_ART_H__
#include <libtracker-sparql/tracker-sparql.h>
#if !defined (__LIBTRACKER_MINER_H_INSIDE__) && !defined (TRACKER_COMPILATION)
#error "Only <libtracker-miner/tracker-miner.h> can be included directly."
#endif
G_BEGIN_DECLS
gboolean tracker_media_art_queue_remove (const gchar *uri,
const gchar *mime_type);
void tracker_media_art_queue_empty (TrackerSparqlConnection *connection);
G_END_DECLS
#endif /* __LIBTRACKER_MINER_MEDIA_ART_H__ */
......@@ -23,7 +23,6 @@
#include "tracker-crawler.h"
#include "tracker-miner-fs.h"
#include "tracker-media-art.h"
#include "tracker-monitor.h"
#include "tracker-utils.h"
#include "tracker-thumbnailer.h"
......@@ -1637,10 +1636,6 @@ item_remove (TrackerMinerFS *fs,
if (!only_children) {
if (fs->priv->thumbnailer)
tracker_thumbnailer_remove_add (fs->priv->thumbnailer, uri, NULL);
#ifdef HAVE_LIBMEDIAART
tracker_media_art_queue_remove (uri, NULL);
#endif
}
g_object_set_qdata (G_OBJECT (file),
......@@ -2541,9 +2536,6 @@ item_queue_handlers_cb (gpointer user_data)
if (fs->priv->thumbnailer)
tracker_thumbnailer_send (fs->priv->thumbnailer);
#ifdef HAVE_LIBMEDIAART
tracker_media_art_queue_empty (tracker_miner_get_connection (TRACKER_MINER (fs)));
#endif
} else {
/* Flush any possible pending update here */
tracker_sparql_buffer_flush (fs->priv->sparql_buffer,
......
......@@ -85,12 +85,6 @@ uninstall-local:
$(RM) "$(servicedir)/$(service_DATA)"
# Desktop files: First we fix the VERSION and libexecdir
if HAVE_LIBMEDIAART
requires="libmediaart-1.0"
else
requires=
endif
%.desktop.in: %.desktop.in.in
@sed -e "s|@libexecdir[@]|${libexecdir}|" \
-e "s|@VERSION[@]|${VERSION}|" $< > $@
......
......@@ -50,10 +50,6 @@
#include <gst/gst.h>
#include <gst/tag/tag.h>
#ifdef HAVE_LIBMEDIAART
#include <libmediaart/mediaart.h>
#endif
#include <libtracker-common/tracker-common.h>
#include <libtracker-extract/tracker-extract.h>
......@@ -108,16 +104,6 @@ typedef struct {
GSList *artist_list;
#ifdef HAVE_LIBMEDIAART
MediaArtType media_art_type;
gchar *media_art_artist;
gchar *media_art_title;
unsigned char *media_art_buffer;
guint media_art_buffer_size;
const gchar *media_art_buffer_mime;
#endif
GstSample *sample;
GstMapInfo info;
......@@ -405,82 +391,6 @@ translate_discoverer_toc (GstToc *gst_toc)
return toc;
}
#ifdef HAVE_LIBMEDIAART
static gboolean
get_embedded_media_art (MetadataExtractor *extractor)
{
gboolean have_sample;
guint lindex;
lindex = 0;
do {
have_sample = gst_tag_list_get_sample_index (extractor->tagcache, GST_TAG_IMAGE, lindex, &extractor->sample);
if (have_sample) {
GstBuffer *buffer;
const GstStructure *info_struct;
gint type;
buffer = gst_sample_get_buffer (extractor->sample);
info_struct = gst_sample_get_info (extractor->sample);
if (gst_structure_get_enum (info_struct,
"image-type",
GST_TYPE_TAG_IMAGE_TYPE,
&type)) {
if (type == GST_TAG_IMAGE_TYPE_FRONT_COVER ||
(type == GST_TAG_IMAGE_TYPE_UNDEFINED &&
extractor->media_art_buffer_size == 0)) {
GstCaps *caps;
GstStructure *caps_struct;
if (!gst_buffer_map (buffer, &extractor->info, GST_MAP_READ))
return FALSE;
caps = gst_sample_get_caps (extractor->sample);
caps_struct = gst_caps_get_structure (caps, 0);
extractor->media_art_buffer = extractor->info.data;
extractor->media_art_buffer_size = extractor->info.size;
extractor->media_art_buffer_mime = gst_structure_get_name (caps_struct);
return TRUE;
}
}
lindex++;
}
} while (have_sample);
/* Fallback to the preview image */
have_sample = gst_tag_list_get_sample_index (extractor->tagcache, GST_TAG_PREVIEW_IMAGE, 0, &extractor->sample);
if (have_sample) {