diff --git a/ui/v2.5/src/components/Tagger/scenes/SceneTagger.tsx b/ui/v2.5/src/components/Tagger/scenes/SceneTagger.tsx index 96dd2cc1d87..abd4ac52131 100755 --- a/ui/v2.5/src/components/Tagger/scenes/SceneTagger.tsx +++ b/ui/v2.5/src/components/Tagger/scenes/SceneTagger.tsx @@ -188,11 +188,20 @@ export const Tagger: React.FC = ({ scenes, queue }) => { const [nbPhashMatchSceneB, ratioPhashMatchSceneB] = calculatePhashComparisonScore(stashScene, sceneB); - if (nbPhashMatchSceneA != nbPhashMatchSceneB) { + // If only one scene has matching phash, prefer that scene + if ( + (nbPhashMatchSceneA != nbPhashMatchSceneB && nbPhashMatchSceneA === 0) || + nbPhashMatchSceneB === 0 + ) { return nbPhashMatchSceneB - nbPhashMatchSceneA; } - // Same number of phash matches, check duration + // Prefer scene with highest ratio of phash matches + if (ratioPhashMatchSceneA !== ratioPhashMatchSceneB) { + return ratioPhashMatchSceneB - ratioPhashMatchSceneA; + } + + // Same ratio of phash matches, check duration const [ nbDurationMatchSceneA, ratioDurationMatchSceneA, @@ -213,11 +222,6 @@ export const Tagger: React.FC = ({ scenes, queue }) => { return ratioDurationMatchSceneB - ratioDurationMatchSceneA; } - // Damn this is close... Check phash ratio - if (ratioPhashMatchSceneA !== ratioPhashMatchSceneB) { - return ratioPhashMatchSceneB - ratioPhashMatchSceneA; - } - // fall back to duration difference - less is better return minDurationDiffSceneA - minDurationDiffSceneB; } diff --git a/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx b/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx index f2f20f8aa44..47b20417e01 100755 --- a/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx +++ b/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx @@ -5,12 +5,18 @@ import { FormattedMessage, useIntl } from "react-intl"; import uniq from "lodash-es/uniq"; import { blobToBase64 } from "base64-blob"; import { distance } from "src/utils/hamming"; +import { faCheckCircle } from "@fortawesome/free-regular-svg-icons"; +import { + faPlus, + faTriangleExclamation, + faXmark, +} from "@fortawesome/free-solid-svg-icons"; import * as GQL from "src/core/generated-graphql"; import { HoverPopover } from "src/components/Shared/HoverPopover"; import { Icon } from "src/components/Shared/Icon"; -import { LoadingIndicator } from "src/components/Shared/LoadingIndicator"; import { SuccessIcon } from "src/components/Shared/SuccessIcon"; +import { LoadingIndicator } from "src/components/Shared/LoadingIndicator"; import { TagSelect } from "src/components/Shared/Select"; import { TruncatedText } from "src/components/Shared/TruncatedText"; import { OperationButton } from "src/components/Shared/OperationButton"; @@ -22,10 +28,25 @@ import { SceneTaggerModalsState } from "./sceneTaggerModals"; import PerformerResult from "./PerformerResult"; import StudioResult from "./StudioResult"; import { useInitialState } from "src/hooks/state"; -import { faPlus } from "@fortawesome/free-solid-svg-icons"; import { getStashboxBase } from "src/utils/stashbox"; import { ExternalLink } from "src/components/Shared/ExternalLink"; +const getDurationIcon = (matchPercentage: number) => { + if (matchPercentage > 65) + return ( + + ); + if (matchPercentage > 35) + return ( + + ); + + return ; +}; + const getDurationStatus = ( scene: IScrapedScene, stashDuration: number | undefined | null @@ -52,10 +73,12 @@ const getDurationStatus = ( else if (scene.duration && Math.abs(scene.duration - stashDuration) < 5) match = ; + const matchPercentage = (matchCount / durations.length) * 100; + if (match) return (
- + {getDurationIcon(matchPercentage)} {match}
); @@ -146,7 +169,7 @@ const getFingerprintStatus = (
{phashMatches.length > 0 && (
- +