added sort to populate by category not by random file order
This commit is contained in:
parent
8659aba430
commit
cc778e5615
@ -5,6 +5,7 @@ import (
|
|||||||
"git.haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/piwigo/category"
|
"git.haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/piwigo/category"
|
||||||
"git.haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/piwigo/picture"
|
"git.haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/piwigo/picture"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
"sort"
|
||||||
)
|
)
|
||||||
|
|
||||||
func synchronizeImages(context *appContext, fileSystem map[string]*localFileStructure.FilesystemNode, existingCategories map[string]*category.PiwigoCategory) error {
|
func synchronizeImages(context *appContext, fileSystem map[string]*localFileStructure.FilesystemNode, existingCategories map[string]*category.PiwigoCategory) error {
|
||||||
@ -58,6 +59,12 @@ func findMissingImages(context *appContext, imageFiles []*localFileStructure.Ima
|
|||||||
}
|
}
|
||||||
|
|
||||||
func uploadImages(context *appContext, missingFiles []*localFileStructure.ImageNode, existingCategories map[string]*category.PiwigoCategory) error {
|
func uploadImages(context *appContext, missingFiles []*localFileStructure.ImageNode, existingCategories map[string]*category.PiwigoCategory) error {
|
||||||
|
|
||||||
|
// We sort the files by path to populate per category and not random by file
|
||||||
|
sort.Slice(missingFiles, func(i, j int) bool {
|
||||||
|
return missingFiles[i].Path < missingFiles[j].Path
|
||||||
|
})
|
||||||
|
|
||||||
for _, file := range missingFiles {
|
for _, file := range missingFiles {
|
||||||
logrus.Infof("Uploading %s %s", file.CategoryName, file.Path)
|
logrus.Infof("Uploading %s %s", file.CategoryName, file.Path)
|
||||||
categoryId := existingCategories[file.CategoryName].Id
|
categoryId := existingCategories[file.CategoryName].Id
|
||||||
|
Loading…
Reference in New Issue
Block a user