UI fix, disable thumbnail option, batch index size option

This commit is contained in:
2019-12-01 10:57:29 -05:00
parent 4346c3e063
commit d816dae8b3
12 changed files with 79 additions and 46 deletions

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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);