Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stash-Box Performer Tagger #1277

Merged
merged 27 commits into from
May 3, 2021

Conversation

ghost
Copy link

@ghost ghost commented Apr 8, 2021

Adds a performer tagger view to tag or update performer data from a stash-box instance. Also adds batch addition of comma separated performers, batch querying of untagged performers, and batch updating of tagged performers. Batch operations run as backend tasks.

Likely still some bugs to iron out, but all functionality should work.

@peolic
Copy link
Contributor

peolic commented Apr 9, 2021

Cool 😃

  • Some of the information is overflowing(?) on the tagger's "Update Performer" modal

  • ✔️ Batch add performers not working? - I click the button, get the modal, I input names, click the "Add Performers" button - nothing happens; no console error, no network request.

  • I would personally like a https://stashdb.org/performer/:id link somewhere in the "Update Performer" modal (as in, before confirming the match). Useful for checking their scenes, but, up to you 🙂

@ghost
Copy link
Author

ghost commented Apr 9, 2021

  • Batch add performers not working? - I click the button, get the modal, I input names, click the "Add Performers" button - nothing happens; no console error, no network request.

Never code when tired. Fixed now, thanks.

I'll take another pass over the performer modal and sort out the issues you mentioned.

@peolic
Copy link
Contributor

peolic commented Apr 9, 2021

Uhh, one more thing for update performer modal:
I'm not sure if it's just me,
but seeing empty fields (for example if the "Tattoos" field is empty on StashDB) checked by default made me think keeping them checked would remove the current stored data for the performer.

@ghost
Copy link
Author

ghost commented Apr 9, 2021

Modal has been updated to fix overflow, hide empty fields, and add a source link.

@peolic
Copy link
Contributor

peolic commented Apr 9, 2021

The changes look great 👍

@peolic
Copy link
Contributor

peolic commented Apr 9, 2021

I'm getting this error (consistently) when trying to search for Gianna Love:
runtime error: invalid memory address or nil pointer dereference

Steps to reproduce:

  • Create performer with name Gianna Love (other fields can be empty)
  • Go to performer tagger view and click "Search" for this performer.
  • UI says Network Error, console prints the error and stack.

From the error stack, looks like this is related to one of the results' career length format?

github.com/stashapp/stash/pkg/scraper/stashbox.formatCareerLength(0x0, 0xc0004e57e0, 0xc0004e5370)
        /stash/pkg/scraper/stashbox/stash_box.go:341 +0x6c
Error Stack
ERRO[2021-04-10 02:21:36] runtime error: invalid memory address or nil pointer dereference
goroutine 44 [running]:
runtime/debug.Stack(0xc001ae6480, 0xc001ae6480, 0x1)
        /usr/local/go/src/runtime/debug/stack.go:24 +0xa4
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x29
github.com/stashapp/stash/pkg/api.Start.func1(0x2559f00, 0xc00061f650, 0x13792e0, 0x12276b0, 0x9, 0xc000562670)
        /stash/pkg/api/server.go:143 +0x6c
github.com/stashapp/stash/pkg/models.(*executionContext)._Query_queryStashBoxPerformer.func1(0xc0002dd6a0, 0xc0002dd7a0, 0xc00027ab70)
        /stash/pkg/models/generated_exec.go:17575 +0x7f
panic(0x13792e0, 0x12276b0)
        /usr/local/go/src/runtime/panic.go:679 +0x1c0
github.com/stashapp/stash/pkg/scraper/stashbox.formatCareerLength(0x0, 0xc0004e57e0, 0xc0004e5370)
        /stash/pkg/scraper/stashbox/stash_box.go:341 +0x6c
github.com/stashapp/stash/pkg/scraper/stashbox.performerFragmentToScrapedScenePerformer(0xc0006d1d10, 0x24, 0xc0004e4480, 0xb, 0x0, 0x2e1c518, 0x0, 0x0, 0xc001fca4e0, 0x2e1c518, ...)
        /stash/pkg/scraper/stashbox/stash_box.go:408 +0x1ec
github.com/stashapp/stash/pkg/scraper/stashbox.Client.queryStashBoxPerformer(0xc00047e2a8, 0x254d200, 0x2e1c518, 0xc0002e7940, 0xb, 0xfac079, 0x1497800, 0xc000479140, 0x13008e0, 0x1b)
        /stash/pkg/scraper/stashbox/stash_box.go:237 +0x15a
github.com/stashapp/stash/pkg/scraper/stashbox.Client.QueryStashBoxPerformer(0xc00047e2a8, 0x254d200, 0x2e1c518, 0xc0002e7940, 0xb, 0xb, 0x254d200, 0x2e1c518, 0xc000479140, 0x0)
        /stash/pkg/scraper/stashbox/stash_box.go:216 +0x7b
github.com/stashapp/stash/pkg/api.(*queryResolver).QueryStashBoxPerformer(0xc00047e288, 0x2559f00, 0xc00061f650, 0x0, 0x0, 0x0, 0x0, 0xc0002dd820, 0x142cee0, 0x0, ...)
        /stash/pkg/api/resolver_query_scraper.go:125 +0x219
github.com/stashapp/stash/pkg/models.(*executionContext)._Query_queryStashBoxPerformer.func2(0x2559f00, 0xc00061f650, 0x20, 0x142cee0, 0x1, 0xc000478fc0)
        /stash/pkg/models/generated_exec.go:17596 +0x17b
github.com/99designs/gqlgen/graphql/executor.processExtensions.func3(0x2559f00, 0xc00061f650, 0xc000478fc0, 0xc00061f680, 0xc00061f6b0, 0x0, 0x0)
        /stash/vendor/github.com/99designs/gqlgen/graphql/executor/extensions.go:62 +0x41
github.com/stashapp/stash/pkg/models.(*executionContext)._Query_queryStashBoxPerformer(0xc0002dd6a0, 0x2559f00, 0xc00061f620, 0xc00041e580, 0xc000478ee0, 0x2, 0x2, 0x0, 0x0)
        /stash/pkg/models/generated_exec.go:17594 +0x2f7
github.com/stashapp/stash/pkg/models.(*executionContext)._Query.func41(0x0, 0x0)
        /stash/pkg/models/generated_exec.go:32555 +0xfa
github.com/99designs/gqlgen/graphql.(*FieldSet).Dispatch(0xc001ec6190)
        /stash/vendor/github.com/99designs/gqlgen/graphql/fieldset.go:34 +0x1d8
github.com/stashapp/stash/pkg/models.(*executionContext)._Query(0xc0002dd6a0, 0x2559f00, 0xc00061f530, 0xc0002dc930, 0x1, 0x1, 0x40e0a0, 0xc00061f530)
        /stash/pkg/models/generated_exec.go:32717 +0x495
github.com/stashapp/stash/pkg/models.(*executableSchema).Exec.func1(0x2559f00, 0xc00061f530, 0x10)
        /stash/pkg/models/generated_exec.go:4801 +0x82
github.com/99designs/gqlgen/graphql/executor.(*Executor).DispatchOperation.func1.1.1(0x2559f00, 0xc00061f530, 0xc0002dd6b0)
        /stash/vendor/github.com/99designs/gqlgen/graphql/executor/executor.go:105 +0x4a
github.com/99designs/gqlgen/graphql/executor.processExtensions.func2(0x2559f00, 0xc00061f530, 0xc0002dd6b0, 0x25162d0)
        /stash/vendor/github.com/99designs/gqlgen/graphql/executor/extensions.go:59 +0x41
github.com/99designs/gqlgen/graphql/executor.(*Executor).DispatchOperation.func1.1(0x2559f00, 0xc00061f4d0, 0xc00061f4a0)
        /stash/vendor/github.com/99designs/gqlgen/graphql/executor/executor.go:104 +0x131
github.com/99designs/gqlgen/graphql/handler/transport.POST.Do(0x2554c00, 0xc001ec6050, 0xc00030d400, 0x25545c0, 0xc000470240)
        /stash/vendor/github.com/99designs/gqlgen/graphql/handler/transport/http_post.go:53 +0x3ab
github.com/99designs/gqlgen/graphql/handler.(*Server).ServeHTTP(0xc00040ce20, 0x2554c00, 0xc001ec6050, 0xc00030d400)
        /stash/vendor/github.com/99designs/gqlgen/graphql/handler/server.go:115 +0x208
net/http.HandlerFunc.ServeHTTP(0xc000224500, 0x2554c00, 0xc001ec6050, 0xc00030d100)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/go-chi/chi.(*Mux).routeHTTP(0xc00056cf60, 0x2554c00, 0xc001ec6050, 0xc00030d100)
        /stash/vendor/github.com/go-chi/chi/mux.go:425 +0x27f
net/http.HandlerFunc.ServeHTTP(0xc000224510, 0x2554c00, 0xc001ec6050, 0xc00030d100)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/stashapp/stash/pkg/api.DatabaseCheckMiddleware.func1(0x2554c00, 0xc001ec6050, 0xc00030d100)
        /stash/pkg/api/server.go:459 +0x10e
net/http.HandlerFunc.ServeHTTP(0xc00040cea0, 0x2554c00, 0xc001ec6050, 0xc00030d100)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/stashapp/stash/pkg/api.ConfigCheckMiddleware.func1(0x2554c00, 0xc001ec6050, 0xc00030d100)
        /stash/pkg/api/server.go:443 +0xcb
net/http.HandlerFunc.ServeHTTP(0xc00040cec0, 0x2554c00, 0xc001ec6050, 0xc00030d100)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/stashapp/stash/pkg/api.BaseURLMiddleware.func1(0x2554c00, 0xc001ec6050, 0xc00030ce00)
        /stash/pkg/api/server.go:427 +0x2d0
net/http.HandlerFunc.ServeHTTP(0xc00040cee0, 0x2554c00, 0xc001ec6050, 0xc00030ce00)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/rs/cors.(*Cors).Handler.func1(0x2554c00, 0xc001ec6050, 0xc00030ce00)
        /stash/vendor/github.com/rs/cors/cors.go:207 +0x1b6
net/http.HandlerFunc.ServeHTTP(0xc00040cf00, 0x2554c00, 0xc001ec6050, 0xc00030ce00)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/go-chi/chi/middleware.StripSlashes.func1(0x2554c00, 0xc001ec6050, 0xc00030ce00)
        /stash/vendor/github.com/go-chi/chi/middleware/strip.go:25 +0xf5
net/http.HandlerFunc.ServeHTTP(0xc00040cf20, 0x2554c00, 0xc001ec6050, 0xc00030ce00)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/go-chi/chi/middleware.Compress.func1.1(0x2556b40, 0xc000540000, 0xc00030ce00)
        /stash/vendor/github.com/go-chi/chi/middleware/compress.go:148 +0x1c6
net/http.HandlerFunc.ServeHTTP(0xc0007268d0, 0x2556b40, 0xc000540000, 0xc00030ce00)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/go-chi/chi/middleware.Recoverer.func1(0x2556b40, 0xc000540000, 0xc00030ce00)
        /stash/vendor/github.com/go-chi/chi/middleware/recoverer.go:35 +0xc2
net/http.HandlerFunc.ServeHTTP(0xc00040cfa0, 0x2556b40, 0xc000540000, 0xc00030ce00)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/stashapp/stash/pkg/api.authenticateHandler.func1.1(0x2556b40, 0xc000540000, 0xc00030c300)
        /stash/pkg/api/server.go:107 +0x774
net/http.HandlerFunc.ServeHTTP(0xc00040cfc0, 0x2556b40, 0xc000540000, 0xc00030c300)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/go-chi/chi/middleware.Heartbeat.func1.1(0x2556b40, 0xc000540000, 0xc00030c300)
        /stash/vendor/github.com/go-chi/chi/middleware/heartbeat.go:21 +0x1de
net/http.HandlerFunc.ServeHTTP(0xc000726900, 0x2556b40, 0xc000540000, 0xc00030c300)
        /usr/local/go/src/net/http/server.go:2036 +0x4b
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc00056cf60, 0x2556b40, 0xc000540000, 0xc00030c000)
        /stash/vendor/github.com/go-chi/chi/mux.go:82 +0x2b9
net/http.serverHandler.ServeHTTP(0xc0004a62a0, 0x2556b40, 0xc000540000, 0xc00030c000)
        /usr/local/go/src/net/http/server.go:2831 +0xab
net/http.(*conn).serve(0xc0005180a0, 0x2559e40, 0xc00037a540)
        /usr/local/go/src/net/http/server.go:1919 +0x87c
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2957 +0x38b

@ghost
Copy link
Author

ghost commented Apr 10, 2021

I'm getting this error (consistently) when trying to search for Gianna Love:
runtime error: invalid memory address or nil pointer dereference

Thanks for the detailed bug report. The code assumed if career end was defined, career start would be as well, but that's of course not necessarily true.

@bnkai
Copy link
Collaborator

bnkai commented Apr 12, 2021

The UI doesnt seem to handle errors when doing a PerformerUpdate mutation
Doing a performer update on a performer that i had with an alias instead of a name, the error from the query was
{"errors":[{"message":"UNIQUE constraint failed: performers.checksum","path":["performerUpdate"]}],"data":{"performerUpdate":null}}
Instead of printing an error the status is stuck in saving performer.

@WithoutPants WithoutPants added the feature Pull requests that add a new feature label Apr 27, 2021
@WithoutPants WithoutPants added this to the Version 0.7.0 milestone Apr 27, 2021
@ghost
Copy link
Author

ghost commented Apr 28, 2021

The UI doesnt seem to handle errors when doing a PerformerUpdate mutation
Doing a performer update on a performer that i had with an alias instead of a name, the error from the query was
{"errors":[{"message":"UNIQUE constraint failed: performers.checksum","path":["performerUpdate"]}],"data":{"performerUpdate":null}}
Instead of printing an error the status is stuck in saving performer.

Thanks for the heads up, should be fixed now.

@bnkai
Copy link
Collaborator

bnkai commented Apr 30, 2021

Minor issue
CreatedAt is not ok when batch creating performers. The UpdatedAt seemed ok, looking at the code though it seems that it would have an issue too if the performer in stash-box doesnt contain any image.
EDIT: Everything else, including latest fix, seems to work fine.

@ghost
Copy link
Author

ghost commented Apr 30, 2021

CreatedAt is not ok when batch creating performers. The UpdatedAt seemed ok

Good catch. I think I assumed it would be set automatically, but I've added it in now.

looking at the code though it seems that it would have an issue too if the performer in stash-box doesnt contain any image.

Works fine from my testing. It checks the length of the image slice first, and a nil slice has length 0, so nothing happens.

@bnkai
Copy link
Collaborator

bnkai commented Apr 30, 2021

Yeah i meant the UpdatedAt wouldnt be correct either since it was updated from the UpdateImage when the performer has an image.
Doesn't matter though. With the fix it looks ok.

@WithoutPants WithoutPants merged commit 896c387 into stashapp:develop May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull requests that add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants