Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
crawler.c File Reference
#include <glib.h>
#include <glib/gstdio.h>
#include <sqlite3.h>
#include <stdio.h>
#include <string.h>
#include "common/darktable.h"
#include "common/database.h"
#include "common/debug.h"
#include "common/history.h"
#include "common/image.h"
#include "control/conf.h"
#include "control/control.h"
#include "crawler.h"
#include "gui/gtk.h"
+ Include dependency graph for crawler.c:

Data Structures

struct  dt_control_crawler_result_t
 
struct  dt_control_crawler_gui_t
 

Typedefs

typedef enum dt_control_crawler_cols_t dt_control_crawler_cols_t
 
typedef struct dt_control_crawler_result_t dt_control_crawler_result_t
 
typedef struct dt_control_crawler_gui_t dt_control_crawler_gui_t
 

Enumerations

enum  dt_control_crawler_cols_t {
  DT_CONTROL_CRAWLER_COL_ID = 0 ,
  DT_CONTROL_CRAWLER_COL_IMAGE_PATH ,
  DT_CONTROL_CRAWLER_COL_XMP_PATH ,
  DT_CONTROL_CRAWLER_COL_TS_XMP ,
  DT_CONTROL_CRAWLER_COL_TS_DB ,
  DT_CONTROL_CRAWLER_COL_TS_XMP_INT ,
  DT_CONTROL_CRAWLER_COL_TS_DB_INT ,
  DT_CONTROL_CRAWLER_COL_REPORT ,
  DT_CONTROL_CRAWLER_COL_TIME_DELTA ,
  DT_CONTROL_CRAWLER_NUM_COLS
}
 

Functions

static void _free_crawler_result (dt_control_crawler_result_t *entry)
 
static void _set_modification_time (char *filename, const time_t timestamp)
 
GList * dt_control_crawler_run (void)
 
static void dt_control_crawler_response_callback (GtkWidget *dialog, const gint response_id, gpointer user_data)
 
static void _delete_selected_rows (dt_control_crawler_gui_t *gui)
 
static void _select_all_callback (GtkButton *button, gpointer user_data)
 
static void _select_none_callback (GtkButton *button, gpointer user_data)
 
static void _select_invert_callback (GtkButton *button, gpointer user_data)
 
static void _db_update_timestamp (const int id, const time_t timestamp)
 
static void _get_crawler_entry_from_model (GtkTreeModel *model, GtkTreeIter *iter, dt_control_crawler_result_t *entry)
 
static void _append_row_to_remove (GtkTreeModel *model, GtkTreePath *path, GList **rowref_list)
 
static void _log_synchronization (dt_control_crawler_gui_t *gui, gchar *pattern, gchar *filepath)
 
static void sync_xmp_to_db (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
 
static void sync_db_to_xmp (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
 
static void sync_newest_to_oldest (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
 
static void sync_oldest_to_newest (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
 
static void _reload_button_clicked (GtkButton *button, gpointer user_data)
 
void _overwrite_button_clicked (GtkButton *button, gpointer user_data)
 
static void _newest_button_clicked (GtkButton *button, gpointer user_data)
 
static void _oldest_button_clicked (GtkButton *button, gpointer user_data)
 
static gchar * str_time_delta (const int time_delta)
 
void dt_control_crawler_show_image_list (GList *images)
 

Typedef Documentation

◆ dt_control_crawler_cols_t

◆ dt_control_crawler_gui_t

◆ dt_control_crawler_result_t

Enumeration Type Documentation

◆ dt_control_crawler_cols_t

Enumerator
DT_CONTROL_CRAWLER_COL_ID 
DT_CONTROL_CRAWLER_COL_IMAGE_PATH 
DT_CONTROL_CRAWLER_COL_XMP_PATH 
DT_CONTROL_CRAWLER_COL_TS_XMP 
DT_CONTROL_CRAWLER_COL_TS_DB 
DT_CONTROL_CRAWLER_COL_TS_XMP_INT 
DT_CONTROL_CRAWLER_COL_TS_DB_INT 
DT_CONTROL_CRAWLER_COL_REPORT 
DT_CONTROL_CRAWLER_COL_TIME_DELTA 
DT_CONTROL_CRAWLER_NUM_COLS 

Function Documentation

◆ _append_row_to_remove()

static void _append_row_to_remove ( GtkTreeModel *  model,
GtkTreePath *  path,
GList **  rowref_list 
)
static

◆ _db_update_timestamp()

static void _db_update_timestamp ( const int  id,
const time_t  timestamp 
)
static

◆ _delete_selected_rows()

◆ _free_crawler_result()

◆ _get_crawler_entry_from_model()

◆ _log_synchronization()

static void _log_synchronization ( dt_control_crawler_gui_t gui,
gchar *  pattern,
gchar *  filepath 
)
static

◆ _newest_button_clicked()

static void _newest_button_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _oldest_button_clicked()

static void _oldest_button_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _overwrite_button_clicked()

◆ _reload_button_clicked()

static void _reload_button_clicked ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _select_all_callback()

static void _select_all_callback ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _select_invert_callback()

static void _select_invert_callback ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _select_none_callback()

static void _select_none_callback ( GtkButton *  button,
gpointer  user_data 
)
static

◆ _set_modification_time()

static void _set_modification_time ( char *  filename,
const time_t  timestamp 
)
static

◆ dt_control_crawler_response_callback()

static void dt_control_crawler_response_callback ( GtkWidget *  dialog,
const gint  response_id,
gpointer  user_data 
)
static

◆ dt_control_crawler_run()

GList * dt_control_crawler_run ( )

this isn't a background job on purpose. it has to be really fast so it shouldn't require locking from image cache or anything like that. should we find out that we want to have a background job that crawls over all images we can maybe refactor this, but for now it's good the way it is.

Todo:
: shall we report these?
Todo:
: allow for a few seconds difference?
Todo:
: decide if we want to remove the flag for images that lost

References darktable, darktable_t::db, dt_database_get(), dt_database_release_transaction, dt_database_start_transaction, DT_DEBUG_CONTROL, dt_image_get_xmp_mode(), DT_IMAGE_HAS_TXT, DT_IMAGE_HAS_WAV, dt_image_path_append_version_no_db(), dt_print(), dt_util_normalize_path(), flags, dt_control_crawler_result_t::id, dt_control_crawler_result_t::image_path, PATH_MAX, dt_control_crawler_result_t::timestamp_db, dt_control_crawler_result_t::timestamp_xmp, and dt_control_crawler_result_t::xmp_path.

Referenced by crawl_xmp_changes(), and dt_init().

◆ dt_control_crawler_show_image_list()

◆ str_time_delta()

static gchar * str_time_delta ( const int  time_delta)
static

◆ sync_db_to_xmp()

◆ sync_newest_to_oldest()

◆ sync_oldest_to_newest()

◆ sync_xmp_to_db()