示例#1
0
文件: get.go 项目: 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)
}
示例#2
0
文件: search.go 项目: 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)
}
示例#3
0
文件: list.go 项目: 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)
}