removed flag piwigoUploadChunkSizeInKB as it gets loaded from the server during login. Default is 512KB

This commit is contained in:
Philipp Häfelfinger 2019-03-20 23:51:01 +01:00
parent 44369daaa1
commit f71fcefc1a
3 changed files with 4 additions and 9 deletions

View File

@ -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() {

View File

@ -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) {

View File

@ -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
}