diff --git a/README.md b/README.md index 4941c2f..facb36e 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ It displays in well on iTerm: You can use "SPACE" for selection of a tag, "LEFT" to remove the current selection, type words to lookup. -![visutag](https://user-images.githubusercontent.com/65178/151510534-1c029d2b-f3a4-4fef-a4ae-8d831077a387.jpg) +![visualtag](https://user-images.githubusercontent.com/65178/151510534-1c029d2b-f3a4-4fef-a4ae-8d831077a387.jpg) ## License diff --git a/internal/piwigo/files.go b/internal/piwigo/files.go index 65421cb..f6d43cd 100644 --- a/internal/piwigo/files.go +++ b/internal/piwigo/files.go @@ -60,9 +60,9 @@ func (p *Piwigo) Upload(file *piwigotools.FileToUpload, stat *piwigotools.FileTo return } wg := &sync.WaitGroup{} - chunks, err := file.Base64Chunker() + chunks, err := file.Base64BuildChunk() if err != nil { - stat.Error("Base64Chunker", *file.FullPath(), err) + stat.Error("Base64BuildChunk", *file.FullPath(), err) return } diff --git a/internal/piwigo/piwigotools/file_to_upload.go b/internal/piwigo/piwigotools/file_to_upload.go index c01cd5e..742f1c4 100644 --- a/internal/piwigo/piwigotools/file_to_upload.go +++ b/internal/piwigo/piwigotools/file_to_upload.go @@ -154,14 +154,14 @@ type FileToUploadChunk struct { Buffer bytes.Buffer } -func (f *FileToUpload) Base64Chunker() (chan *FileToUploadChunk, error) { +func (f *FileToUpload) Base64BuildChunk() (chan *FileToUploadChunk, error) { fh, err := os.Open(*f.FullPath()) if err != nil { return nil, err } out := make(chan *FileToUploadChunk, 8) - chunker := func() { + go func() { b := make([]byte, CHUNK_BUFF_SIZE) defer fh.Close() defer close(out) @@ -185,9 +185,7 @@ func (f *FileToUpload) Base64Chunker() (chan *FileToUploadChunk, error) { out <- bf } } - } - - go chunker() + }() return out, nil } diff --git a/internal/piwigo/piwigotools/file_to_upload_stat.go b/internal/piwigo/piwigotools/file_to_upload_stat.go index 8cce226..c033ead 100644 --- a/internal/piwigo/piwigotools/file_to_upload_stat.go +++ b/internal/piwigo/piwigotools/file_to_upload_stat.go @@ -63,9 +63,9 @@ func (s *FileToUploadStat) Add() { s.mu.Unlock() } -func (s *FileToUploadStat) Commit(filereaded int64) { +func (s *FileToUploadStat) Commit(fileread int64) { s.mu.Lock() - s.UploadedBytes += filereaded + s.UploadedBytes += fileread s.Progress.Set64(s.UploadedBytes) s.mu.Unlock() } diff --git a/internal/tree/tree.go b/internal/tree/tree.go index cf0f210..16692ef 100644 --- a/internal/tree/tree.go +++ b/internal/tree/tree.go @@ -89,16 +89,16 @@ func (t *node) AddPath(path string) Tree { Return a sorted list of children */ func (t *node) Children() []*node { - childs := make([]*node, len(t.Nodes)) + children := make([]*node, len(t.Nodes)) i := 0 for _, n := range t.Nodes { - childs[i] = n + children[i] = n i++ } - sort.Slice(childs, func(i, j int) bool { - return childs[i].Name < childs[j].Name + sort.Slice(children, func(i, j int) bool { + return children[i].Name < children[j].Name }) - return childs + return children } /*