From 06b8221fa61f7ef43dadef76f5dbdd28c8453e32 Mon Sep 17 00:00:00 2001 From: tanaikech Date: Sun, 23 Feb 2020 15:58:33 +0900 Subject: [PATCH] Updated to v1.2.6 --- README.md | 7 +++++++ getfilesfromfolder.go | 6 ++++++ goodls.go | 9 ++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 63bc11d..b446fbf 100644 --- a/README.md +++ b/README.md @@ -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. + + +- 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) diff --git a/getfilesfromfolder.go b/getfilesfromfolder.go index 256dbd1..6b2ff72 100644 --- a/getfilesfromfolder.go +++ b/getfilesfromfolder.go @@ -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) diff --git a/goodls.go b/goodls.go index 1b8ef53..1a0edf2 100644 --- a/goodls.go +++ b/goodls.go @@ -56,6 +56,7 @@ type para struct { ShowFileInf bool Size int64 Skip bool + SkipError bool URL string WorkDir string } @@ -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 { @@ -362,7 +364,7 @@ func createHelp() *cli.App { {Name: "tanaike [ https://github.com/tanaikech/" + appname + " ] ", Email: "tanaike@hotmail.com"}, } 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", @@ -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 }