changed usage to piwigo interface instead of context

This commit is contained in:
Philipp Häfelfinger 2019-03-20 23:28:28 +01:00
parent b326b0da84
commit 4d50d5bb15
3 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ var (
) )
func Run() { func Run() {
context, err := createAppContext() context, err := newAppContext()
if err != nil { if err != nil {
logErrorAndExit(err, 1) logErrorAndExit(err, 1)
} }
@ -33,7 +33,7 @@ func Run() {
logErrorAndExit(err, 3) logErrorAndExit(err, 3)
} }
categories, err := getAllCategoriesFromServer(context) categories, err := getAllCategoriesFromServer(context.piwigo)
if err != nil { if err != nil {
logErrorAndExit(err, 4) logErrorAndExit(err, 4)
} }

View File

@ -43,7 +43,7 @@ func (c *appContext) UsePiwigo(url string, user string, password string) error {
return c.piwigo.Initialize(*piwigoUrl, *piwigoUser, *piwigoPassword, *piwigoUploadChunkSizeInKB) return c.piwigo.Initialize(*piwigoUrl, *piwigoUser, *piwigoPassword, *piwigoUploadChunkSizeInKB)
} }
func createAppContext() (*appContext, error) { func newAppContext() (*appContext, error) {
logrus.Infoln("Preparing application context and configuration") logrus.Infoln("Preparing application context and configuration")
context := new(appContext) context := new(appContext)

View File

@ -10,9 +10,9 @@ import (
"sort" "sort"
) )
func getAllCategoriesFromServer(context *appContext) (map[string]*piwigo.PiwigoCategory, error) { func getAllCategoriesFromServer(piwigoApi piwigo.PiwigoCategoryApi) (map[string]*piwigo.PiwigoCategory, error) {
logrus.Debugln("Starting GetAllCategories") logrus.Debugln("Starting GetAllCategories")
categories, err := context.piwigo.GetAllCategories() categories, err := piwigoApi.GetAllCategories()
return categories, err return categories, err
} }