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
	var err error
	if isVKWallURL(arg) {
		downloadTracks, err = getTracksFromVKWall(arg)
	} else if num, err := strconv.Atoi(arg); err == nil {
		downloadTracks, err = getLastTracks(uint(num))
	} else {
		ui.Term("you've entered invalid argument. Run 'vnehm get --help' for usage.", nil)
	}

	if err != nil {
		handleError(err)
	}

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

	tp := tracksprocessor.NewConfiguredTracksProcessor()

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

	tp.ProcessAll(downloadTracks)
}
Exemple #3
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)
}