update README file and fixed bug
This commit is contained in:
parent
3dcd9520d5
commit
8f882ced2b
22
README.txt
Normal file
22
README.txt
Normal file
@ -0,0 +1,22 @@
|
||||
8img is a simple html gallery generator
|
||||
|
||||
|
||||
Performance:
|
||||
11 sec when processing a
|
||||
564kb database containing
|
||||
1685 rows on orange pi 4 lts (cpu freq: 816Mhz)
|
||||
And 5sec at 1.8GHz
|
||||
|
||||
|
||||
Dependencies:
|
||||
* Any C compiler
|
||||
* *nix system
|
||||
|
||||
|
||||
The db contains a the filename and tags
|
||||
exp:
|
||||
image.png ,photo,sky
|
||||
cat.png ,animal,photo
|
||||
|
||||
|
||||
To configure, edit config.h and recompile
|
11
img.c
11
img.c
@ -322,8 +322,6 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut,
|
||||
}
|
||||
|
||||
void build(const char *file, const struct UNIQ_TAGS ut, struct DB_STR *db) {
|
||||
FILE *fp = NULL;
|
||||
|
||||
size_t page = 0;
|
||||
size_t pages = 0;
|
||||
|
||||
@ -352,9 +350,6 @@ void build(const char *file, const struct UNIQ_TAGS ut, struct DB_STR *db) {
|
||||
|
||||
p = db;
|
||||
while (1) {
|
||||
if (fp != NULL)
|
||||
fclose(fp);
|
||||
|
||||
char new_path[PATH_MAX + 1];
|
||||
if (page == 0)
|
||||
snprintf(new_path, sizeof(new_path), "%s/%s.html", ROOT, file);
|
||||
@ -366,12 +361,14 @@ void build(const char *file, const struct UNIQ_TAGS ut, struct DB_STR *db) {
|
||||
if (fp == NULL)
|
||||
return;
|
||||
|
||||
/* Builders */
|
||||
p = build_html(fp, file, ut, p, page, pages);
|
||||
if (p == NULL) {
|
||||
fclose(fp);
|
||||
break;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
page++;
|
||||
}
|
||||
}
|
||||
@ -443,7 +440,7 @@ void rebuild(void) {
|
||||
}
|
||||
|
||||
void help(void) {
|
||||
puts("8img [add/rebuild]:\n\tadd [img] [tag1] [tag2] [...]\n\trebuild\n\tversion");
|
||||
puts("8img [add/rebuild/version]:\n\tadd [img] [tag1] [tag2] [...]\n\trebuild\n\tversion");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -465,7 +462,7 @@ int main(int argc, char **argv) {
|
||||
rebuild();
|
||||
|
||||
else if (!strcmp(argv[0], "version"))
|
||||
puts("8img version: 1.0.1\nWritten under WTFPL License.");
|
||||
puts("8img version: 1.0.2\nWritten under WTFPL License.");
|
||||
|
||||
else
|
||||
help();
|
||||
|
Loading…
Reference in New Issue
Block a user