started coding of image handling

This commit is contained in:
Philipp Häfelfinger 2019-02-27 00:09:41 +01:00
parent 5ea9fa2911
commit 643729af1f
4 changed files with 68 additions and 5 deletions

View File

@ -7,16 +7,35 @@ import (
"haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/piwigo/category" "haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/piwigo/category"
) )
func synchronizeImages(fileSystem map[string]*localFileStructure.FilesystemNode, existingCategories map[string]*category.PiwigoCategory) error { func synchronizeImages(context *AppContext, fileSystem map[string]*localFileStructure.FilesystemNode, existingCategories map[string]*category.PiwigoCategory) error {
findMissingImages()
uploadImages() imageFiles := getImageList(fileSystem)
missingFiles := findMissingImages(imageFiles)
uploadImages(missingFiles)
return errors.New("synchronizeImages: NOT IMPLEMENTED") return errors.New("synchronizeImages: NOT IMPLEMENTED")
} }
func findMissingImages() { func findMissingImages(imageFiles []string) []string {
logrus.Warnln("Finding missing images (NotImplemented)") logrus.Warnln("Finding missing images (NotImplemented)")
return nil
} }
func uploadImages() { func uploadImages(missingFiles []string) {
logrus.Warnln("Uploading missing images (NotImplemented)") logrus.Warnln("Uploading missing images (NotImplemented)")
} }
func getImageList(fileSystem map[string]*localFileStructure.FilesystemNode) []string {
imageFiles := []string{}
for _, file := range fileSystem {
if !file.IsDir {
imageFiles = append(imageFiles, file.Key)
}
}
return imageFiles
}

View File

@ -0,0 +1,22 @@
package picture
import (
"github.com/sirupsen/logrus"
"haefelfinger.net/piwigo/DirectoriesToAlbums/internal/pkg/piwigo"
)
func ImageUploadRequired(context *piwigo.PiwigoContext, files []string) (bool, error) {
for file := range files {
logrus.Debug(file)
}
/*
http://pictures.haefelfinger.net/ws.php?format=json
{
"md5sum_list": "d327416a83452b91764ed2888a5630a3,6d5f122e2b98bc1a192850e89fc2ae8c,40bfe8dd8349ccdedd4a939f9191cafa"
}
*/
return false, nil
}

View File

@ -0,0 +1,11 @@
package picture
type uploadChunkResponse struct {
Status string `json:"stat"`
Result interface{} `json:"result"`
}
type imageExistResponse struct {
Stat string `json:"stat"`
Result map[string]string `json:"result"`
}

View File

@ -0,0 +1,11 @@
package picture
/*
http://pictures.haefelfinger.net/ws.php?format=json
{
"data": "123456",
"original_sum": "1234567",
"position": "1"
}
*/