mirror of
https://github.com/simon987/sist2.git
synced 2025-04-04 07:52:59 +00:00
Compare commits
6 Commits
7873ef003d
...
d44679131b
Author | SHA1 | Date | |
---|---|---|---|
|
d44679131b | ||
|
4dd5e70406 | ||
|
5a82581992 | ||
|
0dc18a56c0 | ||
|
258b2e31e6 | ||
|
c726074029 |
@ -57,7 +57,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- /data/sist2-admin-data/:/sist2-admin/
|
- /data/sist2-admin-data/:/sist2-admin/
|
||||||
- /:/host
|
- /<path to index>/:/host
|
||||||
ports:
|
ports:
|
||||||
- 4090:4090
|
- 4090:4090
|
||||||
# NOTE: Don't expose this port publicly!
|
# NOTE: Don't expose this port publicly!
|
||||||
|
@ -18,7 +18,7 @@ services:
|
|||||||
container_name: sist2-admin
|
container_name: sist2-admin
|
||||||
volumes:
|
volumes:
|
||||||
- /data/sist2-admin-data/:/sist2-admin/
|
- /data/sist2-admin-data/:/sist2-admin/
|
||||||
- /:/host
|
- /<path to index>/:/host
|
||||||
ports:
|
ports:
|
||||||
- 4090:4090
|
- 4090:4090
|
||||||
# NOTE: Don't export this port publicly!
|
# NOTE: Don't export this port publicly!
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
|
|
||||||
with open("/usr/lib/file/magic.mgc", "rb") as f:
|
MAGIC_PATHS = [
|
||||||
data = f.read()
|
"/vcpkg/installed/x64-linux/share/libmagic/misc/magic.mgc",
|
||||||
|
"/work/vcpkg/installed/x64-linux/share/libmagic/misc/magic.mgc",
|
||||||
|
"/usr/lib/file/magic.mgc"
|
||||||
|
]
|
||||||
|
|
||||||
|
for path in MAGIC_PATHS:
|
||||||
|
try:
|
||||||
|
with open(path, "rb") as f:
|
||||||
|
data = f.read()
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
print("char magic_database_buffer[%d] = {%s};" % (len(data), ",".join(str(int(b)) for b in data)))
|
print("char magic_database_buffer[%d] = {%s};" % (len(data), ",".join(str(int(b)) for b in data)))
|
||||||
|
@ -25,6 +25,7 @@ const char *TESS_DATAPATHS[] = {
|
|||||||
"/usr/share/tessdata/",
|
"/usr/share/tessdata/",
|
||||||
"/usr/share/tesseract-ocr/tessdata/",
|
"/usr/share/tesseract-ocr/tessdata/",
|
||||||
"/usr/share/tesseract-ocr/4.00/tessdata/",
|
"/usr/share/tesseract-ocr/4.00/tessdata/",
|
||||||
|
"/usr/share/tesseract-ocr/5/tessdata/",
|
||||||
"./",
|
"./",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
static const char *const Version = VERSION;
|
static const char *const Version = VERSION;
|
||||||
static const int VersionMajor = 3;
|
static const int VersionMajor = 3;
|
||||||
static const int VersionMinor = 4;
|
static const int VersionMinor = 4;
|
||||||
static const int VersionPatch = 2;
|
static const int VersionPatch = 3;
|
||||||
|
|
||||||
#ifndef SIST_PLATFORM
|
#ifndef SIST_PLATFORM
|
||||||
#define SIST_PLATFORM unknown
|
#define SIST_PLATFORM unknown
|
||||||
|
14
third-party/libscan/libscan/ebook/ebook.c
vendored
14
third-party/libscan/libscan/ebook/ebook.c
vendored
@ -175,9 +175,19 @@ int render_cover(scan_ebook_ctx_t *ctx, fz_context *fzctx, document_t *doc, fz_d
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define IS_IGNORED_MESSAGE(message) \
|
||||||
|
( \
|
||||||
|
strstr(message, "invalid glyph index") \
|
||||||
|
|| strstr(message, "... repeated") \
|
||||||
|
) \
|
||||||
|
|
||||||
void fz_err_callback(void *user, const char *message) {
|
void fz_err_callback(void *user, const char *message) {
|
||||||
document_t *doc = (document_t *) user;
|
document_t *doc = (document_t *) user;
|
||||||
|
|
||||||
|
if (IS_IGNORED_MESSAGE(message)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const scan_ebook_ctx_t *ctx = &thread_ctx;
|
const scan_ebook_ctx_t *ctx = &thread_ctx;
|
||||||
CTX_LOG_WARNINGF(doc->filepath, "FZ: %s", message);
|
CTX_LOG_WARNINGF(doc->filepath, "FZ: %s", message);
|
||||||
}
|
}
|
||||||
@ -185,6 +195,10 @@ void fz_err_callback(void *user, const char *message) {
|
|||||||
void fz_warn_callback(void *user, const char *message) {
|
void fz_warn_callback(void *user, const char *message) {
|
||||||
document_t *doc = (document_t *) user;
|
document_t *doc = (document_t *) user;
|
||||||
|
|
||||||
|
if (IS_IGNORED_MESSAGE(message)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const scan_ebook_ctx_t *ctx = &thread_ctx;
|
const scan_ebook_ctx_t *ctx = &thread_ctx;
|
||||||
CTX_LOG_DEBUGF(doc->filepath, "FZ: %s", message);
|
CTX_LOG_DEBUGF(doc->filepath, "FZ: %s", message);
|
||||||
}
|
}
|
||||||
|
14
third-party/libscan/libscan/media/media.c
vendored
14
third-party/libscan/libscan/media/media.c
vendored
@ -223,14 +223,10 @@ read_frame(scan_media_ctx_t *ctx, AVFormatContext *pFormatCtx, AVCodecContext *d
|
|||||||
|
|
||||||
void append_tag_meta_if_not_exists(scan_media_ctx_t *ctx, document_t *doc, AVDictionaryEntry *tag, enum metakey key) {
|
void append_tag_meta_if_not_exists(scan_media_ctx_t *ctx, document_t *doc, AVDictionaryEntry *tag, enum metakey key) {
|
||||||
|
|
||||||
meta_line_t *meta = doc->meta_head;
|
if (meta_contains_key(doc->meta_head, key)) {
|
||||||
while (meta != NULL) {
|
CTX_LOG_DEBUGF(doc->filepath, "Ignoring duplicate tag: '%02x=%s'",
|
||||||
if (meta->key == key) {
|
key, tag->value);
|
||||||
CTX_LOG_DEBUGF(doc->filepath, "Ignoring duplicate tag: '%02x=%s' and '%02x=%s'",
|
return;
|
||||||
key, meta->str_val, key, tag->value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
meta = meta->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
text_buffer_t tex = text_buffer_create(-1);
|
text_buffer_t tex = text_buffer_create(-1);
|
||||||
@ -445,7 +441,7 @@ int decode_frame_and_save_thumbnail(scan_media_ctx_t *ctx, AVFormatContext *pFor
|
|||||||
return SAVE_THUMBNAIL_FAILED;
|
return SAVE_THUMBNAIL_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->tesseract_lang != NULL && thumbnail_index == 0) {
|
if (ctx->tesseract_lang != NULL && thumbnail_index == 0 && !meta_contains_key(doc->meta_head, MetaContent)) {
|
||||||
ocr_image(ctx, doc, decoder, frame_and_packet->frame);
|
ocr_image(ctx, doc, decoder, frame_and_packet->frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
third-party/libscan/libscan/util.h
vendored
14
third-party/libscan/libscan/util.h
vendored
@ -392,4 +392,18 @@ static parse_job_t *create_parse_job(const char *filepath, int mtime, size_t st_
|
|||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int meta_contains_key (meta_line_t *meta_head, enum metakey key) {
|
||||||
|
|
||||||
|
meta_line_t *meta = meta_head;
|
||||||
|
while (meta != NULL) {
|
||||||
|
if (meta->key == key) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
meta = meta->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user