This commit is contained in:
Celogeek 2024-03-03 10:39:10 +01:00
parent a96b94f9d0
commit 04c3f1430c
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc
5 changed files with 13 additions and 15 deletions

View File

@ -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. 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 ## License

View File

@ -60,9 +60,9 @@ func (p *Piwigo) Upload(file *piwigotools.FileToUpload, stat *piwigotools.FileTo
return return
} }
wg := &sync.WaitGroup{} wg := &sync.WaitGroup{}
chunks, err := file.Base64Chunker() chunks, err := file.Base64BuildChunk()
if err != nil { if err != nil {
stat.Error("Base64Chunker", *file.FullPath(), err) stat.Error("Base64BuildChunk", *file.FullPath(), err)
return return
} }

View File

@ -154,14 +154,14 @@ type FileToUploadChunk struct {
Buffer bytes.Buffer Buffer bytes.Buffer
} }
func (f *FileToUpload) Base64Chunker() (chan *FileToUploadChunk, error) { func (f *FileToUpload) Base64BuildChunk() (chan *FileToUploadChunk, error) {
fh, err := os.Open(*f.FullPath()) fh, err := os.Open(*f.FullPath())
if err != nil { if err != nil {
return nil, err return nil, err
} }
out := make(chan *FileToUploadChunk, 8) out := make(chan *FileToUploadChunk, 8)
chunker := func() { go func() {
b := make([]byte, CHUNK_BUFF_SIZE) b := make([]byte, CHUNK_BUFF_SIZE)
defer fh.Close() defer fh.Close()
defer close(out) defer close(out)
@ -185,9 +185,7 @@ func (f *FileToUpload) Base64Chunker() (chan *FileToUploadChunk, error) {
out <- bf out <- bf
} }
} }
} }()
go chunker()
return out, nil return out, nil
} }

View File

@ -63,9 +63,9 @@ func (s *FileToUploadStat) Add() {
s.mu.Unlock() s.mu.Unlock()
} }
func (s *FileToUploadStat) Commit(filereaded int64) { func (s *FileToUploadStat) Commit(fileread int64) {
s.mu.Lock() s.mu.Lock()
s.UploadedBytes += filereaded s.UploadedBytes += fileread
s.Progress.Set64(s.UploadedBytes) s.Progress.Set64(s.UploadedBytes)
s.mu.Unlock() s.mu.Unlock()
} }

View File

@ -89,16 +89,16 @@ func (t *node) AddPath(path string) Tree {
Return a sorted list of children Return a sorted list of children
*/ */
func (t *node) Children() []*node { func (t *node) Children() []*node {
childs := make([]*node, len(t.Nodes)) children := make([]*node, len(t.Nodes))
i := 0 i := 0
for _, n := range t.Nodes { for _, n := range t.Nodes {
childs[i] = n children[i] = n
i++ i++
} }
sort.Slice(childs, func(i, j int) bool { sort.Slice(children, func(i, j int) bool {
return childs[i].Name < childs[j].Name return children[i].Name < children[j].Name
}) })
return childs return children
} }
/* /*