mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
Fix batch tag update when studio/performer has no stash id (#6369)
* Handle batch tagging where stash id not set Should search by name for these * Don't set empty stash ids
This commit is contained in:
parent
41f0612025
commit
e02ef436a5
2 changed files with 12 additions and 6 deletions
|
|
@ -88,7 +88,7 @@ func (t *stashBoxBatchPerformerTagTask) findStashBoxPerformer(ctx context.Contex
|
||||||
performer = mergedPerformer
|
performer = mergedPerformer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case t.performer != nil:
|
case t.performer != nil: // tagging or updating existing performer
|
||||||
var remoteID string
|
var remoteID string
|
||||||
if err := r.WithReadTxn(ctx, func(ctx context.Context) error {
|
if err := r.WithReadTxn(ctx, func(ctx context.Context) error {
|
||||||
qb := r.Performer
|
qb := r.Performer
|
||||||
|
|
@ -123,6 +123,9 @@ func (t *stashBoxBatchPerformerTagTask) findStashBoxPerformer(ctx context.Contex
|
||||||
performer = mergedPerformer
|
performer = mergedPerformer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// find by performer name instead
|
||||||
|
performer, err = client.FindPerformerByName(ctx, t.performer.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -328,6 +331,9 @@ func (t *stashBoxBatchStudioTagTask) findStashBoxStudio(ctx context.Context) (*m
|
||||||
|
|
||||||
if remoteID != "" {
|
if remoteID != "" {
|
||||||
studio, err = client.FindStudio(ctx, remoteID)
|
studio, err = client.FindStudio(ctx, remoteID)
|
||||||
|
} else {
|
||||||
|
// find by studio name instead
|
||||||
|
studio, err = client.FindStudio(ctx, t.studio.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ func (s *ScrapedStudio) ToStudio(endpoint string, excluded map[string]bool) *Stu
|
||||||
ret := NewStudio()
|
ret := NewStudio()
|
||||||
ret.Name = strings.TrimSpace(s.Name)
|
ret.Name = strings.TrimSpace(s.Name)
|
||||||
|
|
||||||
if s.RemoteSiteID != nil && endpoint != "" {
|
if s.RemoteSiteID != nil && endpoint != "" && *s.RemoteSiteID != "" {
|
||||||
ret.StashIDs = NewRelatedStashIDs([]StashID{
|
ret.StashIDs = NewRelatedStashIDs([]StashID{
|
||||||
{
|
{
|
||||||
Endpoint: endpoint,
|
Endpoint: endpoint,
|
||||||
|
|
@ -141,7 +141,7 @@ func (s *ScrapedStudio) ToPartial(id string, endpoint string, excluded map[strin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.RemoteSiteID != nil && endpoint != "" {
|
if s.RemoteSiteID != nil && endpoint != "" && *s.RemoteSiteID != "" {
|
||||||
ret.StashIDs = &UpdateStashIDs{
|
ret.StashIDs = &UpdateStashIDs{
|
||||||
StashIDs: existingStashIDs,
|
StashIDs: existingStashIDs,
|
||||||
Mode: RelationshipUpdateModeSet,
|
Mode: RelationshipUpdateModeSet,
|
||||||
|
|
@ -306,7 +306,7 @@ func (p *ScrapedPerformer) ToPerformer(endpoint string, excluded map[string]bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.RemoteSiteID != nil && endpoint != "" {
|
if p.RemoteSiteID != nil && endpoint != "" && *p.RemoteSiteID != "" {
|
||||||
ret.StashIDs = NewRelatedStashIDs([]StashID{
|
ret.StashIDs = NewRelatedStashIDs([]StashID{
|
||||||
{
|
{
|
||||||
Endpoint: endpoint,
|
Endpoint: endpoint,
|
||||||
|
|
@ -435,7 +435,7 @@ func (p *ScrapedPerformer) ToPartial(endpoint string, excluded map[string]bool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.RemoteSiteID != nil && endpoint != "" {
|
if p.RemoteSiteID != nil && endpoint != "" && *p.RemoteSiteID != "" {
|
||||||
ret.StashIDs = &UpdateStashIDs{
|
ret.StashIDs = &UpdateStashIDs{
|
||||||
StashIDs: existingStashIDs,
|
StashIDs: existingStashIDs,
|
||||||
Mode: RelationshipUpdateModeSet,
|
Mode: RelationshipUpdateModeSet,
|
||||||
|
|
@ -464,7 +464,7 @@ func (t *ScrapedTag) ToTag(endpoint string, excluded map[string]bool) *Tag {
|
||||||
ret := NewTag()
|
ret := NewTag()
|
||||||
ret.Name = t.Name
|
ret.Name = t.Name
|
||||||
|
|
||||||
if t.RemoteSiteID != nil && endpoint != "" {
|
if t.RemoteSiteID != nil && endpoint != "" && *t.RemoteSiteID != "" {
|
||||||
ret.StashIDs = NewRelatedStashIDs([]StashID{
|
ret.StashIDs = NewRelatedStashIDs([]StashID{
|
||||||
{
|
{
|
||||||
Endpoint: endpoint,
|
Endpoint: endpoint,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue