mirror of
https://github.com/stashapp/stash.git
synced 2026-06-11 07:41:08 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e685f80e3d | ||
|
|
9b8d124ac8 | ||
|
|
0cd0151251 | ||
|
|
a6ef924d06 | ||
|
|
3ab8f4aca6 | ||
|
|
2d8b6e1722 |
@@ -36,5 +36,7 @@ services:
|
||||
- ./metadata:/metadata
|
||||
## Any other cache content.
|
||||
- ./cache:/cache
|
||||
## Where to store binary blob data (scene covers, images)
|
||||
- ./blobs:/blobs
|
||||
## Where to store generated content (screenshots,previews,transcodes,sprites)
|
||||
- ./generated:/generated
|
||||
|
||||
@@ -23,12 +23,19 @@ func (t *GenerateCoverTask) GetDescription() string {
|
||||
func (t *GenerateCoverTask) Start(ctx context.Context) {
|
||||
scenePath := t.Scene.Path
|
||||
|
||||
var required bool
|
||||
if err := t.txnManager.WithReadTxn(ctx, func(ctx context.Context) error {
|
||||
// don't generate the screenshot if it already exists
|
||||
required = t.required(ctx)
|
||||
return t.Scene.LoadPrimaryFile(ctx, t.txnManager.File)
|
||||
}); err != nil {
|
||||
logger.Error(err)
|
||||
}
|
||||
|
||||
if !required {
|
||||
return
|
||||
}
|
||||
|
||||
videoFile := t.Scene.Files.Primary()
|
||||
if videoFile == nil {
|
||||
return
|
||||
|
||||
@@ -1114,11 +1114,14 @@ func verifyPerformerAge(t *testing.T, ageCriterion models.IntCriterionInput) {
|
||||
|
||||
d := performer.Birthdate.Time
|
||||
age := cd.Year() - d.Year()
|
||||
if cd.YearDay() < d.YearDay() {
|
||||
// using YearDay screws up on leap years
|
||||
if cd.Month() < d.Month() || (cd.Month() == d.Month() && cd.Day() < d.Day()) {
|
||||
age = age - 1
|
||||
}
|
||||
|
||||
verifyInt(t, age, ageCriterion)
|
||||
if !verifyInt(t, age, ageCriterion) {
|
||||
t.Errorf("Performer birthdate: %s, deathdate: %s", performer.Birthdate.String(), performer.DeathDate.String())
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -2836,21 +2836,23 @@ func verifyScenesOCounter(t *testing.T, oCounterCriterion models.IntCriterionInp
|
||||
})
|
||||
}
|
||||
|
||||
func verifyInt(t *testing.T, value int, criterion models.IntCriterionInput) {
|
||||
func verifyInt(t *testing.T, value int, criterion models.IntCriterionInput) bool {
|
||||
t.Helper()
|
||||
assert := assert.New(t)
|
||||
if criterion.Modifier == models.CriterionModifierEquals {
|
||||
assert.Equal(criterion.Value, value)
|
||||
return assert.Equal(criterion.Value, value)
|
||||
}
|
||||
if criterion.Modifier == models.CriterionModifierNotEquals {
|
||||
assert.NotEqual(criterion.Value, value)
|
||||
return assert.NotEqual(criterion.Value, value)
|
||||
}
|
||||
if criterion.Modifier == models.CriterionModifierGreaterThan {
|
||||
assert.Greater(value, criterion.Value)
|
||||
return assert.Greater(value, criterion.Value)
|
||||
}
|
||||
if criterion.Modifier == models.CriterionModifierLessThan {
|
||||
assert.Less(value, criterion.Value)
|
||||
return assert.Less(value, criterion.Value)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func TestSceneQueryDuration(t *testing.T) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
ScrapedInputGroupRow,
|
||||
ScrapedTextAreaRow,
|
||||
ScrapeResult,
|
||||
ZeroableScrapeResult,
|
||||
} from "../Shared/ScrapeDialog";
|
||||
import { clone, uniq } from "lodash-es";
|
||||
import {
|
||||
@@ -65,8 +66,9 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
||||
);
|
||||
|
||||
const [rating, setRating] = useState(
|
||||
new ScrapeResult<number>(dest.rating100)
|
||||
new ZeroableScrapeResult<number>(dest.rating100)
|
||||
);
|
||||
// zero values can be treated as missing for these fields
|
||||
const [oCounter, setOCounter] = useState(
|
||||
new ScrapeResult<number>(dest.o_counter)
|
||||
);
|
||||
@@ -118,7 +120,7 @@ const SceneMergeDetails: React.FC<ISceneMergeDetailsProps> = ({
|
||||
const [stashIDs, setStashIDs] = useState(new ScrapeResult<GQL.StashId[]>([]));
|
||||
|
||||
const [organized, setOrganized] = useState(
|
||||
new ScrapeResult<boolean>(dest.organized)
|
||||
new ZeroableScrapeResult<boolean>(dest.organized)
|
||||
);
|
||||
|
||||
const [image, setImage] = useState<ScrapeResult<string>>(
|
||||
|
||||
@@ -36,7 +36,9 @@ export class ScrapeResult<T> {
|
||||
) {
|
||||
this.originalValue = originalValue ?? undefined;
|
||||
this.newValue = newValue ?? undefined;
|
||||
const hasNewValue = newValue !== undefined;
|
||||
// NOTE: this means that zero values are treated as null
|
||||
// this is incorrect for numbers and booleans, but correct for strings
|
||||
const hasNewValue = !!this.newValue;
|
||||
|
||||
const valuesEqual = isEqual(originalValue, newValue);
|
||||
this.useNewValue = useNewValue ?? (hasNewValue && !valuesEqual);
|
||||
@@ -68,6 +70,23 @@ export class ScrapeResult<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// for types where !!value is a valid value (boolean and number)
|
||||
export class ZeroableScrapeResult<T> extends ScrapeResult<T> {
|
||||
public constructor(
|
||||
originalValue?: T | null,
|
||||
newValue?: T | null,
|
||||
useNewValue?: boolean
|
||||
) {
|
||||
super(originalValue, newValue, useNewValue);
|
||||
|
||||
const hasNewValue = this.newValue !== undefined;
|
||||
|
||||
const valuesEqual = isEqual(originalValue, newValue);
|
||||
this.useNewValue = useNewValue ?? (hasNewValue && !valuesEqual);
|
||||
this.scraped = hasNewValue && !valuesEqual;
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function hasScrapedValues(values: ScrapeResult<any>[]) {
|
||||
return values.some((r) => r.scraped);
|
||||
|
||||
@@ -38,6 +38,9 @@ Once migrated, these files can be deleted. The files can be optionally deleted d
|
||||
* Overhauled and improved HLS streaming. ([#3274](https://github.com/stashapp/stash/pull/3274))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
* **[0.20.2]** Fixed empty strings being preferred in scrape dialog. ([#3647](https://github.com/stashapp/stash/pull/3647))
|
||||
* **[0.20.2]** Fixed scene covers being regenerated when video file was moved. ([#3646](https://github.com/stashapp/stash/pull/3646))
|
||||
* **[0.20.1]** Fixed null values being preferred in scrape dialog. ([#3621](https://github.com/stashapp/stash/pull/3621))
|
||||
* Fixed login screen not working correctly from the logout screen. ([#3555](https://github.com/stashapp/stash/pull/3555))
|
||||
* Fixed incorrect stash ID being overwritten when updating performer with multiple stash-box endpoints. ([#3543](https://github.com/stashapp/stash/pull/3543)
|
||||
* Fixed batch performer update overwriting incorrect stash IDs when multiple endpoints are configured. ([#3548](https://github.com/stashapp/stash/pull/3548))
|
||||
|
||||
Reference in New Issue
Block a user