mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Check if gallery is already associated during scanning (#1154)
This commit is contained in:
@@ -315,14 +315,22 @@ func (t *ScanTask) associateGallery(wg *sizedwaitgroup.SizedWaitGroup) {
|
|||||||
scene, _ := sqb.FindByPath(scenePath)
|
scene, _ := sqb.FindByPath(scenePath)
|
||||||
// found related Scene
|
// found related Scene
|
||||||
if scene != nil {
|
if scene != nil {
|
||||||
logger.Infof("associate: Gallery %s is related to scene: %d", t.FilePath, scene.ID)
|
sceneGalleries, _ := sqb.FindByGalleryID(g.ID) // check if gallery is already associated to the scene
|
||||||
|
isAssoc := false
|
||||||
if err := sqb.UpdateGalleries(scene.ID, []int{g.ID}); err != nil {
|
for _, sg := range sceneGalleries {
|
||||||
return err
|
if scene.ID == sg.ID {
|
||||||
|
isAssoc = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !isAssoc {
|
||||||
|
logger.Infof("associate: Gallery %s is related to scene: %d", t.FilePath, scene.ID)
|
||||||
|
if err := sqb.UpdateGalleries(scene.ID, []int{g.ID}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
logger.Error(err.Error())
|
logger.Error(err.Error())
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
* Added Rescan button to scene, image, gallery details overflow button.
|
* Added Rescan button to scene, image, gallery details overflow button.
|
||||||
|
|
||||||
### 🐛 Bug fixes
|
### 🐛 Bug fixes
|
||||||
|
* Fix scan re-associating galleries to the same scene.
|
||||||
* Fix SQL error when filtering galleries excluding performers or tags.
|
* Fix SQL error when filtering galleries excluding performers or tags.
|
||||||
* Fix version checking for armv7 and arm64.
|
* Fix version checking for armv7 and arm64.
|
||||||
* Change "Is NULL" filter to include empty string values.
|
* Change "Is NULL" filter to include empty string values.
|
||||||
|
|||||||
Reference in New Issue
Block a user