mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Add new fields to scene tagger (#3094)
* Add new fields to scene tagger * Update scraper docs with new fields * Set code and director in identify * Add new fields to identify dialog
This commit is contained in:
@@ -280,6 +280,16 @@ func getScenePartial(scene *models.Scene, scraped *scraper.ScrapedScene, fieldOp
|
|||||||
partial.URL = models.NewOptionalString(*scraped.URL)
|
partial.URL = models.NewOptionalString(*scraped.URL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if scraped.Director != nil && (scene.Director != *scraped.Director) {
|
||||||
|
if shouldSetSingleValueField(fieldOptions["director"], scene.Director != "") {
|
||||||
|
partial.Director = models.NewOptionalString(*scraped.Director)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if scraped.Code != nil && (scene.Code != *scraped.Code) {
|
||||||
|
if shouldSetSingleValueField(fieldOptions["code"], scene.Code != "") {
|
||||||
|
partial.Code = models.NewOptionalString(*scraped.Code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if setOrganized && !scene.Organized {
|
if setOrganized && !scene.Organized {
|
||||||
// just reuse the boolean since we know it's true
|
// just reuse the boolean since we know it's true
|
||||||
|
|||||||
@@ -3,7 +3,12 @@ import { Form, Button, Table } from "react-bootstrap";
|
|||||||
import { Icon } from "src/components/Shared";
|
import { Icon } from "src/components/Shared";
|
||||||
import * as GQL from "src/core/generated-graphql";
|
import * as GQL from "src/core/generated-graphql";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
import { multiValueSceneFields, SceneField, sceneFields } from "./constants";
|
import {
|
||||||
|
multiValueSceneFields,
|
||||||
|
SceneField,
|
||||||
|
sceneFieldMessageID,
|
||||||
|
sceneFields,
|
||||||
|
} from "./constants";
|
||||||
import { ThreeStateBoolean } from "./ThreeStateBoolean";
|
import { ThreeStateBoolean } from "./ThreeStateBoolean";
|
||||||
import {
|
import {
|
||||||
faCheck,
|
faCheck,
|
||||||
@@ -13,7 +18,7 @@ import {
|
|||||||
|
|
||||||
interface IFieldOptionsEditor {
|
interface IFieldOptionsEditor {
|
||||||
options: GQL.IdentifyFieldOptions | undefined;
|
options: GQL.IdentifyFieldOptions | undefined;
|
||||||
field: string;
|
field: SceneField;
|
||||||
editField: () => void;
|
editField: () => void;
|
||||||
editOptions: (o?: GQL.IdentifyFieldOptions | null) => void;
|
editOptions: (o?: GQL.IdentifyFieldOptions | null) => void;
|
||||||
editing: boolean;
|
editing: boolean;
|
||||||
@@ -64,7 +69,7 @@ const FieldOptionsEditor: React.FC<IFieldOptionsEditor> = ({
|
|||||||
}, [resetOptions]);
|
}, [resetOptions]);
|
||||||
|
|
||||||
function renderField() {
|
function renderField() {
|
||||||
return intl.formatMessage({ id: field });
|
return intl.formatMessage({ id: sceneFieldMessageID(field) });
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderStrategy() {
|
function renderStrategy() {
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ export const sceneFields = [
|
|||||||
"date",
|
"date",
|
||||||
"details",
|
"details",
|
||||||
"url",
|
"url",
|
||||||
|
"code",
|
||||||
|
"director",
|
||||||
"studio",
|
"studio",
|
||||||
"performers",
|
"performers",
|
||||||
"tags",
|
"tags",
|
||||||
@@ -25,3 +27,11 @@ export const multiValueSceneFields: SceneField[] = [
|
|||||||
"performers",
|
"performers",
|
||||||
"tags",
|
"tags",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export function sceneFieldMessageID(field: SceneField) {
|
||||||
|
if (field === "code") {
|
||||||
|
return "scene_code";
|
||||||
|
}
|
||||||
|
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|||||||
@@ -365,6 +365,8 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
|||||||
url: resolveField("url", stashScene.url, scene.url),
|
url: resolveField("url", stashScene.url, scene.url),
|
||||||
tag_ids: tagIDs,
|
tag_ids: tagIDs,
|
||||||
stash_ids: stashScene.stash_ids ?? [],
|
stash_ids: stashScene.stash_ids ?? [],
|
||||||
|
code: resolveField("code", stashScene.code, scene.code),
|
||||||
|
director: resolveField("director", stashScene.director, scene.director),
|
||||||
};
|
};
|
||||||
|
|
||||||
const includeStashID = !excludedFieldList.includes("stash_ids");
|
const includeStashID = !excludedFieldList.includes("stash_ids");
|
||||||
@@ -427,6 +429,8 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
|||||||
details: "details",
|
details: "details",
|
||||||
studio: "studio",
|
studio: "studio",
|
||||||
stash_ids: "stash_ids",
|
stash_ids: "stash_ids",
|
||||||
|
code: "code",
|
||||||
|
director: "director",
|
||||||
};
|
};
|
||||||
|
|
||||||
const maybeRenderCoverImage = () => {
|
const maybeRenderCoverImage = () => {
|
||||||
@@ -510,6 +514,21 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const maybeRenderStudioCode = () => {
|
||||||
|
if (isActive && scene.code) {
|
||||||
|
return (
|
||||||
|
<h5>
|
||||||
|
<OptionalField
|
||||||
|
exclude={excludedFields[fields.code]}
|
||||||
|
setExclude={(v) => setExcludedField(fields.code, v)}
|
||||||
|
>
|
||||||
|
{scene.code}
|
||||||
|
</OptionalField>
|
||||||
|
</h5>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const maybeRenderDateField = () => {
|
const maybeRenderDateField = () => {
|
||||||
if (isActive && scene.date) {
|
if (isActive && scene.date) {
|
||||||
return (
|
return (
|
||||||
@@ -525,6 +544,21 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const maybeRenderDirector = () => {
|
||||||
|
if (scene.director) {
|
||||||
|
return (
|
||||||
|
<h5>
|
||||||
|
<OptionalField
|
||||||
|
exclude={excludedFields[fields.director]}
|
||||||
|
setExclude={(v) => setExcludedField(fields.director, v)}
|
||||||
|
>
|
||||||
|
<FormattedMessage id="director" />: {scene.director}
|
||||||
|
</OptionalField>
|
||||||
|
</h5>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const maybeRenderURL = () => {
|
const maybeRenderURL = () => {
|
||||||
if (scene.url) {
|
if (scene.url) {
|
||||||
return (
|
return (
|
||||||
@@ -688,6 +722,7 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{maybeRenderStudioCode()}
|
||||||
{maybeRenderDateField()}
|
{maybeRenderDateField()}
|
||||||
{getDurationStatus(scene, stashSceneFile?.duration)}
|
{getDurationStatus(scene, stashSceneFile?.duration)}
|
||||||
{getFingerprintStatus(scene, stashScene)}
|
{getFingerprintStatus(scene, stashScene)}
|
||||||
@@ -696,6 +731,7 @@ const StashSearchResult: React.FC<IStashSearchResultProps> = ({
|
|||||||
{isActive && (
|
{isActive && (
|
||||||
<div className="d-flex flex-column">
|
<div className="d-flex flex-column">
|
||||||
{maybeRenderStashBoxID()}
|
{maybeRenderStashBoxID()}
|
||||||
|
{maybeRenderDirector()}
|
||||||
{maybeRenderURL()}
|
{maybeRenderURL()}
|
||||||
{maybeRenderDetails()}
|
{maybeRenderDetails()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -800,6 +800,8 @@ Details
|
|||||||
```
|
```
|
||||||
Title
|
Title
|
||||||
Details
|
Details
|
||||||
|
Code
|
||||||
|
Director
|
||||||
URL
|
URL
|
||||||
Date
|
Date
|
||||||
Image
|
Image
|
||||||
|
|||||||
Reference in New Issue
Block a user