// GetArtistsTopTracks gets Spotify catalog information about an artist's top
// tracks in a particular country.  It returns a maximum of 10 tracks.  The
// country is specified as an ISO 3166-1 alpha-2 country code.
180563
func (c *Client) GetArtistsTopTracks(artistID ID, country string) ([]FullTrack, error) {
	spotifyURL := fmt.Sprintf("%sartists/%s/top-tracks?country=%s", c.baseURL, artistID, country)

	var t struct {
		Tracks []FullTrack `json:"tracks"`
	}

	err := c.get(spotifyURL, &t)
	if err != nil {
		return nil, err
	}

	return t.Tracks, nil
}
1084618
func (item *Item) TopLikers() []string {
	switch s := item.Toplikers.(type) {
	case string:
		return []string{s}
	case []string:
		return s
	}
	return nil
}
240945
func (m xlMetaV1) ObjectToPartOffset(ctx context.Context, offset int64) (partIndex int, partOffset int64, err error) {
	if offset == 0 {
		// Special case - if offset is 0, then partIndex and partOffset are always 0.
		return 0, 0, nil
	}
	partOffset = offset
	// Seek until object offset maps to a particular part offset.
	for i, part := range m.Parts {
		partIndex = i
		// Offset is smaller than size we have reached the proper part offset.
		if partOffset < part.Size {
			return partIndex, partOffset, nil
		}
		// Continue to towards the next part.
		partOffset -= part.Size
	}
	logger.LogIf(ctx, InvalidRange{})
	// Offset beyond the size of the object return InvalidRange.
	return 0, 0, InvalidRange{}
}
254133
func GetTitleAndArtist(link string, index int) glod.Response {
	var song glod.Response

	doc, err := goquery.NewDocument(link)
	if err != nil {
		return song
	}

	if strings.Contains(link, album) {
		doc.Find(".pl-video").EachWithBreak(func(i int, s *goquery.Selection) bool {
			if i == index {
				dataTitle, _ := s.Attr("data-title")
				song.Artist = dataTitle

				if strings.Contains(dataTitle, "-") {
					temp := strings.Split(dataTitle, "-")
					song.Title = temp[1]
					song.Artist = temp[0]
				}
				return false
			}
			return true
		})
	} else {
		doc.Find("#eow-title").Each(func(i int, s *goquery.Selection) {
			dataTitle, _ := s.Attr("title")
			song.Artist = dataTitle

			if strings.Contains(dataTitle, "-") {
				temp := strings.Split(dataTitle, "-")
				song.Title = temp[1]
				song.Artist = temp[0]
			}
		})
	}
	return song
}
288184
func GetOrNewStacktrace(err error, skip int, context int, appPackagePrefixes []string) *Stacktrace {
	type stackTracer interface {
		StackTrace() []runtime.Frame
	}
	stacktrace, ok := err.(stackTracer)
	if !ok {
		return NewStacktrace(skip+1, context, appPackagePrefixes)
	}
	var frames []*StacktraceFrame
	for f := range stacktrace.StackTrace() {
		pc := uintptr(f) - 1
		fn := runtime.FuncForPC(pc)
		var fName string
		var file string
		var line int
		if fn != nil {
			file, line = fn.FileLine(pc)
			fName = fn.Name()
		} else {
			file = "unknown"
			fName = "unknown"
		}
		frame := NewStacktraceFrame(pc, fName, file, line, context, appPackagePrefixes)
		if frame != nil {
			frames = append([]*StacktraceFrame{frame}, frames...)
		}
	}
	return &Stacktrace{Frames: frames}
}
395085
def get_top_artists(self, limit=None, cacheable=True):
        """"""

        params = {}
        if limit:
            params["limit"] = limit

        doc = _Request(self, "chart.getTopArtists", params).execute(cacheable)

        return _extract_top_artists(doc, self)
508259
func (c *Client) NextTrackResults(s *SearchResult) error {
	if s.Tracks == nil || s.Tracks.Next == "" {
		return ErrNoMorePages
	}
	return c.get(s.Tracks.Next, s)
}
181169
func (lfm *LastFM) GetUserTopArtists(user string, period Period, limit int) (top *TopArtists, err error) {
	method := "user.getTopArtists"
	query := map[string]string{
		"user":   user,
		"period": periodStringMap[period],
		"limit":  strconv.Itoa(limit)}

	if data, err := lfm.cacheGet(method, query); data != nil {
		switch v := data.(type) {
		case TopArtists:
			return &v, err
		case *TopArtists:
			return v, err
		}
	} else if err != nil {
		return nil, err
	}

	body, hdr, err := lfm.doQuery(method, query)
	if err != nil {
		return
	}
	defer body.Close()

	status := lfmStatus{}
	err = xml.NewDecoder(body).Decode(&status)
	if err != nil {
		return
	}
	if status.Error.Code != 0 {
		err = &status.Error
		go lfm.cacheSet(method, query, err, hdr)
		return
	}

	top = &status.TopArtists
	err = top.unmarshalHelper()
	if err == nil {
		go lfm.cacheSet(method, query, top, hdr)
	}
	return
}
880278
func (tt *TracksToplist) Track(n int) *Track {
	if n < 0 || n >= tt.Tracks() {
		panic("spotify: toplist track out of range")
	}
	sp_track := C.sp_toplistbrowse_track(tt.sp_toplistbrowse, C.int(n))
	return newTrack(tt.session, sp_track)
}
285672
func (api artistApi) GetInfo(args map[string]interface{}) (result ArtistGetInfo, err error) {
	defer func() { appendCaller(err, "lastfm.Artist.GetInfo") }()
	if _, ok := args["username"]; !ok && api.params.sk != "" {
		err = callPost("artist.getinfo", api.params, args, &result, P{
			"plain": []string{"artist", "mbid", "lang", "autocorrect"},
		})
	} else {
		err = callGet("artist.getinfo", api.params, args, &result, P{
			"plain": []string{"artist", "mbid", "lang", "autocorrect", "username"},
		})
	}
	return
}
675265
func getStringMultipleStrict(labels map[string]string, labelNames ...string) (map[string]string, error) {
	foundLabels := map[string]string{}
	for _, name := range labelNames {
		value := getStringValue(labels, name, "")
		// Error out only if one of them is not defined.
		if len(value) == 0 {
			return nil, fmt.Errorf("label not found: %s", name)
		}
		foundLabels[name] = value
	}
	return foundLabels, nil
}
537298
func (c Core) ListMultipartUploads(bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (result ListMultipartUploadsResult, err error) {
	return c.listMultipartUploadsQuery(bucket, keyMarker, uploadIDMarker, prefix, delimiter, maxUploads)
}
481102
func (api userApi) GetTopAlbums(args map[string]interface{}) (result UserGetTopAlbums, err error) {
	defer func() { appendCaller(err, "lastfm.User.GetTopAlbums") }()
	err = callGet("user.gettopalbums", api.params, args, &result, P{
		"plain": []string{"user", "period", "limit", "page"},
	})
	return
}
192713
def getTracksForArtistInCollection(artist,user=nil,extras=nil)
      method = 'getTracksForArtistInCollection'
      type = Track
      args = {:artist=>artist}
      args[:user] = user if user
      args[:extras] = extras if extras
      return_object type,method,args
    end
346857
func (c Client) getTotalMultipartSize(bucketName, objectName, uploadID string) (size int64, err error) {
	// Iterate over all parts and aggregate the size.
	partsInfo, err := c.listObjectParts(bucketName, objectName, uploadID)
	if err != nil {
		return 0, err
	}
	for _, partInfo := range partsInfo {
		size += partInfo.Size
	}
	return size, nil
}
702723
func (c *Client) GetCategoryPlaylistsOpt(catID string, opt *Options) (*SimplePlaylistPage, error) {
	spotifyURL := fmt.Sprintf("%sbrowse/categories/%s/playlists", c.baseURL, catID)
	if opt != nil {
		values := url.Values{}
		if opt.Country != nil {
			values.Set("country", *opt.Country)
		}
		if opt.Limit != nil {
			values.Set("limit", strconv.Itoa(*opt.Limit))
		}
		if opt.Offset != nil {
			values.Set("offset", strconv.Itoa(*opt.Offset))
		}
		if query := values.Encode(); query != "" {
			spotifyURL += "?" + query
		}
	}

	wrapper := struct {
		Playlists SimplePlaylistPage `json:"playlists"`
	}{}

	err := c.get(spotifyURL, &wrapper)
	if err != nil {
		return nil, err
	}

	return &wrapper.Playlists, nil
}
1163975
func (s *DeleteByQueryService) TrackScores(trackScores bool) *DeleteByQueryService {
	s.trackScores = &trackScores
	return s
}