Exemplo n.º 1
0
Arquivo: get.go Projeto: bogem/vnehm
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)
}
Exemplo n.º 2
0
Arquivo: list.go Projeto: bogem/vnehm
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)
}
Exemplo n.º 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)
}