![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "common/darktable.h"#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 "common/image.h"#include "control/jobs/control_jobs.h"#include "gui/gtk.h"#include <glob.h>#include <string.h>
Include dependency graph for import_jobs.c:Go to the source code of this file.
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_txt (const char *const filename, const char *dest_file_path) |
| 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 |
Definition at line 566 of file import_jobs.c.
References _control_import_job_cleanup(), dt_control_image_enumerator_alloc(), and IS_NULL_PTR.
Referenced by _control_import_job_create().
Definition at line 547 of file import_jobs.c.
References _discarded_files_popup(), dt_control_import_t::discarded, dt_control_image_enumerator_cleanup(), dt_control_import_data_free(), dt_free, and p.
Referenced by _control_import_alloc(), and _control_import_job_create().
|
static |
Definition at line 580 of file import_jobs.c.
References _control_import_alloc(), _control_import_job_cleanup(), _control_import_job_run(), dt_control_job_add_progress(), dt_control_job_create(), dt_control_job_dispose(), dt_control_job_set_params(), FALSE, and IS_NULL_PTR.
Referenced by dt_control_import().
|
static |
Definition at line 396 of file import_jobs.c.
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 |
Definition at line 125 of file import_jobs.c.
References DT_DEBUG_IMPORT, dt_print(), and out.
Referenced by _import_copy_file(), _import_copy_txt(), 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. |
Definition at line 48 of file import_jobs.c.
References dt_control_log(), FALSE, and TRUE.
Referenced by _import_copy_file().
|
static |
Definition at line 472 of file import_jobs.c.
References darktable, dt_control_import_t::discarded, dt_control_image_enumerator_cleanup(), dt_control_import_data_free(), dt_free, dt_gui_add_class(), DT_GUI_BOX_SPACING, 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 |
Definition at line 113 of file import_jobs.c.
References IS_NULL_PTR.
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 |
Definition at line 249 of file import_jobs.c.
References _copy_file(), _create_dir(), _file_exist(), _import_copy_txt(), _import_copy_xmp(), dt_build_filename_from_pattern(), DT_DEBUG_IMPORT, DT_DEBUG_PRINT, dt_exif_read(), dt_free, 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_txt | ( | const char *const | filename, |
| const char * | dest_file_path | ||
| ) |
Definition at line 219 of file import_jobs.c.
References _copy_file(), DT_DEBUG_IMPORT, dt_free, dt_image_build_text_path_from_path(), dt_image_get_text_path_from_path(), dt_print(), and IS_NULL_PTR.
Referenced by _import_copy_file().
| 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 |
Definition at line 193 of file import_jobs.c.
References _copy_file(), DT_DEBUG_IMPORT, dt_free, 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. |
Definition at line 346 of file import_jobs.c.
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 |
Definition at line 146 of file import_jobs.c.
References dt_film_new(), dt_free, 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 |
Definition at line 66 of file import_jobs.c.
References dt_cleanup_separators(), dt_free, and dt_util_remove_whitespace().
Referenced by dt_build_filename_from_pattern().
Definition at line 386 of file import_jobs.c.
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 | ||
| ) |
Definition at line 309 of file import_jobs.c.
References DT_DATETIME_EXIF_LENGTH, dt_datetime_unix_to_exif(), dt_free_gpointer(), dt_metadata_get(), dt_metadata_set(), error(), FALSE, and IS_NULL_PTR.
| 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 |
Definition at line 74 of file import_jobs.c.
References _path_cleanup(), dt_control_import_t::base_folder, dt_control_import_t::datetime, DT_DEBUG_PRINT, dt_free, 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 |
Definition at line 597 of file import_jobs.c.
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 | ) |
Definition at line 450 of file import_jobs.c.
References dt_control_import_t::base_folder, dt_control_import_t::datetime, dt_control_import_t::discarded, dt_free, dt_free_gpointer(), 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. |
Definition at line 169 of file import_jobs.c.
References DT_DEBUG_IMPORT, dt_free, dt_print(), dt_util_normalize_path(), PATH_MAX, and safe_strlen().
Referenced by _import_copy_xmp().