From f71fcefc1a2715fab97abbb48adfd2165caed94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Wed, 20 Mar 2019 23:51:01 +0100 Subject: [PATCH] removed flag piwigoUploadChunkSizeInKB as it gets loaded from the server during login. Default is 512KB --- internal/app/app.go | 3 +-- internal/app/appContext.go | 2 +- internal/pkg/piwigo/PiwigoContext.go | 8 ++------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index fe98de2..9279008 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -9,12 +9,11 @@ import ( var ( imagesRootPath = flag.String("imagesRootPath", "", "This is the images root path that should be mirrored to piwigo.") - sqliteDb = flag.String("sqliteDb", "", "The connection string to the sql lite database file.") + sqliteDb = flag.String("sqliteDb", "./localstate.db", "The connection string to the sql lite database file.") noUpload = flag.Bool("noUpload", false, "If set to true, the metadata gets prepared but the upload is not called and the application is exited with code 90") piwigoUrl = flag.String("piwigoUrl", "", "The root url without tailing slash to your piwigo installation.") piwigoUser = flag.String("piwigoUser", "", "The username to use during sync.") piwigoPassword = flag.String("piwigoPassword", "", "This is password to the given username.") - piwigoUploadChunkSizeInKB = flag.Int("piwigoUploadChunkSizeInKB", 512, "The chunksize used to upload an image to piwigo.") ) func Run() { diff --git a/internal/app/appContext.go b/internal/app/appContext.go index c66acd1..0ff28b8 100644 --- a/internal/app/appContext.go +++ b/internal/app/appContext.go @@ -40,7 +40,7 @@ func (c *appContext) UsePiwigo(url string, user string, password string) error { } c.piwigo = new(piwigo.PiwigoContext) - return c.piwigo.Initialize(*piwigoUrl, *piwigoUser, *piwigoPassword, *piwigoUploadChunkSizeInKB) + return c.piwigo.Initialize(*piwigoUrl, *piwigoUser, *piwigoPassword) } func newAppContext() (*appContext, error) { diff --git a/internal/pkg/piwigo/PiwigoContext.go b/internal/pkg/piwigo/PiwigoContext.go index 2b97041..590e6b5 100644 --- a/internal/pkg/piwigo/PiwigoContext.go +++ b/internal/pkg/piwigo/PiwigoContext.go @@ -39,7 +39,7 @@ type PiwigoContext struct { cookies *cookiejar.Jar } -func (context *PiwigoContext) Initialize(baseUrl string, username string, password string, chunkSizeInKB int) error { +func (context *PiwigoContext) Initialize(baseUrl string, username string, password string) error { if baseUrl == "" { return errors.New("Please provide a valid piwigo server base URL") } @@ -52,14 +52,10 @@ func (context *PiwigoContext) Initialize(baseUrl string, username string, passwo return errors.New("Please provide a valid username for the given piwigo server.") } - if chunkSizeInKB < 256 { - return errors.New("The minimum chunksize is 256KB. Please provide a value above. Default is 512KB") - } - context.url = fmt.Sprintf("%s/ws.php?format=json", baseUrl) context.username = username context.password = password - context.chunkSizeInKB = chunkSizeInKB + context.chunkSizeInKB = 512 return nil }