removed flag piwigoUploadChunkSizeInKB as it gets loaded from the server during login. Default is 512KB
This commit is contained in:
parent
44369daaa1
commit
f71fcefc1a
@ -9,12 +9,11 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
imagesRootPath = flag.String("imagesRootPath", "", "This is the images root path that should be mirrored to piwigo.")
|
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")
|
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.")
|
piwigoUrl = flag.String("piwigoUrl", "", "The root url without tailing slash to your piwigo installation.")
|
||||||
piwigoUser = flag.String("piwigoUser", "", "The username to use during sync.")
|
piwigoUser = flag.String("piwigoUser", "", "The username to use during sync.")
|
||||||
piwigoPassword = flag.String("piwigoPassword", "", "This is password to the given username.")
|
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() {
|
func Run() {
|
||||||
|
@ -40,7 +40,7 @@ func (c *appContext) UsePiwigo(url string, user string, password string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.piwigo = new(piwigo.PiwigoContext)
|
c.piwigo = new(piwigo.PiwigoContext)
|
||||||
return c.piwigo.Initialize(*piwigoUrl, *piwigoUser, *piwigoPassword, *piwigoUploadChunkSizeInKB)
|
return c.piwigo.Initialize(*piwigoUrl, *piwigoUser, *piwigoPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newAppContext() (*appContext, error) {
|
func newAppContext() (*appContext, error) {
|
||||||
|
@ -39,7 +39,7 @@ type PiwigoContext struct {
|
|||||||
cookies *cookiejar.Jar
|
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 == "" {
|
if baseUrl == "" {
|
||||||
return errors.New("Please provide a valid piwigo server base URL")
|
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.")
|
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.url = fmt.Sprintf("%s/ws.php?format=json", baseUrl)
|
||||||
context.username = username
|
context.username = username
|
||||||
context.password = password
|
context.password = password
|
||||||
context.chunkSizeInKB = chunkSizeInKB
|
context.chunkSizeInKB = 512
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user