Make phash a link to duplicates (#2154)

This commit is contained in:
kermieisinthehouse
2021-12-21 23:51:49 +00:00
committed by GitHub
parent 523edfb575
commit deb5a2958d
4 changed files with 24 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
* Added forward jump 10 second button to video player. ([#1973](https://github.com/stashapp/stash/pull/1973)) * Added forward jump 10 second button to video player. ([#1973](https://github.com/stashapp/stash/pull/1973))
### 🎨 Improvements ### 🎨 Improvements
* Made scene phash field in File Info tab a link to show duplicate scenes. ([#2154](https://github.com/stashapp/stash/pull/2154))
* Show Created/Updated dates in scene/image/gallery details pages. ([#2145](https://github.com/stashapp/stash/pull/2145)) * Show Created/Updated dates in scene/image/gallery details pages. ([#2145](https://github.com/stashapp/stash/pull/2145))
* Added support for setting scrapers path in the settings page. ([#2124](https://github.com/stashapp/stash/pull/2124)) * Added support for setting scrapers path in the settings page. ([#2124](https://github.com/stashapp/stash/pull/2124))
* Added keyboard shortcuts to hide scene page sidebar and scene scrubber. ([#2099](https://github.com/stashapp/stash/pull/2099)) * Added keyboard shortcuts to hide scene page sidebar and scene scrubber. ([#2099](https://github.com/stashapp/stash/pull/2099))

View File

@@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { FormattedMessage, FormattedNumber, useIntl } from "react-intl"; import { FormattedMessage, FormattedNumber, useIntl } from "react-intl";
import * as GQL from "src/core/generated-graphql"; import * as GQL from "src/core/generated-graphql";
import { TextUtils } from "src/utils"; import { NavUtils, TextUtils } from "src/utils";
import { TextField, URLField } from "src/utils/field"; import { TextField, URLField } from "src/utils/field";
interface ISceneFileInfoPanelProps { interface ISceneFileInfoPanelProps {
@@ -104,11 +104,14 @@ export const SceneFileInfoPanel: React.FC<ISceneFileInfoPanelProps> = (
value={props.scene.checksum} value={props.scene.checksum}
truncate truncate
/> />
<TextField <URLField
id="media_info.phash" id="media_info.phash"
abbr="Perceptual hash" abbr="Perceptual hash"
value={props.scene.phash} value={props.scene.phash}
url={NavUtils.makeScenesPHashMatchUrl(props.scene.phash)}
target="_self"
truncate truncate
trusted
/> />
<URLField <URLField
id="path" id="path"

View File

@@ -1,5 +1,5 @@
import { CriterionModifier } from "src/core/generated-graphql"; import { CriterionModifier } from "src/core/generated-graphql";
import { CriterionOption } from "./criterion"; import { CriterionOption, StringCriterion } from "./criterion";
export const PhashCriterionOption = new CriterionOption({ export const PhashCriterionOption = new CriterionOption({
messageID: "media_info.phash", messageID: "media_info.phash",
@@ -13,3 +13,9 @@ export const PhashCriterionOption = new CriterionOption({
CriterionModifier.NotNull, CriterionModifier.NotNull,
], ],
}); });
export class PhashCriterion extends StringCriterion {
constructor() {
super(PhashCriterionOption);
}
}

View File

@@ -18,6 +18,7 @@ import {
CriterionValue, CriterionValue,
} from "src/models/list-filter/criteria/criterion"; } from "src/models/list-filter/criteria/criterion";
import { GalleriesCriterion } from "src/models/list-filter/criteria/galleries"; import { GalleriesCriterion } from "src/models/list-filter/criteria/galleries";
import { PhashCriterion } from "src/models/list-filter/criteria/phash";
function addExtraCriteria( function addExtraCriteria(
dest: Criterion<CriterionValue>[], dest: Criterion<CriterionValue>[],
@@ -270,6 +271,15 @@ const makeSceneMarkerUrl = (
return `/scenes/${sceneMarker.scene.id}?t=${sceneMarker.seconds}`; return `/scenes/${sceneMarker.scene.id}?t=${sceneMarker.seconds}`;
}; };
const makeScenesPHashMatchUrl = (phash: GQL.Maybe<string> | undefined) => {
if (!phash) return "#";
const filter = new ListFilterModel(GQL.FilterMode.Scenes);
const criterion = new PhashCriterion();
criterion.value = phash;
filter.criteria.push(criterion);
return `/scenes?${filter.makeQueryParameters()}`;
};
const makeGalleryImagesUrl = ( const makeGalleryImagesUrl = (
gallery: Partial<GQL.GalleryDataFragment | GQL.SlimGalleryDataFragment>, gallery: Partial<GQL.GalleryDataFragment | GQL.SlimGalleryDataFragment>,
extraCriteria?: Criterion<CriterionValue>[] extraCriteria?: Criterion<CriterionValue>[]
@@ -302,6 +312,7 @@ export default {
makeTagPerformersUrl, makeTagPerformersUrl,
makeTagGalleriesUrl, makeTagGalleriesUrl,
makeTagImagesUrl, makeTagImagesUrl,
makeScenesPHashMatchUrl,
makeSceneMarkerUrl, makeSceneMarkerUrl,
makeMovieScenesUrl, makeMovieScenesUrl,
makeChildStudiosUrl, makeChildStudiosUrl,