Exemple #1
0
func getTracks(cmd *cobra.Command, args []string) {
	initializeConfig(cmd)

	tp := tracksprocessor.NewConfiguredTracksProcessor()

	var arg string
	if len(args) == 0 {
		arg = "1"
	} else {
		arg = args[0]
	}

	var downloadTracks []track.Track
	if isSoundCloudURL(arg) {
		downloadTracks = getTrackFromURL(arg)
	} else if num, err := strconv.Atoi(arg); err == nil {
		downloadTracks, err = getLastTracks(uint(num))
		if err != nil {
			handleError(err)
		}
	} else {
		ui.Term("you've entered invalid argument. Run 'nehm get --help' for usage.", nil)
	}

	tp.ProcessAll(downloadTracks)
}
Exemple #2
0
func searchAndShowTracks(cmd *cobra.Command, args []string) {
	initializeConfig(cmd)

	tp := tracksprocessor.NewConfiguredTracksProcessor()

	searchQuery = strings.Join(args, " ")

	tm := ui.TracksMenu{
		GetTracks: searchGetTracks,
		Limit:     limit,
	}
	downloadTracks := tm.Show()

	tp.ProcessAll(downloadTracks)
}
Exemple #3
0
func showListOfTracks(cmd *cobra.Command, args []string) {
	initializeConfig(cmd)
	config.Set("UID", client.UID(config.Get("permalink")))

	tp := tracksprocessor.NewConfiguredTracksProcessor()

	tm := ui.TracksMenu{
		GetTracks: listGetTracks,
		Limit:     limit,
		Offset:    offset,
	}
	downloadTracks := tm.Show()

	tp.ProcessAll(downloadTracks)
}