mirror of
https://github.com/simon987/sist2.git
synced 2025-04-21 11:16:46 +00:00
Compare commits
2 Commits
22dd58e140
...
6f5fdc2935
Author | SHA1 | Date | |
---|---|---|---|
6f5fdc2935 | |||
a01f6dff1f |
@ -40,6 +40,8 @@ typedef struct {
|
|||||||
pcre_extra *exclude_extra;
|
pcre_extra *exclude_extra;
|
||||||
int fast;
|
int fast;
|
||||||
|
|
||||||
|
GHashTable *dbg_current_files;
|
||||||
|
|
||||||
scan_arc_ctx_t arc_ctx;
|
scan_arc_ctx_t arc_ctx;
|
||||||
scan_comic_ctx_t comic_ctx;
|
scan_comic_ctx_t comic_ctx;
|
||||||
scan_ebook_ctx_t ebook_ctx;
|
scan_ebook_ctx_t ebook_ctx;
|
||||||
|
@ -15,9 +15,13 @@ typedef struct {
|
|||||||
char has_parent;
|
char has_parent;
|
||||||
} line_t;
|
} line_t;
|
||||||
|
|
||||||
|
#define META_NEXT 0xFFFF
|
||||||
|
|
||||||
void skip_meta(FILE *file) {
|
void skip_meta(FILE *file) {
|
||||||
enum metakey key = getc(file);
|
enum metakey key;
|
||||||
while (key != '\n') {
|
fread(&key, sizeof(uint16_t), 1, file);
|
||||||
|
|
||||||
|
while (key != META_NEXT) {
|
||||||
if (IS_META_INT(key)) {
|
if (IS_META_INT(key)) {
|
||||||
fseek(file, sizeof(int), SEEK_CUR);
|
fseek(file, sizeof(int), SEEK_CUR);
|
||||||
} else if (IS_META_LONG(key)) {
|
} else if (IS_META_LONG(key)) {
|
||||||
@ -26,7 +30,7 @@ void skip_meta(FILE *file) {
|
|||||||
while ((getc(file))) {}
|
while ((getc(file))) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
key = getc(file);
|
fread(&key, sizeof(uint16_t), 1, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +70,7 @@ index_descriptor_t read_index_descriptor(char *path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *buf = malloc(info.st_size + 1);
|
char *buf = malloc(info.st_size + 1);
|
||||||
int ret = read(fd, buf, info.st_size);
|
size_t ret = read(fd, buf, info.st_size);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
LOG_FATALF("serialize.c", "Could not read index descriptor: %s", strerror(errno));
|
LOG_FATALF("serialize.c", "Could not read index descriptor: %s", strerror(errno));
|
||||||
}
|
}
|
||||||
@ -152,8 +156,20 @@ char *get_meta_key_text(enum metakey meta_key) {
|
|||||||
return "thumbnail";
|
return "thumbnail";
|
||||||
case MetaPages:
|
case MetaPages:
|
||||||
return "pages";
|
return "pages";
|
||||||
|
case MetaExifGpsLongitudeRef:
|
||||||
|
return "exif_gps_longitude_ref";
|
||||||
|
case MetaExifGpsLongitudeDMS:
|
||||||
|
return "exif_gps_longitude_dms";
|
||||||
|
case MetaExifGpsLongitudeDec:
|
||||||
|
return "exif_gps_longitude_dec";
|
||||||
|
case MetaExifGpsLatitudeRef:
|
||||||
|
return "exif_gps_latitude_ref";
|
||||||
|
case MetaExifGpsLatitudeDMS:
|
||||||
|
return "exif_gps_latitude_dms";
|
||||||
|
case MetaExifGpsLatitudeDec:
|
||||||
|
return "exif_gps_latitude_dec";
|
||||||
default:
|
default:
|
||||||
return NULL;
|
LOG_FATALF("serialize.c", "FIXME: Unknown meta key: %d", meta_key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +199,7 @@ void write_document(document_t *doc) {
|
|||||||
|
|
||||||
meta_line_t *meta = doc->meta_head;
|
meta_line_t *meta = doc->meta_head;
|
||||||
while (meta != NULL) {
|
while (meta != NULL) {
|
||||||
dyn_buffer_write_char(&buf, meta->key);
|
dyn_buffer_write_short(&buf, (uint16_t) meta->key);
|
||||||
|
|
||||||
if (IS_META_INT(meta->key)) {
|
if (IS_META_INT(meta->key)) {
|
||||||
dyn_buffer_write_int(&buf, meta->int_val);
|
dyn_buffer_write_int(&buf, meta->int_val);
|
||||||
@ -197,7 +213,7 @@ void write_document(document_t *doc) {
|
|||||||
meta = meta->next;
|
meta = meta->next;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
dyn_buffer_write_char(&buf, '\n');
|
dyn_buffer_write_short(&buf, META_NEXT);
|
||||||
|
|
||||||
int res = write(index_fd, buf.buf, buf.cur);
|
int res = write(index_fd, buf.buf, buf.cur);
|
||||||
if (res == -1) {
|
if (res == -1) {
|
||||||
@ -268,9 +284,10 @@ void read_index_bin(const char *path, const char *index_id, index_func func) {
|
|||||||
cJSON_AddStringToObject(document, "path", "");
|
cJSON_AddStringToObject(document, "path", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
enum metakey key = getc(file);
|
enum metakey key;
|
||||||
size_t ret = 0;
|
fread(&key, sizeof(short), 1, file);
|
||||||
while (key != '\n') {
|
size_t ret;
|
||||||
|
while (key != META_NEXT) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case MetaPages:
|
case MetaPages:
|
||||||
case MetaWidth:
|
case MetaWidth:
|
||||||
@ -308,6 +325,12 @@ void read_index_bin(const char *path, const char *index_id, index_func func) {
|
|||||||
case MetaAuthor:
|
case MetaAuthor:
|
||||||
case MetaModifiedBy:
|
case MetaModifiedBy:
|
||||||
case MetaThumbnail:
|
case MetaThumbnail:
|
||||||
|
case MetaExifGpsLongitudeDMS:
|
||||||
|
case MetaExifGpsLongitudeDec:
|
||||||
|
case MetaExifGpsLongitudeRef:
|
||||||
|
case MetaExifGpsLatitudeDMS:
|
||||||
|
case MetaExifGpsLatitudeDec:
|
||||||
|
case MetaExifGpsLatitudeRef:
|
||||||
case MetaTitle: {
|
case MetaTitle: {
|
||||||
buf.cur = 0;
|
buf.cur = 0;
|
||||||
while ((c = getc(file)) != 0) {
|
while ((c = getc(file)) != 0) {
|
||||||
@ -323,7 +346,7 @@ void read_index_bin(const char *path, const char *index_id, index_func func) {
|
|||||||
LOG_FATALF("serialize.c", "Invalid meta key (corrupt index): %x", key)
|
LOG_FATALF("serialize.c", "Invalid meta key (corrupt index): %x", key)
|
||||||
}
|
}
|
||||||
|
|
||||||
key = getc(file);
|
fread(&key, sizeof(uint16_t), 1, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON *meta_obj = NULL;
|
cJSON *meta_obj = NULL;
|
||||||
@ -510,9 +533,9 @@ void incremental_copy(store_t *store, store_t *dst_store, const char *filepath,
|
|||||||
|
|
||||||
enum metakey key;
|
enum metakey key;
|
||||||
while (1) {
|
while (1) {
|
||||||
key = getc(file);
|
fread(&key, sizeof(uint16_t), 1, file);
|
||||||
fwrite(&key, sizeof(char), 1, dst_file);
|
fwrite(&key, sizeof(uint16_t), 1, dst_file);
|
||||||
if (key == '\n') {
|
if (key == META_NEXT) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
||||||
|
|
||||||
|
|
||||||
static const char *const Version = "2.9.1";
|
static const char *const Version = "2.10.1";
|
||||||
static const char *const usage[] = {
|
static const char *const usage[] = {
|
||||||
"sist2 scan [OPTION]... PATH",
|
"sist2 scan [OPTION]... PATH",
|
||||||
"sist2 index [OPTION]... INDEX",
|
"sist2 index [OPTION]... INDEX",
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<nav class="navbar navbar-expand-lg">
|
<nav class="navbar navbar-expand-lg">
|
||||||
<a class="navbar-brand" href="/">sist2</a>
|
<a class="navbar-brand" href="/">sist2</a>
|
||||||
<span class="badge badge-pill version">2.9.1</span>
|
<span class="badge badge-pill version">2.10.1</span>
|
||||||
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
||||||
<a class="btn ml-auto" href="stats">Stats</a>
|
<a class="btn ml-auto" href="stats">Stats</a>
|
||||||
<button class="btn" type="button" data-toggle="modal" data-target="#settings" onclick="loadSettings()">Settings
|
<button class="btn" type="button" data-toggle="modal" data-target="#settings" onclick="loadSettings()">Settings
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<nav class="navbar navbar-expand-lg">
|
<nav class="navbar navbar-expand-lg">
|
||||||
<a class="navbar-brand" href="/">sist2</a>
|
<a class="navbar-brand" href="/">sist2</a>
|
||||||
<span class="badge badge-pill version">2.9.1</span>
|
<span class="badge badge-pill version">2.10.1</span>
|
||||||
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
||||||
<a style="margin-left: auto" class="btn" href="/">Back</a>
|
<a style="margin-left: auto" class="btn" href="/">Back</a>
|
||||||
<button class="btn" type="button" data-toggle="modal" data-target="#settings"
|
<button class="btn" type="button" data-toggle="modal" data-target="#settings"
|
||||||
|
File diff suppressed because one or more lines are too long
2
third-party/argparse
vendored
2
third-party/argparse
vendored
@ -1 +1 @@
|
|||||||
Subproject commit ffd9c23427d0cb105e27f27f0cf97b463b6a8bf8
|
Subproject commit 5957da0b44d485657edc863b0b924fe837e67b27
|
2
third-party/libscan
vendored
2
third-party/libscan
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 8ed4c943141876970e8761993915cfb48df3f189
|
Subproject commit ee9c98b488ab21ecb1a6e9e10dbbd16054865b58
|
Loading…
x
Reference in New Issue
Block a user