[tracker/external-crawler: 42/42] libtracker-control: Allow miner status to be gained from running processes
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/external-crawler: 42/42] libtracker-control: Allow miner status to be gained from running processes
- Date: Wed, 6 Aug 2014 07:44:03 +0000 (UTC)
commit e5b5280b5f336b80b00d9c9671a72391ab1f0a9b
Author: Martyn Russell <martyn lanedo com>
Date: Thu Jul 17 19:32:32 2014 +0100
libtracker-control: Allow miner status to be gained from running processes
Using environment variable: TRACKER_MINERS_DIR_DISABLED
docs/manpages/tracker-control.1 | 16 ++++++++
src/libtracker-control/tracker-miner-manager.c | 46 +++++++++++++++++++++++-
2 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/docs/manpages/tracker-control.1 b/docs/manpages/tracker-control.1
index 5ee33c2..76ea639 100644
--- a/docs/manpages/tracker-control.1
+++ b/docs/manpages/tracker-control.1
@@ -225,5 +225,21 @@ The COOKIE is given by a successful
command. It is a number which identifies each pause request. When all
pauses have been resumed, the miner will resume working.
+.SH ENVIRONMENT
+.TP
+.B TRACKER_MINERS_DIR
+Miners that are installed should have a .desktop file in
+/usr/share/tracker/miners/, this is how tracker-control knows about
+miners which exist but may not have not been started. This environment
+variable allows the location that miner .desktop files are loaded from
+to be overridden by setting it to a new path.
+.TP
+.B TRACKER_MINERS_DIR_DISABLED
+If you don't have .desktop files for miners, you can use this
+environment variable to get status information from \fBRUNNING\fR
+processes. This doesn't give any indication for miners \fBNOT\fR
+running. This uses registered miners on DBus to know about existing
+Tracker based data miners.
+
.SH SEE ALSO
.BR tracker-store (1).
diff --git a/src/libtracker-control/tracker-miner-manager.c b/src/libtracker-control/tracker-miner-manager.c
index 573b201..8928487 100644
--- a/src/libtracker-control/tracker-miner-manager.c
+++ b/src/libtracker-control/tracker-miner-manager.c
@@ -683,6 +683,41 @@ tracker_miner_manager_get_running (TrackerMinerManager *manager)
}
static void
+load_running_miners_only (TrackerMinerManager *manager)
+{
+ TrackerMinerManagerPrivate *priv;
+ GSList *running, *l;
+ gint prefix_len;
+
+ priv = TRACKER_MINER_MANAGER_GET_PRIVATE (manager);
+
+ running = tracker_miner_manager_get_running (manager);
+ prefix_len = strlen (TRACKER_MINER_DBUS_NAME_PREFIX);
+
+ for (l = running; l; l = l->next) {
+ MinerData *data;
+ const gchar *dbus_name;
+ gchar *p;
+
+ dbus_name = l->data;
+ data = g_slice_new0 (MinerData);
+ data->dbus_path = g_strdup_printf ("/%s", dbus_name);
+
+ p = data->dbus_path;
+ while ((p = strchr (p, '.')) != NULL) {
+ *p++ = '/';
+ }
+
+ data->dbus_name = l->data;
+ data->display_name = g_strdup (dbus_name + prefix_len);
+ data->description = g_strdup (data->display_name);
+ priv->miners = g_list_prepend (priv->miners, data);
+ }
+
+ g_slist_free (running);
+}
+
+static void
check_file (GFile *file,
gpointer user_data)
{
@@ -774,7 +809,16 @@ static void
initialize_miners_data (TrackerMinerManager *manager)
{
GFile *file;
- const gchar *miners_dir;
+ const gchar *miners_dir, *miners_dir_disabled;
+
+ miners_dir_disabled = g_getenv ("TRACKER_MINERS_DIR_DISABLED");
+ if (G_UNLIKELY (miners_dir_disabled != NULL)) {
+ miners_dir = TRACKER_MINERS_DIR;
+ g_message ("Crawling miners found on DBus not from .desktop files (set in env)");
+
+ load_running_miners_only (manager);
+ return;
+ }
/* Go through service files */
miners_dir = g_getenv ("TRACKER_MINERS_DIR");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]