Example #1
0
File: get.go Project: bogem/nehm
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)
}
Example #2
0
File: search.go Project: bogem/nehm
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)
}
Example #3
0
File: list.go Project: bogem/nehm
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)
}