@@ -249,7 +249,7 @@ func checkMatchedScenes() {
249
249
250
250
// if len(ref.XbvrLinks) == 0 {
251
251
for _ ,xbvrActor := range xbvrScene .Cast {
252
- if strings .EqualFold (strings .TrimSpace (xbvrActor .Name ),strings .TrimSpace (performer .Performer .Name )) {
252
+ if strings .EqualFold (strings .TrimSpace (simplifyName ( xbvrActor .Name )) ,strings .TrimSpace (simplifyName ( performer .Performer .Name ) )) {
253
253
// check if actor already matched
254
254
exists := false
255
255
for _ ,link := range ref .XbvrLinks {
@@ -364,7 +364,7 @@ func matchPerformerName(scene models.StashScene, xbvrScene models.Scene, matchLe
364
364
365
365
if ref .ID != 0 && len (ref .XbvrLinks )== 0 {
366
366
for _ ,xbvrActor := range xbvrScene .Cast {
367
- if strings .EqualFold (strings .TrimSpace (xbvrActor .Name ),strings .TrimSpace (performer .Performer .Name )) {
367
+ if strings .EqualFold (strings .TrimSpace (simplifyName ( xbvrActor .Name )) ,strings .TrimSpace (simplifyName ( performer .Performer .Name ) )) {
368
368
xbvrLink := models.ExternalReferenceLink {InternalTable :"actors" ,InternalDbId :xbvrActor .ID ,InternalNameId :xbvrActor .Name ,MatchType :matchLevl ,
369
369
ExternalReferenceID :ref .ID ,ExternalSource :ref .ExternalSource ,ExternalId :ref .ExternalId }
370
370
ref .XbvrLinks = append (ref .XbvrLinks ,xbvrLink )
@@ -390,6 +390,13 @@ func matchPerformerName(scene models.StashScene, xbvrScene models.Scene, matchLe
390
390
391
391
}
392
392
393
+ func simplifyName (name string )string {
394
+ name = strings .TrimSpace (name )
395
+ name = strings .ReplaceAll (name ," " ,"" )
396
+ name = strings .ReplaceAll (name ,"." ,"" )
397
+ return strings .ReplaceAll (name ,"-" ,"" )
398
+ }
399
+
393
400
// tries to match from stash to xbvr using the aka or aliases from stash
394
401
func MatchAkaPerformers () {
395
402
tlog := log .WithField ("task" ,"scrape" )
@@ -434,10 +441,12 @@ func MatchAkaPerformers() {
434
441
435
442
for _ ,aka := range akaList {
436
443
var scene models.Scene
437
- scene .GetIfExistByPK (uint (aka .SceneInternalDbId ))
444
+
445
+ db .Preload ("Cast" ).Where (& models.Scene {ID :uint (aka .SceneInternalDbId )}).First (& scene )
446
+
438
447
for _ ,actor := range scene .Cast {
439
448
var extref models.ExternalReference
440
- if strings .EqualFold (strings .TrimSpace (actor .Name ),strings .TrimSpace (aka .AkaName )) {
449
+ if strings .EqualFold (strings .TrimSpace (simplifyName ( actor .Name )) ,strings .TrimSpace (simplifyName ( aka .AkaName ) )) {
441
450
extref .FindExternalId ("stashdb performer" ,aka .ActorId )
442
451
if extref .ID != 0 && len (extref .XbvrLinks )== 0 {
443
452
xbvrLink := models.ExternalReferenceLink {InternalTable :"actors" ,InternalDbId :actor .ID ,InternalNameId :actor .Name ,MatchType :30 ,
@@ -453,7 +462,7 @@ func MatchAkaPerformers() {
453
462
var aliases []string
454
463
json .Unmarshal ([]byte (aka .Aliases ),& aliases )
455
464
for _ ,alias := range aliases {
456
- if len (extref .XbvrLinks )== 0 && strings .EqualFold (strings .TrimSpace (actor .Name ),strings .TrimSpace (alias )) {
465
+ if len (extref .XbvrLinks )== 0 && strings .EqualFold (strings .TrimSpace (simplifyName ( actor .Name )) ,strings .TrimSpace (simplifyName ( alias ) )) {
457
466
extref .FindExternalId ("stashdb performer" ,aka .ActorId )
458
467
if extref .ID != 0 && len (extref .XbvrLinks )== 0 {
459
468
xbvrLink := models.ExternalReferenceLink {InternalTable :"actors" ,InternalDbId :actor .ID ,InternalNameId :actor .Name ,MatchType :30 ,
@@ -502,7 +511,7 @@ func ReverseMatch() {
502
511
var stashSceneData models.StashScene
503
512
json .Unmarshal ([]byte (stashScene .ExternalData ),& stashSceneData )
504
513
for _ ,performance := range stashSceneData .Performers {
505
- if strings .EqualFold (strings .TrimSpace (actor .Name ),strings .TrimSpace (performance .As )) {
514
+ if strings .EqualFold (strings .TrimSpace (simplifyName ( actor .Name )) ,strings .TrimSpace (simplifyName ( performance .As ) )) {
506
515
var extref models.ExternalReference
507
516
extref .FindExternalId ("stashdb performer" ,performance .Performer .ID )
508
517
if extref .ID != 0 {
@@ -520,7 +529,7 @@ func ReverseMatch() {
520
529
break sceneLoop
521
530
}
522
531
for _ ,alias := range performance .Performer .Aliases {
523
- if strings .EqualFold (strings .TrimSpace (actor .Name ),strings .TrimSpace (alias )) {
532
+ if strings .EqualFold (strings .TrimSpace (simplifyName ( actor .Name )) ,strings .TrimSpace (simplifyName ( alias ) )) {
524
533
var extref models.ExternalReference
525
534
extref .FindExternalId ("stashdb performer" ,performance .Performer .ID )
526
535
if extref .ID != 0 {