diff --git a/cmd/DirectoriesToAlbums/main.go b/cmd/DirectoriesToAlbums/main.go new file mode 100644 index 0000000..7d9d022 --- /dev/null +++ b/cmd/DirectoriesToAlbums/main.go @@ -0,0 +1,31 @@ +package main + +import ( + "flag" + "github.com/sirupsen/logrus" + "haefelfinger.net/piwigo/DirectoriesToAlbums/internal/app/DirectoriesToAlbums" + "os" +) + +func main() { + flag.Parse() + root := flag.Arg(0) + + InitializeLog() + + app.AuthenticateToPiwigo() + app.ScanLocalDirectories(root) + app.GetAllCategoriesFromServer() + app.FindMissingAlbums() + app.CreateMissingAlbums() + app.FindMissingImages() + app.UploadImages() + +} + +func InitializeLog() { + //TODO: make log configurable to file instead of console + logrus.SetLevel(logrus.DebugLevel) + logrus.SetOutput(os.Stdout) + logrus.Infoln("Starting Piwigo directories to albums...") +} \ No newline at end of file diff --git a/internal/app/DirectoriesToAlbums/app.go b/internal/app/DirectoriesToAlbums/app.go new file mode 100644 index 0000000..3cb4396 --- /dev/null +++ b/internal/app/DirectoriesToAlbums/app.go @@ -0,0 +1,37 @@ +package app + +import ( + "github.com/sirupsen/logrus" + "haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/localFileStructure" +) + +func AuthenticateToPiwigo() { + logrus.Warnln("Authenticating to piwigo server (NotImplemented)") +} + +func ScanLocalDirectories(root string) { + fileNodes := localFileStructure.ScanLocalFileStructure(root) + logrus.Debugln("filepath.Walk() returned %v\n", fileNodes) +} + +func GetAllCategoriesFromServer() { + // get all categories from server and flatten structure to match directory names + // 2018/2018 album blah + logrus.Warnln("Loading all categories from the server (NotImplemented)") +} + +func FindMissingAlbums() { + logrus.Warnln("Looking up missing albums (NotImplemented)") +} + +func CreateMissingAlbums() { + logrus.Warnln("Creating missing albums (NotImplemented)") +} + +func FindMissingImages() { + logrus.Warnln("Finding missing images (NotImplemented)") +} + +func UploadImages() { + logrus.Warnln("Uploading missing images (NotImplemented)") +} \ No newline at end of file diff --git a/pkg/localFileStructure/nodeBuilder.go b/internal/pkg/localFileStructure/nodeBuilder.go similarity index 100% rename from pkg/localFileStructure/nodeBuilder.go rename to internal/pkg/localFileStructure/nodeBuilder.go diff --git a/pkg/localFileStructure/types.go b/internal/pkg/localFileStructure/types.go similarity index 100% rename from pkg/localFileStructure/types.go rename to internal/pkg/localFileStructure/types.go diff --git a/internal/pkg/piwigo/authentication/types.go b/internal/pkg/piwigo/authentication/types.go new file mode 100644 index 0000000..7626b8b --- /dev/null +++ b/internal/pkg/piwigo/authentication/types.go @@ -0,0 +1,8 @@ +package authentication + +type PiwigoConfig struct { + url string + username string + password string +} + diff --git a/internal/pkg/piwigo/category/types.go b/internal/pkg/piwigo/category/types.go new file mode 100644 index 0000000..5a84ebe --- /dev/null +++ b/internal/pkg/piwigo/category/types.go @@ -0,0 +1,7 @@ +package category + +type PiwigoCategory struct { + id int + name string + key string +} \ No newline at end of file diff --git a/main.go b/main.go deleted file mode 100644 index 78dec8c..0000000 --- a/main.go +++ /dev/null @@ -1,60 +0,0 @@ -package main - -import ( - "flag" - "haefelfinger.net/piwigo/DirectoriesToAlbums/pkg/localFileStructure" - "log" - "os" -) - -func main() { - flag.Parse() - root := flag.Arg(0) - - InitializeLog() - - AuthenticateToPiwigo() - ScanLocalDirectories(root) - GetAllCategoriesFromServer() - FindMissingAlbums() - CreateMissingAlbums() - FindMissingImages() - UploadImages() -} - -func InitializeLog() { - //TODO: make log configurable to file instead of console - log.SetOutput(os.Stdout) - log.Println("Starting Piwigo directories to albums...") -} - -func AuthenticateToPiwigo() { - log.Println("Authenticating to piwigo server (NotImplemented)") -} - -func ScanLocalDirectories(root string) { - fileNodes := localFileStructure.ScanLocalFileStructure(root) - log.Printf("filepath.Walk() returned %v\n", fileNodes) -} - -func GetAllCategoriesFromServer() { - // get all categories from server and flatten structure to match directory names - // 2018/2018 album blah - log.Println("Loading all categories from the server (NotImplemented)") -} - -func FindMissingAlbums() { - log.Println("Looking up missing albums (NotImplemented)") -} - -func CreateMissingAlbums() { - log.Println("Creating missing albums (NotImplemented)") -} - -func FindMissingImages() { - log.Println("Finding missing images (NotImplemented)") -} - -func UploadImages() { - log.Println("Uploading missing images (NotImplemented)") -} \ No newline at end of file diff --git a/pkg/piwigo/types.go b/pkg/piwigo/types.go deleted file mode 100644 index 9f114f7..0000000 --- a/pkg/piwigo/types.go +++ /dev/null @@ -1,13 +0,0 @@ -package piwigo - -type PiwigoConfig struct { - url string - username string - password string -} - -type PiwigoCategory struct { - id int - name string - key string -} \ No newline at end of file