diff options
Diffstat (limited to 'src/job-manager.c')
| -rw-r--r-- | src/job-manager.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/job-manager.c b/src/job-manager.c index bcbc0b8..8344e60 100644 --- a/src/job-manager.c +++ b/src/job-manager.c @@ -30,6 +30,7 @@ #include "items.h" #include "gallery-utils.h" #include "generators.h" +#include "stats.h" @@ -62,7 +63,7 @@ mirror_files (TGallerySetup *setup, char **files, const char *src_tree, const ch s3 = g_path_get_dirname (s2); g_free (s2); if (g_mkdir_with_parents (s3, DEFAULT_DATA_DIR_MODE)) { - fprintf (stderr, "error making target extra directory '%s': %s\n", s3, strerror (errno)); + log_error ("error making target extra directory '%s': %s\n", s3, strerror (errno)); g_free (s3); continue; } @@ -109,7 +110,7 @@ thread_func (gpointer data) for (i = 0; i < job->items->items->len; i++) { TIndexItem *item_tmp = g_ptr_array_index (job->items->items, i); if (item_tmp == NULL) { - fprintf (stderr, "run_job: error getting item %d\n", i); + log_error ("run_job: error getting item %d\n", i); continue; } if (item_tmp->type == INDEX_ITEM_TYPE_PICTURE) { @@ -188,18 +189,19 @@ build_tree (TGallerySetup *setup, GList *thread_list; printf ("Processing directory \"%s\"\n", src_tree); + stats_dirs_inc (); #ifdef __DEBUG_ALL__ printf ("setup->real_templates_dir = %s\n", setup->real_templates_dir); #endif /* Check access permissions */ if (access (src_tree, R_OK)) { - fprintf (stderr, "error accessing source directory: %s\n", strerror (errno)); + log_error ("error accessing source directory: %s\n", strerror (errno)); return FALSE; } if (access (dst_dir, R_OK | W_OK | X_OK)) { if (g_mkdir_with_parents (dst_dir, DEFAULT_DATA_DIR_MODE)) { - fprintf (stderr, "error creating destination directory: %s\n", strerror (errno)); + log_error ("error creating destination directory: %s\n", strerror (errno)); return FALSE; } } @@ -207,7 +209,7 @@ build_tree (TGallerySetup *setup, /* Check the index file */ idx_file = g_strconcat (src_tree, "/index.xml", NULL); if (access (idx_file, R_OK)) { - fprintf (stderr, "error accessing index file '%s': %s\n", idx_file, strerror (errno)); + log_error ("error accessing index file '%s': %s\n", idx_file, strerror (errno)); g_free (idx_file); return FALSE; } @@ -216,7 +218,7 @@ build_tree (TGallerySetup *setup, items = malloc (sizeof (TAlbum)); memset (items, 0, sizeof (TAlbum)); if (! parse_album_xml (idx_file, items)) { - fprintf (stderr, "error reading index file '%s'\n", idx_file); + log_error ("error reading index file '%s'\n", idx_file); g_free (idx_file); free_album_data (items); return FALSE; @@ -247,7 +249,7 @@ build_tree (TGallerySetup *setup, thumb_dir = g_strconcat (dst_dir, "/", setup->thumbnail_dir, NULL); if (access (thumb_dir, R_OK | W_OK | X_OK)) if (g_mkdir_with_parents (thumb_dir, DEFAULT_DATA_DIR_MODE)) { - fprintf (stderr, "error making target thumbnail directory: %s\n", strerror (errno)); + log_error ("error making target thumbnail directory: %s\n", strerror (errno)); g_free (thumb_dir); free_album_data (items); return FALSE; @@ -262,12 +264,12 @@ build_tree (TGallerySetup *setup, img_orig_dir = g_strconcat (dst_dir, "/", setup->img_orig_dir, NULL); if (access (img_big_dir, R_OK | W_OK | X_OK)) if (g_mkdir_with_parents (img_big_dir, DEFAULT_DATA_DIR_MODE)) { - fprintf (stderr, "error making target preview directory: %s\n", strerror (errno)); + log_error ("error making target preview directory: %s\n", strerror (errno)); res = FALSE; } if (access (img_orig_dir, R_OK | W_OK | X_OK)) if (g_mkdir_with_parents (img_orig_dir, DEFAULT_DATA_DIR_MODE)) { - fprintf (stderr, "error making target full size directory: %s\n", strerror (errno)); + log_error ("error making target full size directory: %s\n", strerror (errno)); res = FALSE; } g_free (img_big_dir); @@ -294,7 +296,7 @@ build_tree (TGallerySetup *setup, if (thread) thread_list = g_list_append (thread_list, thread); if (error) { - fprintf (stderr, "build_tree: error starting new thread: %s\n", error->message); + log_error ("build_tree: error starting new thread: %s\n", error->message); g_clear_error (&error); } } @@ -331,7 +333,7 @@ build_tree (TGallerySetup *setup, g_free (s2); g_free (template); if (! res) { - fprintf (stderr, "error generating target index file\n"); + log_error ("error generating target index file\n"); free_album_data (items); return FALSE; } @@ -344,7 +346,7 @@ build_tree (TGallerySetup *setup, for (i = 0; i < items->items->len; i++) { item = g_ptr_array_index (items->items, i); if (item == NULL) { - fprintf (stderr, "build_tree: error getting item %d\n", i); + log_error ("build_tree: error getting item %d\n", i); continue; } if (item->type == INDEX_ITEM_TYPE_PICTURE) { |
