aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-10-16 23:02:03 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-10-16 23:03:08 +0300
commit01482f7632e86a12b9ee6d97eafa1dafa712f84e (patch)
treef73daafd9a094f473c8edc5097dca21256ba4a9e /include
parentf2c1beb5c3139238a3570d8f5052635519367d26 (diff)
downloadrevela-01482f7632e86a12b9ee6d97eafa1dafa712f84e.tar.gz
revela-01482f7632e86a12b9ee6d97eafa1dafa712f84e.zip
Re-render album html when album.ini changedv0.1.2
Diffstat (limited to 'include')
-rw-r--r--include/components.h19
-rw-r--r--include/fs.h3
2 files changed, 15 insertions, 7 deletions
diff --git a/include/components.h b/include/components.h
index 4317187..88023cb 100644
--- a/include/components.h
+++ b/include/components.h
@@ -11,7 +11,7 @@
#include <sys/stat.h>
#include <libexif/exif-data.h>
-#define PHOTO_THUMB_SUFFIX "_thumb"
+#define THUMB_SUFFIX "_thumb"
/* All data related to a single image's files, templates, and pages */
struct image {
@@ -55,12 +55,19 @@ struct image {
/* All data related to an album's images, templates, and pages */
struct album {
struct site *site;
+ /* The album information, i.e. title, description */
struct album_config *config;
+ /* Modtime for the album.ini file; will be used to check whether we need to
+ * re-render the html for this album based on changes made to it.
+ */
+ struct timespec modtime;
+ /* Whether the album.ini was updated */
+ bool config_updated;
/* The path to the source directory */
char *source;
- /* The full url that will be used in the template */
+ /* The full URL that will be used in the template */
char *url;
- /* Pointer to the slug part in url that will be used for the new dir */
+ /* Pointer to the slug part in the URL that will be used for the new dir */
const char *slug;
/* Pointer to the human readable date of the earliest image */
const char *datestr;
@@ -68,8 +75,7 @@ struct album {
char year[8];
/* The date of the album is the date of the earliest image */
time_t tstamp;
- /*
- * List/vector with the images of this album to be sorted by from
+ /* List/vector with the images of this album to be sorted by from
* older to newer.
*/
struct vector *images;
@@ -77,8 +83,7 @@ struct album {
struct hmap *preserved;
/* Reference counted hashmap with values to be passed to the template */
struct roscha_object *map;
- /*
- * Reference counted vector with refcounted hashmaps of image thumbnails to
+ /* Reference counted vector with refcounted hashmaps of image thumbnails to
* be passed to the template.
*/
struct roscha_object *thumbs;
diff --git a/include/fs.h b/include/fs.h
index 00be8a1..71c566b 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -41,6 +41,9 @@ bool isimage(const char *fname);
*/
const char *delext(const char *restrict basename, char *restrict dest, size_t n);
+#define TIMEQUAL(a, b) \
+ ((a).tv_sec == (b).tv_sec && (a).tv_nsec == (b).tv_nsec)
+
/*
* -1 if error; 0 if the timestamps are different; 1 if they are equal.
*/