71static void _generate_one(
const int32_t imgid,
const char *imgfilename,
void *user_data)
76 fprintf(stderr,
"image %" G_GSIZE_FORMAT
"/%" G_GSIZE_FORMAT
" (%.02f%%) (id:%d, file=%s)\n",
101 fprintf(stderr, _(
"creating cache directories\n"));
107 fprintf(stderr, _(
"creating cache directory '%s'\n"), dirname);
108 if(g_mkdir_with_parents(dirname, 0750))
110 fprintf(stderr, _(
"could not create directory '%s'!\n"), dirname);
117 if(counted < 0)
return 1;
118 size_t image_count = (size_t)counted;
122 fprintf(stderr, _(
"warning: no images are matching the requested image id range\n"));
123 if(min_imgid > max_imgid)
125 fprintf(stderr, _(
"warning: did you want to swap these boundaries?\n"));
131 .min_mip = min_mip, .max_mip = max_mip };
134 fprintf(stderr,
"done\n");
139static void usage(
const char *progname)
142 "usage: %s [-h, --help; --version]\n"
143 " [--min-mip <0-8> (default = 0)] [-m, --max-mip <0-8> (default = 2)]\n"
144 " [--min-imgid <N>] [--max-imgid <N>]\n"
145 " [--core <darktable options>]\n"
147 "When multiple mipmap sizes are requested, the biggest one is computed\n"
148 "while the rest are quickly downsampled.\n"
150 "The --min-imgid and --max-imgid specify the range of internal image ID\n"
151 "numbers to work on.\n",
169 gtk_init_check(&argc, &arg);
175 int32_t max_imgid = INT32_MAX;
178 for(
k = 1;
k < argc;
k++)
180 if(!strcmp(arg[
k],
"-h") || !strcmp(arg[
k],
"--help"))
185 else if(!strcmp(arg[
k],
"--version"))
187 printf(
"this is ansel-generate-cache %s\ncopyright (c) 2014 johannes hanika; 2015 LebedevRI\n",
191 else if((!strcmp(arg[
k],
"-m") || !strcmp(arg[
k],
"--max-mip")) && argc >
k + 1)
196 else if(!strcmp(arg[
k],
"--min-mip") && argc >
k + 1)
201 else if(!strcmp(arg[
k],
"--min-imgid") && argc >
k + 1)
204 min_imgid = (int32_t)
MIN(
MAX(atoi(arg[
k]), 0), INT32_MAX);
206 else if(!strcmp(arg[
k],
"--max-imgid") && argc >
k + 1)
209 max_imgid = (int32_t)
MIN(
MAX(atoi(arg[
k]), 0), INT32_MAX);
211 else if(!strcmp(arg[
k],
"--core"))
220 char **m_arg = malloc(
sizeof(
char *) * (3 + argc -
k + 1));
221 m_arg[m_argc++] =
"ansel-generate-cache";
222 m_arg[m_argc++] =
"--conf";
223 m_arg[m_argc++] =
"write_sidecar_files=never";
224 for(;
k < argc;
k++) m_arg[m_argc++] = arg[
k];
225 m_arg[m_argc] = NULL;
236 fprintf(stderr, _(
"warning: disk backend for thumbnail cache is disabled (cache_disk_backend)\nif you want "
237 "to pre-generate thumbnails and for Ansel to use them, you need to enable disk backend "
238 "for thumbnail cache\nno thumbnails to be generated, done.\n"));
244 if(min_mip > max_mip)
246 fprintf(stderr, _(
"error: ensure that min_mip <= max_mip\n"));
251 fprintf(stderr, _(
"creating complete lighttable thumbnail cache\n"));
static void usage(const char *progname)
static void _generate_one(const int32_t imgid, const char *imgfilename, void *user_data)
static int generate_thumbnail_cache(const dt_mipmap_size_t min_mip, const dt_mipmap_size_t max_mip, const int32_t min_imgid, const int32_t max_imgid)
int dt_conf_get_bool(const char *name)
const char darktable_package_version[]
int dt_init(int argc, char *argv[], const gboolean init_gui, const gboolean load_data)
void dt_loc_resolve_localedir(char *localedir, size_t bufsize)
Resolve the locale directory the way dt_loc_init() does, creating it if missing, but set no global an...
int dt_image_repository_count_in_id_range(const int32_t min_imgid, const int32_t max_imgid)
How many images have an id in [min_imgid, max_imgid]. -1 when unreadable.
void dt_image_repository_foreach_in_id_range(const int32_t min_imgid, const int32_t max_imgid, dt_image_repository_id_filename_cb cb, void *user_data)
Walk the images whose id falls in [min_imgid, max_imgid], in row order.
Reading and writing one dt_image_t to and from the library database. The SQL half of what used to be ...
float *const restrict const size_t k
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
void dt_mipmap_get_cache_dir(char path[DT_PATH_MAX], dt_mipmap_size_t mip)
void dt_mimap_cache_evict(const int32_t imgid)
void dt_mipmap_get_cache_filename(char path[DT_PATH_MAX], dt_mipmap_size_t mip, const int32_t imgid)
#define dt_mipmap_cache_get(B, C, D, E, F)
#define dt_mipmap_cache_release(B)
void dt_osx_prepare_environment()
#define DT_PATH_MAX
Buffer size for a filesystem path anywhere in Ansel.
gboolean dt_util_test_image_file(const char *filename)