Skip to content

Commit

Permalink
Updated to v1.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
tanaikech committed Feb 23, 2020
1 parent b5c2edb commit 06b8221
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,11 @@ If you have any questions and commissions for me, feel free to tell me.
- When this option is NOT used (default situation), when a folder including sub-folders is downloaded, the top folder which is downloaded is created as the top directory under the working directory. When this option is used, the top directory is not created and all files and sub-folders under the top folder are downloaded under the working directory.
- [This feature request](https://github.com/tanaikech/goodls/issues/8) was implemented.

<a name="v126"></a>

- v1.2.6 (February 23, 2020)

1. When the files are downloaded from the shared folder, if an error occurs, the download was stopped. In [this thread](https://github.com/tanaikech/goodls/issues/9), a request for skipping this error was proposed. This request was implemented at v1.2.6. Please try the option of `--skiperror` like below.
- `$ goodls -u https://drive.google.com/drive/folders/###?usp=sharing --skiperror`

[TOP](#top)
6 changes: 6 additions & 0 deletions getfilesfromfolder.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ func (p *para) downloadFileByAPIKey(file *drive.File) error {
return err
}
defer res.Body.Close()
if p.SkipError {
fmt.Printf("!! Downloading '%s' (fileId: %s) was skipped by an error. Status code is %d.\n", file.Name, file.Id, res.StatusCode)
p.WorkDir = bkWorkDir
p.Filename = bkFilename
return nil
}
return fmt.Errorf("%s", r)
}
p.saveFile(res)
Expand Down
9 changes: 8 additions & 1 deletion goodls.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type para struct {
ShowFileInf bool
Size int64
Skip bool
SkipError bool
URL string
WorkDir string
}
Expand Down Expand Up @@ -305,6 +306,7 @@ func handler(c *cli.Context) error {
Resumabledownload: c.String("resumabledownload"),
ShowFileInf: c.Bool("fileinf"),
Skip: c.Bool("skip"),
SkipError: c.Bool("skiperror"),
WorkDir: workdir,
DlFolder: false,
InputtedMimeType: func(mime string) []string {
Expand Down Expand Up @@ -362,7 +364,7 @@ func createHelp() *cli.App {
{Name: "tanaike [ https://github.com/tanaikech/" + appname + " ] ", Email: "[email protected]"},
}
a.UsageText = "Download shared files on Google Drive."
a.Version = "1.2.5"
a.Version = "1.2.6"
a.Flags = []cli.Flag{
&cli.StringFlag{
Name: "url, u",
Expand Down Expand Up @@ -425,6 +427,11 @@ func createHelp() *cli.App {
Aliases: []string{"ntd"},
Usage: "When this option is NOT used (default situation), when a folder including subfolders is downloaded, the top folder which is downloaded is created as the top directory under the working directory. When this option is used, the top directory is not created and all files and subfolders under the top folder are downloaded under the working directory.",
},
&cli.BoolFlag{
Name: "skiperror, se",
Aliases: []string{"se"},
Usage: "When the files are downloaded from the folder, if an error occurs, the error is skipped by this option.",
},
}
return a
}
Expand Down

0 comments on commit 06b8221

Please sign in to comment.