Skip to content

Commit

Permalink
#83: Fixed error when url parameter is omitted
Browse files Browse the repository at this point in the history
  • Loading branch information
Girbons committed Apr 28, 2021
1 parent b4ba264 commit 967327a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[Changes][v0.28.1]
<a name="v0.28.1"></a>
# [0.28.1 (v0.28.1)](https://github.com/Girbons/comics-downloader/releases/tag/v0.28.1) - 27 Apr 2021
# Fixes

* Fixed error where the url parameter was not used.

[Changes][v0.28.0]
<a name="v0.28.0"></a>
# [0.28.0 (v0.28.0)](https://github.com/Girbons/comics-downloader/releases/tag/v0.28.0) - 20 Apr 2021
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@

Download the latest release:

- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.28.0/comics-downloader)
- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.28.0/comics-downloader-osx)
- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.28.0/comics-downloader.exe)
- [Linux ARM](https://github.com/Girbons/comics-downloader/releases/download/v0.28.0/comics-downloader-linux-arm)
- [Linux ARM64](https://github.com/Girbons/comics-downloader/releases/download/v0.28.0/comics-downloader-linux-arm64)
- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.28.1/comics-downloader)
- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.28.1/comics-downloader-osx)
- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.28.1/comics-downloader.exe)
- [Linux ARM](https://github.com/Girbons/comics-downloader/releases/download/v0.28.1/comics-downloader-linux-arm)
- [Linux ARM64](https://github.com/Girbons/comics-downloader/releases/download/v0.28.1/comics-downloader-linux-arm64)

Download the latest GUI release:

- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.28.0/comics-downloader-gui)
- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.28.0/comics-downloader-gui-osx)
- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.28.0/comics-downloader-gui-windows.exe)
- [Linux](https://github.com/Girbons/comics-downloader/releases/download/v0.28.1/comics-downloader-gui)
- [Mac OSX](https://github.com/Girbons/comics-downloader/releases/download/v0.28.1/comics-downloader-gui-osx)
- [Windows](https://github.com/Girbons/comics-downloader/releases/download/v0.28.1/comics-downloader-gui-windows.exe)

Put the script under a folder.

Expand Down
20 changes: 10 additions & 10 deletions cmd/app/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ var (
Messages = make(chan string)
)

func download(options *config.Options, bindLogToChannel bool) {
options.Logger = logger.NewLogger(bindLogToChannel, Messages)

func download(options *config.Options) {
if options.Debug {
options.Logger.SetLevel(logrus.DebugLevel)
}
Expand All @@ -45,13 +43,11 @@ func download(options *config.Options, bindLogToChannel bool) {

isNewVersionAvailable, newVersionLink, err := version.IsNewAvailable()
if err != nil {
msg := "There was an error while checking for a new comics-downloader version"
options.Logger.Error(msg)
options.Logger.Error("There was an error while checking for a new comics-downloader version")
}

if isNewVersionAvailable {
msg := fmt.Sprintf("A new comics-downloader version is available at %s", newVersionLink)
options.Logger.Info(msg)
options.Logger.Info(fmt.Sprintf("A new comics-downloader version is available at %s", newVersionLink))
}

urls := options.Url
Expand Down Expand Up @@ -101,24 +97,28 @@ func download(options *config.Options, bindLogToChannel bool) {
// GuiRun will start the GUI app
func GuiRun(options *config.Options) {
AppStatus <- true
download(options, true)
options.Logger = logger.NewLogger(true, Messages)
download(options)
AppStatus <- false
}

// Run will start the CLI app
func Run(options *config.Options) {
options.Logger = logger.NewLogger(false, Messages)

// link is required
if options.Url == "" {
options.Logger.Error("url parameter is required")
return
}

// daemon is started only if `all` or `last` flags are used
if options.Daemon && (options.All || options.Last) {
for {
download(options, false)
download(options)
time.Sleep(time.Duration(options.Timeout) * time.Second)
}
}

download(options, false)
download(options)
}
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// Tag specifies the current release tag.
// It needs to be manually updated.
const Tag = "v0.28.0"
const Tag = "v0.28.1"

// IsNewAvailable() will fetch the latest project releases
// and will compare the latest release Tag against the current Tag.
Expand Down

0 comments on commit 967327a

Please sign in to comment.