mirror of
https://github.com/fumiama/RVC-Models-Downloader.git
synced 2024-11-17 13:47:11 +09:00
fix: inner folder download
This commit is contained in:
parent
793c9f5d5d
commit
c4ce162884
@ -40,6 +40,7 @@ rvcmd tools/ffmpeg
|
||||
Copy: # files to download
|
||||
- v1-5-pruned-emaonly.ckpt
|
||||
- v1-5-pruned-emaonly.safetensors
|
||||
- Folder: sd1.5/vae # the folder you want to download into
|
||||
- vae/diffusion_pytorch_model.bin
|
||||
```
|
||||
2. Run `rvcmd` in the same folder.
|
||||
|
6
go.mod
6
go.mod
@ -5,13 +5,11 @@ go 1.22.1
|
||||
require (
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
golang.org/x/sys v0.19.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/fumiama/terasu v0.0.0-20240418151245-719e0c16831b
|
||||
golang.org/x/sys v0.19.0
|
||||
)
|
||||
require github.com/fumiama/terasu v0.0.0-20240418161858-1c3273a78268
|
||||
|
||||
require (
|
||||
github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 // indirect
|
||||
|
4
go.sum
4
go.sum
@ -5,8 +5,8 @@ github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7/go.mod h1:vD7Ra3Q9o
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fumiama/terasu v0.0.0-20240418151245-719e0c16831b h1:j6DMJg+jd4HPmhQtVwtiHBM1y9XskJgWhskUvWuhFuY=
|
||||
github.com/fumiama/terasu v0.0.0-20240418151245-719e0c16831b/go.mod h1:afchyfKAb7J/zvaENtYzjIEPVbwiEjJaow05zzT4usM=
|
||||
github.com/fumiama/terasu v0.0.0-20240418161858-1c3273a78268 h1:6R8kSGVSIoR3xm2NG8Z4ivkTpAET783RFsJOVKrI7n8=
|
||||
github.com/fumiama/terasu v0.0.0-20240418161858-1c3273a78268/go.mod h1:afchyfKAb7J/zvaENtYzjIEPVbwiEjJaow05zzT4usM=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
|
3
main.go
3
main.go
@ -27,6 +27,7 @@ func main() {
|
||||
dnsf := flag.String("dns", "", "custom dns.yaml")
|
||||
cust := flag.Bool("c", false, "use custom yaml instruction")
|
||||
force := flag.Bool("f", false, "force download even file exists")
|
||||
wait := flag.Uint("w", 4, "connection waiting seconds")
|
||||
flag.Parse()
|
||||
args := flag.Args()
|
||||
if len(args) != 1 {
|
||||
@ -62,7 +63,7 @@ func main() {
|
||||
logrus.Errorln(err)
|
||||
return
|
||||
}
|
||||
err = usercfg.download(args[0], "", *cust, !*ntrs, *force)
|
||||
err = usercfg.download(args[0], "", time.Second*time.Duration(*wait), *cust, !*ntrs, *force)
|
||||
if err != nil {
|
||||
logrus.Errorln(err)
|
||||
return
|
||||
|
17
net.go
17
net.go
@ -16,7 +16,7 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (c *config) download(path, prefix string, usecust, usetrs, force bool) error {
|
||||
func (c *config) download(path, prefix string, waits time.Duration, usecust, usetrs, force bool) error {
|
||||
for i, t := range c.Targets {
|
||||
if t.Refer != "" {
|
||||
refp := path[:strings.LastIndex(path, "/")+1] + t.Refer
|
||||
@ -25,7 +25,7 @@ func (c *config) download(path, prefix string, usecust, usetrs, force bool) erro
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = refcfg.download(refp, prefix+strconv.Itoa(i+1)+".", usecust, usetrs, force)
|
||||
err = refcfg.download(refp, prefix+strconv.Itoa(i+1)+".", waits, usecust, usetrs, force)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -54,20 +54,11 @@ func (c *config) download(path, prefix string, usecust, usetrs, force bool) erro
|
||||
for j, cp := range t.Copy {
|
||||
go func(i int, cp, prefix string) {
|
||||
defer wg.Done()
|
||||
if strings.Contains(cp, "/") { // have innner folder
|
||||
infldr := t.Folder + "/" + cp[:strings.LastIndex(cp, "/")]
|
||||
err := os.MkdirAll(infldr, 0755)
|
||||
if err != nil {
|
||||
logrus.Errorf("#%s%d make target inner folder '%s' err: %v", prefix, i+1, t.Folder, err)
|
||||
return
|
||||
}
|
||||
logrus.Infof("#%s%d make target inner folder '%s'.", prefix, i+1, t.Folder)
|
||||
}
|
||||
sleep := time.Millisecond * 100 * time.Duration(i)
|
||||
sleep := waits * time.Duration(i)
|
||||
if sleep > time.Millisecond {
|
||||
time.Sleep(sleep)
|
||||
}
|
||||
fname := t.Folder + "/" + cp
|
||||
fname := t.Folder + "/" + cp[strings.LastIndex(cp, "/")+1:]
|
||||
if !force {
|
||||
if _, err := os.Stat(fname); err == nil || os.IsExist(err) {
|
||||
logrus.Warnf("#%s%d skip exist file %s", prefix, i+1, fname)
|
||||
|
Loading…
Reference in New Issue
Block a user