Compare commits

..

2 Commits

Author SHA1 Message Date
simon987
80528857e9 Duplicate media_comment field, fixes #440 2023-11-18 10:53:42 -05:00
ffa7f2ae84 Add button for full reindex, fixes #403 2023-11-18 10:53:42 -05:00
11 changed files with 39 additions and 12 deletions

View File

@ -89,9 +89,12 @@ class Sist2AdminApi {
/** /**
* @param {string} name * @param {string} name
* @param {bool} full
*/ */
runJob(name) { runJob(name, full) {
return axios.get(`${this.baseUrl}/api/job/${name}/run`); return axios.get(`${this.baseUrl}/api/job/${name}/run`, {
params: {full}
});
} }
/** /**

View File

@ -8,6 +8,7 @@ export default {
view: "View", view: "View",
delete: "Delete", delete: "Delete",
runNow: "Index now", runNow: "Index now",
runNowFull: "Full re-index",
create: "Create", create: "Create",
cancel: "Cancel", cancel: "Cancel",
test: "Test", test: "Test",

View File

@ -6,7 +6,19 @@
</b-card-title> </b-card-title>
<div class="mb-3"> <div class="mb-3">
<b-button class="mr-1" variant="primary" @click="runJob()" :disabled="!valid">{{ $t("runNow") }}</b-button>
<b-dropdown
split
split-variant="primary"
variant="primary"
:text="$t('runNow')"
class="mr-1"
:disabled="!valid"
@click="runJob()"
>
<b-dropdown-item href="#" @click="runJob(true)">{{ $t("runNowFull") }}</b-dropdown-item>
</b-dropdown>
<b-button variant="danger" @click="deleteJob()">{{ $t("delete") }}</b-button> <b-button variant="danger" @click="deleteJob()">{{ $t("delete") }}</b-button>
</div> </div>
@ -69,6 +81,7 @@ export default {
return { return {
loading: true, loading: true,
job: null, job: null,
console: console
} }
}, },
methods: { methods: {
@ -78,8 +91,8 @@ export default {
update() { update() {
Sist2AdminApi.updateJob(this.getName(), this.job); Sist2AdminApi.updateJob(this.getName(), this.job);
}, },
runJob() { runJob(full = false) {
Sist2AdminApi.runJob(this.getName()).then(() => { Sist2AdminApi.runJob(this.getName(), full).then(() => {
this.$bvToast.toast(this.$t("runJobConfirmation"), { this.$bvToast.toast(this.$t("runJobConfirmation"), {
title: this.$t("runJobConfirmationTitle"), title: this.$t("runJobConfirmationTitle"),
variant: "success", variant: "success",

View File

@ -169,11 +169,14 @@ def _run_job(job: Sist2Job):
@app.get("/api/job/{name:str}/run") @app.get("/api/job/{name:str}/run")
async def run_job(name: str): async def run_job(name: str, full: bool = False):
job = db["jobs"][name] job: Sist2Job = db["jobs"][name]
if not job: if not job:
raise HTTPException(status_code=404) raise HTTPException(status_code=404)
if full:
job.do_full_scan = True
_run_job(job) _run_job(job)
return "ok" return "ok"

View File

@ -59,7 +59,7 @@ export default {
const fields = [ const fields = [
"title", "duration", "audioc", "videoc", "title", "duration", "audioc", "videoc",
"bitrate", "artist", "album", "album_artist", "genre", "font_name", "author", "bitrate", "artist", "album", "album_artist", "genre", "font_name", "author", "media_comment",
"modified_by", "pages", "tag", "modified_by", "pages", "tag",
"exif_make", "exif_software", "exif_exposure_time", "exif_fnumber", "exif_focal_length", "exif_make", "exif_software", "exif_exposure_time", "exif_fnumber", "exif_focal_length",
"exif_user_comment", "exif_iso_speed_ratings", "exif_model", "exif_datetime", "exif_user_comment", "exif_iso_speed_ratings", "exif_model", "exif_datetime",

View File

@ -81,6 +81,7 @@
<li><code>doc.artist</code></li> <li><code>doc.artist</code></li>
<li><code>doc.title</code></li> <li><code>doc.title</code></li>
<li><code>doc.genre</code></li> <li><code>doc.genre</code></li>
<li><code>doc.media_comment</code></li>
<li><code>doc.album_artist</code></li> <li><code>doc.album_artist</code></li>
<li><code>doc.exif_make</code></li> <li><code>doc.exif_make</code></li>
<li><code>doc.exif_model</code></li> <li><code>doc.exif_model</code></li>

View File

@ -30,6 +30,8 @@ char *get_meta_key_text(enum metakey meta_key) {
return "genre"; return "genre";
case MetaTitle: case MetaTitle:
return "title"; return "title";
case MetaMediaComment:
return "media_comment";
case MetaFontName: case MetaFontName:
return "font_name"; return "font_name";
case MetaExifMake: case MetaExifMake:
@ -159,6 +161,7 @@ void write_document(document_t *doc) {
case MetaExifGpsLatitudeDec: case MetaExifGpsLatitudeDec:
case MetaExifGpsLatitudeRef: case MetaExifGpsLatitudeRef:
case MetaChecksum: case MetaChecksum:
case MetaMediaComment:
case MetaTitle: { case MetaTitle: {
cJSON_AddStringToObject(json, get_meta_key_text(meta->key), meta->str_val); cJSON_AddStringToObject(json, get_meta_key_text(meta->key), meta->str_val);
buffer_size_guess += (int) strlen(meta->str_val); buffer_size_guess += (int) strlen(meta->str_val);

View File

@ -11,7 +11,6 @@
#include "web/serve.h" #include "web/serve.h"
#include "parsing/mime.h" #include "parsing/mime.h"
#include "parsing/parse.h" #include "parsing/parse.h"
#include "auth0/auth0_c_api.h"
#include <signal.h> #include <signal.h>
#include <pthread.h> #include <pthread.h>
@ -425,6 +424,8 @@ int set_to_negative_if_value_is_zero(UNUSED(struct argparse *self), const struct
fprintf(stderr, "error: option `--%s` Value must be >= 0\n", option->long_name); fprintf(stderr, "error: option `--%s` Value must be >= 0\n", option->long_name);
exit(1); exit(1);
} }
return 0;
} }
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
@ -544,7 +545,7 @@ int main(int argc, const char *argv[]) {
OPT_END(), OPT_END(),
}; };
struct argparse argparse; struct argparse argparse = {};
argparse_init(&argparse, options, usage, 0); argparse_init(&argparse, options, usage, 0);
argparse_describe( argparse_describe(
&argparse, &argparse,

View File

@ -51,11 +51,11 @@
#include <ctype.h> #include <ctype.h>
#include "git_hash.h" #include "git_hash.h"
#define VERSION "3.4.0" #define VERSION "3.4.1"
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 = 0; static const int VersionPatch = 1;
#ifndef SIST_PLATFORM #ifndef SIST_PLATFORM
#define SIST_PLATFORM unknown #define SIST_PLATFORM unknown

View File

@ -272,6 +272,7 @@ static void append_audio_meta(scan_media_ctx_t *ctx, AVFormatContext *pFormatCtx
APPEND_TAG_META(MetaAlbum); APPEND_TAG_META(MetaAlbum);
} else if (strcmp(key, "comment") == 0) { } else if (strcmp(key, "comment") == 0) {
append_tag_meta_if_not_exists(ctx, doc, tag, MetaContent); append_tag_meta_if_not_exists(ctx, doc, tag, MetaContent);
APPEND_TAG_META(MetaMediaComment);
} }
} }
} }

View File

@ -63,6 +63,7 @@ enum metakey {
MetaAlbumArtist, MetaAlbumArtist,
MetaGenre, MetaGenre,
MetaTitle, MetaTitle,
MetaMediaComment,
MetaFontName, MetaFontName,
MetaExifMake, MetaExifMake,
MetaExifDescription, MetaExifDescription,