Check if gallery is already associated during scanning (#1154)

This commit is contained in:
bnkai 2021-03-01 07:37:55 +02:00 committed by GitHub
parent 4825de7d35
commit fe990e00c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -315,14 +315,22 @@ func (t *ScanTask) associateGallery(wg *sizedwaitgroup.SizedWaitGroup) {
scene, _ := sqb.FindByPath(scenePath)
// found related Scene
if scene != nil {
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
sceneGalleries, _ := sqb.FindByGalleryID(g.ID) // check if gallery is already associated to the scene
isAssoc := false
for _, sg := range sceneGalleries {
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
}); err != nil {
logger.Error(err.Error())

View File

@ -8,6 +8,7 @@
* Added Rescan button to scene, image, gallery details overflow button.
### 🐛 Bug fixes
* Fix scan re-associating galleries to the same scene.
* Fix SQL error when filtering galleries excluding performers or tags.
* Fix version checking for armv7 and arm64.
* Change "Is NULL" filter to include empty string values.