Skip to content

Commit

Permalink
added --album-list flag to force download album list
Browse files Browse the repository at this point in the history
  • Loading branch information
phudnguyen committed Mar 12, 2018
1 parent 9e6c682 commit a06c1f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
app := &cli.App{
Name: "music-downloader",
Usage: "download music from multiple sources",
Version: "0.0.3",
Version: "0.0.4",
Commands: []*cli.Command{
{
Name: "download",
Expand Down
8 changes: 8 additions & 0 deletions provider/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ var (
Value: 1,
Usage: "Number of parallel provider. No parallel download by default.",
},
&cli.BoolFlag{
Name: "album-list",
Aliases: []string{"al"},
Value: false,
Usage: "Force download allbum list. Use this flag when you provide a link to a list of album.",
},
}
)

Expand All @@ -39,6 +45,7 @@ type DownloadContext struct {
Output string
Indexes []int
ThreadCount int
AlbumList bool
}

func (providerService *ProviderService) HandleDownload(c *cli.Context) error {
Expand Down Expand Up @@ -81,6 +88,7 @@ func (providerService *ProviderService) HandleDownload(c *cli.Context) error {
Output: outputDir,
Indexes: indexInt,
ThreadCount: c.Int("thread-count"),
AlbumList: c.Bool("album-list"),
}

hadProvider := false
Expand Down
2 changes: 1 addition & 1 deletion provider/nct/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (*NCTProvider) IsSiteSupported(site string) bool {
}

func (*NCTProvider) Download(c *provider.DownloadContext) error {
if strings.Index(c.URL.Path, "/nghe-si-") == 0 {
if strings.Index(c.URL.Path, "/nghe-si-") == 0 || c.AlbumList {
return downloadAllAlbumForArtist(c)
} else {
return downloadAlbumOrTrack(c)
Expand Down

0 comments on commit a06c1f8

Please sign in to comment.