mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 02:02:37 +02:00
add checked
This commit is contained in:
parent
423d99aaf6
commit
0981f35615
@ -25,6 +25,10 @@ func (f *FileToUpload) FullPath() string {
|
||||
return filepath.Join(f.Dir, f.Name)
|
||||
}
|
||||
|
||||
func (f *FileToUpload) Checked() bool {
|
||||
return f.md5 != nil
|
||||
}
|
||||
|
||||
func (f *FileToUpload) MD5() string {
|
||||
if f.md5 == nil {
|
||||
md5, err := Md5File(f.FullPath())
|
||||
|
@ -25,13 +25,14 @@ func (p *Piwigo) FileExists(md5 string) bool {
|
||||
}
|
||||
|
||||
func (p *Piwigo) Upload(file *FileToUpload, stat *FileToUploadStat, nbJobs int, hasVideoJS bool) error {
|
||||
if file.MD5() == "" {
|
||||
stat.Fail()
|
||||
return errors.New("checksum error")
|
||||
if !file.Checked() {
|
||||
if file.MD5() == "" {
|
||||
stat.Fail()
|
||||
return errors.New("checksum error")
|
||||
}
|
||||
stat.Check()
|
||||
}
|
||||
|
||||
stat.Check()
|
||||
|
||||
if p.FileExists(file.MD5()) {
|
||||
stat.Skip()
|
||||
return errors.New("file already exists")
|
||||
|
Loading…
x
Reference in New Issue
Block a user