![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "import_jobs.h"
#include "common/collection.h"
#include "common/datetime.h"
#include "common/exif.h"
#include "common/metadata.h"
#include "control/control.h"
#include "control/jobs/control_jobs.h"
#include <glob.h>
Functions | |
gboolean | _create_dir (const char *path) |
Creates folders from path. Returns TRUE if success. | |
gchar * | _path_cleanup (gchar *path_in) |
Replaces separator depending of the current OS and removes whitespaces. | |
gchar * | dt_build_filename_from_pattern (const char *const filename, const int index, dt_image_t *img, dt_control_import_t *data) |
Build a full path for a given image file, given a pattern. | |
gboolean | _file_exist (const char *dest_file_path) |
Tests if file exist. Returns 1 if so. | |
gboolean | _copy_file (const char *filename, const char *dest_file_path) |
Just copy a file. Returns 1 if success. | |
const int32_t | _import_job (dt_control_import_t *data, gchar *img_path_to_db) |
Add an image entry in the database and returns its imgID. | |
void | dt_import_duplicate_get_dest_name (char *xmp_dest_name, const char *dest_file_path, const int counter) |
Gets the computed xmp file name with apropriate number for import copy. It computes a duplicate name based on the counter value. The first path in the list ALWAYS become the default xmp. So in case the default xmp was not found, the first one in the list is used as default. Else, it's a duplicate. | |
int | _import_copy_xmp (const char *const filename, gchar *dest_file_path) |
Attempt to find all sidecar XMP files along an image file and import (copy) it to destination. | |
int | _import_copy_file (const char *const filename, const int index, dt_control_import_t *data, gchar *img_path_to_db, size_t pathname_len, GList **discarded) |
copy a file to a destination path after checking if everything is allright. | |
void | _write_xmp_id (const char *filename, int32_t imgid) |
int32_t | _import_image (const GList *img, dt_control_import_t *data, const int index, GList **discarded, int *xmps) |
process to copy (or not) and import an image to database. | |
void | _refresh_progress_counter (dt_job_t *job, const int elements, const int index) |
static int32_t | _control_import_job_run (dt_job_t *job) |
void | dt_control_import_data_free (dt_control_import_t *data) |
static int | _discarded_files_popup (dt_control_image_enumerator_t *params) |
static void | _control_import_job_cleanup (void *p) |
static void * | _control_import_alloc () |
static dt_job_t * | _control_import_job_create (dt_control_import_t data) |
void | dt_control_import (dt_control_import_t data) |
Process a list of images to import with or without copying the files on an arbitrary hard-drive. | |
|
static |
References _control_import_job_cleanup(), and dt_control_image_enumerator_alloc().
Referenced by _control_import_job_create().
References _discarded_files_popup(), dt_control_import_t::discarded, dt_control_image_enumerator_cleanup(), and dt_control_import_data_free().
Referenced by _control_import_alloc(), and _control_import_job_create().
|
static |
|
static |
References _import_image(), _refresh_progress_counter(), darktable_t::collection, darktable, dt_control_import_t::discarded, DT_COLLECTION_CHANGE_NEW_QUERY, dt_collection_load_filmroll(), DT_COLLECTION_PROP_UNDEF, dt_collection_update_query(), dt_conf_set_int(), dt_control_job_get_params(), dt_control_log(), DT_DEBUG_IMPORT, dt_print(), dt_control_import_t::elements, FALSE, dt_control_import_t::imgs, TRUE, and UNKNOWN_IMAGE.
Referenced by _control_import_job_create().
gboolean _copy_file | ( | const char * | filename, |
const char * | dest_file_path | ||
) |
Just copy a file. Returns 1 if success.
filename | |
dest_file_path |
References DT_DEBUG_IMPORT, and dt_print().
Referenced by _import_copy_file(), and _import_copy_xmp().
gboolean _create_dir | ( | const char * | path | ) |
Creates folders from path. Returns TRUE if success.
path | a valid folders path to create. |
References dt_control_log(), FALSE, and TRUE.
Referenced by _import_copy_file().
|
static |
References darktable, dt_control_import_t::discarded, dt_control_image_enumerator_cleanup(), dt_control_import_data_free(), dt_osx_disallow_fullscreen(), DT_PIXEL_APPLY_DPI, dt_ui_main_window(), darktable_t::gui, store(), TRUE, dt_gui_gtk_t::ui, and view().
Referenced by _control_import_job_cleanup().
gboolean _file_exist | ( | const char * | dest_file_path | ) |
Tests if file exist. Returns 1 if so.
dest_file_path |
Referenced by _import_copy_file().
int _import_copy_file | ( | const char *const | filename, |
const int | index, | ||
dt_control_import_t * | data, | ||
gchar * | img_path_to_db, | ||
size_t | pathname_len, | ||
GList ** | discarded | ||
) |
copy a file to a destination path after checking if everything is allright.
params | job informations. |
data | import module information. |
img_path_to_db | will be set to the file path for import. |
pathname_len | the img_path_to_db size. |
discarded | the list of file pathes discarded because the target already exists |
References _copy_file(), _create_dir(), _file_exist(), _import_copy_xmp(), dt_build_filename_from_pattern(), DT_DEBUG_IMPORT, DT_DEBUG_PRINT, dt_exif_read(), dt_image_init(), dt_print(), dt_util_dir_exist(), dt_util_test_writable_dir(), process(), dt_control_import_t::target_dir, dt_control_import_t::target_file_pattern, dt_control_import_t::target_subfolder_pattern, and TRUE.
Referenced by _import_image().
int _import_copy_xmp | ( | const char *const | filename, |
gchar * | dest_file_path | ||
) |
Attempt to find all sidecar XMP files along an image file and import (copy) it to destination.
filename | full path of original image file |
dest_file_path | full path of destination image file |
References _copy_file(), DT_DEBUG_IMPORT, dt_image_find_xmps(), dt_import_duplicate_get_dest_name(), dt_print(), and PATH_MAX.
Referenced by _import_copy_file().
int32_t _import_image | ( | const GList * | img, |
dt_control_import_t * | data, | ||
const int | index, | ||
GList ** | discarded, | ||
int * | xmps | ||
) |
process to copy (or not) and import an image to database.
img | the current image. |
data | info from import module. |
index | current loop's index. |
References _import_copy_file(), _import_job(), dt_control_import_t::copy, dt_control_log(), DT_DEBUG_IMPORT, dt_image_read_duplicates(), dt_print(), FALSE, PATH_MAX, and UNKNOWN_IMAGE.
Referenced by _control_import_job_run().
const int32_t _import_job | ( | dt_control_import_t * | data, |
gchar * | img_path_to_db | ||
) |
Add an image entry in the database and returns its imgID.
data | informations from the import module |
img_path_to_db | the file path to import |
References dt_film_new(), dt_image_import(), dt_util_path_get_dirname(), and FALSE.
Referenced by _import_image().
gchar * _path_cleanup | ( | gchar * | path_in | ) |
Replaces separator depending of the current OS and removes whitespaces.
path |
References dt_cleanup_separators(), and dt_util_remove_whitespace().
Referenced by dt_build_filename_from_pattern().
References double(), dt_control_job_set_progress(), and dt_control_job_set_progress_message().
Referenced by _control_import_job_run().
void _write_xmp_id | ( | const char * | filename, |
int32_t | imgid | ||
) |
References DT_DATETIME_EXIF_LENGTH, dt_datetime_unix_to_exif(), dt_metadata_get(), dt_metadata_set(), error(), and FALSE.
gchar * dt_build_filename_from_pattern | ( | const char *const | filename, |
const int | index, | ||
dt_image_t * | img, | ||
dt_control_import_t * | data | ||
) |
Build a full path for a given image file, given a pattern.
filename | Full path of the original file |
index | Incremental number in a sequence |
img | dt_image_t object. Needs to be inited with EXIF fields prior to calling this function, otherwise EXIF variables are expanded to defaults/fallback. |
data | Import options |
References _path_cleanup(), dt_control_import_t::base_folder, dt_control_import_t::datetime, DT_DEBUG_PRINT, dt_print(), dt_util_normalize_path(), dt_variables_expand(), dt_variables_params_destroy(), dt_variables_params_init(), dt_variables_set_datetime(), FALSE, dt_control_import_t::jobcode, dt_control_import_t::target_dir, dt_control_import_t::target_file_pattern, dt_control_import_t::target_subfolder_pattern, and UNKNOWN_IMAGE.
Referenced by _import_copy_file(), and _set_test_path().
void dt_control_import | ( | dt_control_import_t | data | ) |
Process a list of images to import with or without copying the files on an arbitrary hard-drive.
data | import informations to transmit through the functions |
References _control_import_job_create(), darktable_t::control, darktable, dt_control_add_job(), and DT_JOB_QUEUE_USER_FG.
Referenced by _process_file_list(), and _thumbtable_dnd_import().
void dt_control_import_data_free | ( | dt_control_import_t * | data | ) |
References dt_control_import_t::base_folder, dt_control_import_t::datetime, dt_control_import_t::discarded, dt_control_import_t::imgs, dt_control_import_t::jobcode, dt_control_import_t::target_dir, dt_control_import_t::target_file_pattern, and dt_control_import_t::target_subfolder_pattern.
Referenced by _control_import_job_cleanup(), _discarded_files_popup(), and _set_test_path().
void dt_import_duplicate_get_dest_name | ( | char * | xmp_dest_name, |
const char * | dest_file_path, | ||
const int | counter | ||
) |
Gets the computed xmp file name with apropriate number for import copy. It computes a duplicate name based on the counter
value. The first path in the list ALWAYS become the default xmp. So in case the default xmp was not found, the first one in the list is used as default. Else, it's a duplicate.
xmp_dest_name | the destination name. |
dest_file_path | the full filename path of the destination image. |
counter | the number of duplicates. |
References DT_DEBUG_IMPORT, dt_print(), dt_util_normalize_path(), PATH_MAX, and safe_strlen().
Referenced by _import_copy_xmp().