diff --git a/internal/app/app.go b/internal/app/app.go index 93f72fd..bf9e6f2 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -7,6 +7,7 @@ package app import ( "flag" + "git.haefelfinger.net/piwigo/PiwigoDirectoryUploader/internal/pkg/category" "git.haefelfinger.net/piwigo/PiwigoDirectoryUploader/internal/pkg/images" "git.haefelfinger.net/piwigo/PiwigoDirectoryUploader/internal/pkg/localFileStructure" "github.com/sirupsen/logrus" @@ -39,12 +40,12 @@ func Run() { logErrorAndExit(err, 3) } - categories, err := getAllCategoriesFromServer(context.piwigo) + categories, err := category.GetAllCategoriesFromServer(context.piwigo) if err != nil { logErrorAndExit(err, 4) } - err = synchronizeCategories(context.piwigo, filesystemNodes, categories) + err = category.SynchronizeCategories(context.piwigo, filesystemNodes, categories) if err != nil { logErrorAndExit(err, 5) } diff --git a/internal/app/category.go b/internal/pkg/category/category.go similarity index 95% rename from internal/app/category.go rename to internal/pkg/category/category.go index 3e95dad..e505379 100644 --- a/internal/app/category.go +++ b/internal/pkg/category/category.go @@ -3,7 +3,7 @@ * This application is licensed under GPLv2. See the LICENSE file in the root directory of the project. */ -package app +package category import ( "errors" @@ -15,13 +15,13 @@ import ( "sort" ) -func getAllCategoriesFromServer(piwigoApi piwigo.PiwigoCategoryApi) (map[string]*piwigo.PiwigoCategory, error) { +func GetAllCategoriesFromServer(piwigoApi piwigo.PiwigoCategoryApi) (map[string]*piwigo.PiwigoCategory, error) { logrus.Debugln("Starting GetAllCategories") categories, err := piwigoApi.GetAllCategories() return categories, err } -func synchronizeCategories(piwigoApi piwigo.PiwigoCategoryApi, filesystemNodes map[string]*localFileStructure.FilesystemNode, existingCategories map[string]*piwigo.PiwigoCategory) error { +func SynchronizeCategories(piwigoApi piwigo.PiwigoCategoryApi, filesystemNodes map[string]*localFileStructure.FilesystemNode, existingCategories map[string]*piwigo.PiwigoCategory) error { logrus.Infoln("Synchronizing categories...") missingCategories := findMissingCategories(filesystemNodes, existingCategories)