mirror of
https://github.com/simon987/sist2.git
synced 2025-12-13 23:39:04 +00:00
UI fix, disable thumbnail option, batch index size option
This commit is contained in:
@@ -167,6 +167,10 @@ void parse_font(const char *buf, size_t buf_len, document_t *doc) {
|
||||
strcpy(meta_name->strval, font_name);
|
||||
APPEND_META(doc, meta_name)
|
||||
|
||||
if (ScanCtx.tn_size <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int pixel = 64;
|
||||
int num_chars = (int) strlen(font_name);
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ void parse_media(const char *filepath, document_t *doc) {
|
||||
}
|
||||
}
|
||||
|
||||
if (video_stream != -1) {
|
||||
if (video_stream != -1 && ScanCtx.tn_size > 0) {
|
||||
AVStream *stream = pFormatCtx->streams[video_stream];
|
||||
|
||||
if (stream->codecpar->width <= MIN_SIZE || stream->codecpar->height <= MIN_SIZE) {
|
||||
|
||||
@@ -97,33 +97,31 @@ void parse(void *arg) {
|
||||
|
||||
int mmime = MAJOR_MIME(doc.mime);
|
||||
|
||||
parse_text(bytes_read, &fd, (char *) buf, &doc);
|
||||
if (!(SHOULD_PARSE(doc.mime))) {
|
||||
|
||||
// if (!(SHOULD_PARSE(doc.mime))) {
|
||||
//
|
||||
// } else if ((mmime == MimeVideo && doc.size >= MIN_VIDEO_SIZE) ||
|
||||
// (mmime == MimeImage && doc.size >= MIN_IMAGE_SIZE) || mmime == MimeAudio) {
|
||||
// parse_media(job->filepath, &doc);
|
||||
//
|
||||
// } else if (IS_PDF(doc.mime)) {
|
||||
// void *pdf_buf = read_all(job, (char *) buf, bytes_read, &fd);
|
||||
// parse_pdf(pdf_buf, doc.size, &doc);
|
||||
//
|
||||
// if (pdf_buf != buf && pdf_buf != NULL) {
|
||||
// free(pdf_buf);
|
||||
// }
|
||||
//
|
||||
// } else if (mmime == MimeText && ScanCtx.content_size > 0) {
|
||||
// parse_text(bytes_read, &fd, (char *) buf, &doc);
|
||||
//
|
||||
// } else if (IS_FONT(doc.mime)) {
|
||||
// void *font_buf = read_all(job, (char *) buf, bytes_read, &fd);
|
||||
// parse_font(font_buf, doc.size, &doc);
|
||||
//
|
||||
// if (font_buf != buf && font_buf != NULL) {
|
||||
// free(font_buf);
|
||||
// }
|
||||
// }
|
||||
} else if ((mmime == MimeVideo && doc.size >= MIN_VIDEO_SIZE) ||
|
||||
(mmime == MimeImage && doc.size >= MIN_IMAGE_SIZE) || mmime == MimeAudio) {
|
||||
parse_media(job->filepath, &doc);
|
||||
|
||||
} else if (IS_PDF(doc.mime)) {
|
||||
void *pdf_buf = read_all(job, (char *) buf, bytes_read, &fd);
|
||||
parse_pdf(pdf_buf, doc.size, &doc);
|
||||
|
||||
if (pdf_buf != buf && pdf_buf != NULL) {
|
||||
free(pdf_buf);
|
||||
}
|
||||
|
||||
} else if (mmime == MimeText && ScanCtx.content_size > 0) {
|
||||
parse_text(bytes_read, &fd, (char *) buf, &doc);
|
||||
|
||||
} else if (IS_FONT(doc.mime)) {
|
||||
void *font_buf = read_all(job, (char *) buf, bytes_read, &fd);
|
||||
parse_font(font_buf, doc.size, &doc);
|
||||
|
||||
if (font_buf != buf && font_buf != NULL) {
|
||||
free(font_buf);
|
||||
}
|
||||
}
|
||||
|
||||
write_document(&doc);
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <src/ctx.h>
|
||||
#include "pdf.h"
|
||||
#include "src/ctx.h"
|
||||
|
||||
@@ -178,7 +177,17 @@ void parse_pdf(void *buf, size_t buf_len, document_t *doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
fz_page *cover = render_cover(ctx, doc, fzdoc);
|
||||
fz_page *cover = NULL;
|
||||
if (ScanCtx.tn_size > 0) {
|
||||
cover = render_cover(ctx, doc, fzdoc);
|
||||
} else {
|
||||
fz_var(cover);
|
||||
fz_try(ctx)
|
||||
cover = fz_load_page(ctx, fzdoc, 0);
|
||||
fz_catch(ctx)
|
||||
cover = NULL;
|
||||
}
|
||||
|
||||
if (cover == NULL) {
|
||||
fz_drop_stream(ctx, stream);
|
||||
fz_drop_document(ctx, fzdoc);
|
||||
|
||||
Reference in New Issue
Block a user