Remove empty output on last download

This commit is contained in:
bytedream 2022-03-28 20:02:51 +02:00
parent e0069a10e0
commit d27fc67288
2 changed files with 12 additions and 7 deletions

View file

@ -218,8 +218,8 @@ func archive(urls []string) error {
} }
out.Empty() out.Empty()
for _, season := range episodes { for j, season := range episodes {
for _, info := range season { for k, info := range season {
var filename string var filename string
var writeCloser io.WriteCloser var writeCloser io.WriteCloser
if c != nil { if c != nil {
@ -253,8 +253,11 @@ func archive(urls []string) error {
} }
return err return err
} }
writeCloser.Close() writeCloser.Close()
if i != len(urls)-1 || j != len(episodes)-1 || k != len(season)-1 {
out.Empty()
}
} }
} }
if c != nil { if c != nil {
@ -420,7 +423,6 @@ func archiveInfo(info formatInformation, writeCloser io.WriteCloser, filename st
signal.Stop(sig) signal.Stop(sig)
out.Debug("Stopped signal catcher") out.Debug("Stopped signal catcher")
out.Empty()
out.Empty() out.Empty()
return nil return nil

View file

@ -147,8 +147,8 @@ func download(urls []string) error {
} }
out.Empty() out.Empty()
for _, season := range episodes { for j, season := range episodes {
for _, info := range season { for k, info := range season {
dir := info.Format(downloadDirectoryFlag) dir := info.Format(downloadDirectoryFlag)
if _, err = os.Stat(dir); os.IsNotExist(err) { if _, err = os.Stat(dir); os.IsNotExist(err) {
if err = os.MkdirAll(dir, 0777); err != nil { if err = os.MkdirAll(dir, 0777); err != nil {
@ -166,6 +166,10 @@ func download(urls []string) error {
return err return err
} }
file.Close() file.Close()
if i != len(urls)-1 || j != len(episodes)-1 || k != len(season)-1 {
out.Empty()
}
} }
} }
} }
@ -253,7 +257,6 @@ func downloadInfo(info formatInformation, file *os.File) error {
signal.Stop(sig) signal.Stop(sig)
out.Debug("Stopped signal catcher") out.Debug("Stopped signal catcher")
out.Empty()
out.Empty() out.Empty()
return nil return nil