Skip to content

Commit

Permalink
Fixed MovieIDs == nil bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NodudeWasTaken committed Oct 10, 2023
1 parent 4298fd4 commit 2287dd6
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions internal/heresphere/tags_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ func handleTags(ctx context.Context, scn *models.Scene, user *HeresphereAuthReq,
if handleAddMarker(ctx, rs, tagI, scn) {
continue
}
if handleAddMovie(ctx, rs, tagI, scn, ret) {
continue
}
if handleAddStudio(ctx, rs, tagI, scn, ret) {
continue
}
Expand Down Expand Up @@ -191,29 +188,6 @@ func handleAddMarker(ctx context.Context, rs Routes, tag HeresphereVideoTag, sce

return true
}
func handleAddMovie(ctx context.Context, rs Routes, tag HeresphereVideoTag, scene *models.Scene, ret *scene.UpdateSet) bool {
if !strings.HasPrefix(tag.Name, "Movie:") {
return false
}

after := strings.TrimPrefix(tag.Name, "Movie:")

var err error
var tagMod *models.Movie
if err := txn.WithReadTxn(ctx, rs.TxnManager, func(ctx context.Context) error {
// Search for performer
tagMod, err = rs.Repository.Movie.FindByName(ctx, after, true)
return err
}); err == nil {
ret.Partial.MovieIDs.Mode = models.RelationshipUpdateModeSet
ret.Partial.MovieIDs.AddUnique(models.MoviesScenes{
MovieID: tagMod.ID,
SceneIndex: &scene.ID,
})
}

return true
}
func handleAddStudio(ctx context.Context, rs Routes, tag HeresphereVideoTag, scene *models.Scene, ret *scene.UpdateSet) bool {
if !strings.HasPrefix(tag.Name, "Studio:") {
return false
Expand Down

0 comments on commit 2287dd6

Please sign in to comment.