mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
Don't regenerate covers if present during scan (#3646)
* Don't regenerate covers if present during scan * Fix performer unit test (unrelated)
This commit is contained in:
@@ -23,12 +23,19 @@ func (t *GenerateCoverTask) GetDescription() string {
|
|||||||
func (t *GenerateCoverTask) Start(ctx context.Context) {
|
func (t *GenerateCoverTask) Start(ctx context.Context) {
|
||||||
scenePath := t.Scene.Path
|
scenePath := t.Scene.Path
|
||||||
|
|
||||||
|
var required bool
|
||||||
if err := t.txnManager.WithReadTxn(ctx, func(ctx context.Context) error {
|
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)
|
return t.Scene.LoadPrimaryFile(ctx, t.txnManager.File)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !required {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
videoFile := t.Scene.Files.Primary()
|
videoFile := t.Scene.Files.Primary()
|
||||||
if videoFile == nil {
|
if videoFile == nil {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1114,11 +1114,14 @@ func verifyPerformerAge(t *testing.T, ageCriterion models.IntCriterionInput) {
|
|||||||
|
|
||||||
d := performer.Birthdate.Time
|
d := performer.Birthdate.Time
|
||||||
age := cd.Year() - d.Year()
|
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
|
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
|
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()
|
t.Helper()
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
if criterion.Modifier == models.CriterionModifierEquals {
|
if criterion.Modifier == models.CriterionModifierEquals {
|
||||||
assert.Equal(criterion.Value, value)
|
return assert.Equal(criterion.Value, value)
|
||||||
}
|
}
|
||||||
if criterion.Modifier == models.CriterionModifierNotEquals {
|
if criterion.Modifier == models.CriterionModifierNotEquals {
|
||||||
assert.NotEqual(criterion.Value, value)
|
return assert.NotEqual(criterion.Value, value)
|
||||||
}
|
}
|
||||||
if criterion.Modifier == models.CriterionModifierGreaterThan {
|
if criterion.Modifier == models.CriterionModifierGreaterThan {
|
||||||
assert.Greater(value, criterion.Value)
|
return assert.Greater(value, criterion.Value)
|
||||||
}
|
}
|
||||||
if criterion.Modifier == models.CriterionModifierLessThan {
|
if criterion.Modifier == models.CriterionModifierLessThan {
|
||||||
assert.Less(value, criterion.Value)
|
return assert.Less(value, criterion.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSceneQueryDuration(t *testing.T) {
|
func TestSceneQueryDuration(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user