// Get a player object by it's Steam id
330523
func GetPlayerBySteamID(steamid string) (*Player, error) {
	var player = Player{}
	err := db.DB.Where("steam_id = ?", steamid).First(&player).Error
	if err != nil {
		return nil, ErrPlayerNotFound
	}
	return &player, nil
}
926119
func getObjectsByRangeFilter(conn redis.Conn, key string, filter string, start, end int) (objects [][]byte, err error) {
	ids, err := redis.Values(conn.Do("ZRANGE", key, start, end))
	if err != nil && err != redis.ErrNil {
		return nil, err
	}

	// https://github.com/golang/go/wiki/SliceTricks#filtering-without-allocating
	fids := ids[:0]
	if len(ids) > 0 {
		for _, id := range ids {
			err := conn.Send("ZSCORE", filter, id)
			if err != nil {
				return nil, err
			}
		}
		scores, err := redis.Strings(conn.Do(""))
		if err != nil {
			return nil, err
		}

		for i, score := range scores {
			if score != "" {
				fids = append(fids, ids[i])
			}
		}

		objects, err = redis.ByteSlices(conn.Do("MGET", fids...))
		if err != nil {
			return nil, err
		}
	}
	return objects, nil
}
86971
func (c *Context) NewPlayer() *Player {
	p := newPlayer(c)
	c.mux.AddSource(p.r)
	return p
}
361008
func (c *Client) GetTeamRoster(teamKey string, week int) ([]Player, error) {
	content, err := c.GetFantasyContent(
		fmt.Sprintf("%s/team/%s/roster;week=%d",
			YahooBaseURL,
			teamKey,
			week))
	if err != nil {
		return nil, err
	}

	return content.Team.Roster.Players, nil
}
990125
func GetUser(host, token, id string) (*map[string]interface{}, error) {
	path := variables.APIPathUser
	path = strings.Replace(path, ":id", id, 1)
	return GenericRequest(host, path, token, nil)
}
1069247
func (p *PlayerInfo) Parse(elem map[string]interface{}) error {
	p.Steamid = elem["steamid"].(string)
	p.Profileurl = elem["profileurl"].(string)

	// profile visibility
	visibility := elem["communityvisibilitystate"].(json.Number).String()
	var vState string

	switch {
	case visibility == "1":
		vState = "private"
	case visibility == "3":
		vState = "public"
	}

	// same as communityvisibilitystate
	// but as string (public or private)
	p.Visibility = vState

	playerV, vErr := strconv.Atoi(visibility)
	if vErr != nil {
		return vErr
	}

	// int as str
	p.Communityvisibilitystate = playerV

	// Logoff
	playerL, pErr := tryParsingNumber(elem["lastlogoff"])
	p.Lastlogoff = playerL
	if pErr != nil {
		p.Lastlogoff = -1
	}

	// if the account has a steam community profile set then this should be 1
	profileState, stErr := tryParsingNumber(elem["profilestate"])
	if stErr != nil {
		return stErr
	}

	p.Profilestate = profileState

	// variables that are only available when
	// the profile visibility is set to public
	if vState == "public" {
		p.Realname = tryParsingString(elem["realname"])

		// user is online, offline...
		playerState, pstErr := tryParsingNumber(elem["personastate"])
		if pstErr != nil {
			return pstErr
		}

		p.Personastate = PersonaState(playerState)

		// timecreated
		playerTC, tcErr := tryParsingNumber(elem["timecreated"])
		if tcErr != nil {
			return tcErr
		}

		p.Timecreated = playerTC

		// location
		p.Loccountrycode = tryParsingString(elem["loccountrycode"])
		p.Locstatecode = tryParsingString(elem["locstatecode"])

		cityId, cErr := tryParsingNumber(elem["loccityid"])
		if cErr != nil {
			cityId = 0
		}

		p.Loccityid = cityId
	}

	// avatar
	p.Avatar = elem["avatar"].(string)
	p.Avatarfull = elem["avatarfull"].(string)
	p.Avatarmedium = elem["avatarmedium"].(string)

	// name
	p.Personaname = elem["personaname"].(string)
	p.Name = p.Personaname // alias

	return nil
}
473803
func (d *domainClient) GetHeapObjectID(ctx context.Context, args *GetHeapObjectIDArgs) (reply *GetHeapObjectIDReply, err error) {
	reply = new(GetHeapObjectIDReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "HeapProfiler.getHeapObjectId", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "HeapProfiler.getHeapObjectId", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "HeapProfiler", Op: "GetHeapObjectID", Err: err}
	}
	return
}
771971
func (lobby *Lobby) GetPlayerNumber() int {
	count := 0
	err := db.DB.Model(&LobbySlot{}).Where("lobby_id = ?", lobby.ID).Count(&count).Error
	if err != nil {
		return 0
	}
	return count
}
1293773
func (lobby *Lobby) BanPlayer(player *player.Player) {
	rpc.DisallowPlayer(lobby.ID, player.SteamID, player.ID)
	db.DB.Model(lobby).Association("BannedPlayers").Append(player)
}
612627
func (s *userService) GetByID(id int64) (datamodels.User, bool) {
	return s.repo.Select(func(m datamodels.User) bool {
		return m.ID == id
	})
}
170306
func (t *TeamService) GetTeam(teamName string) (*TeamResponse, error) {
	var teamRes TeamResponse
	teamURL := TeamURL + "/" + teamName
	_, err := t.client.get(teamURL, url.Values{}, &teamRes)
	if err != nil {
		return nil, err
	}

	return &teamRes, nil
}
471260
func (org *User) GetTeam(name string) (*Team, error) {
	return org.getTeam(x, name)
}
595925
func (lud *LdapUserData) Get() *querypb.VTGateCallerID {
	if int64(time.Since(lud.lastUpdated).Seconds()) > lud.asl.RefreshSeconds {
		go lud.update()
	}
	return &querypb.VTGateCallerID{Username: lud.username, Groups: lud.groups}
}
1215647
func (c *TodoController) Get() []todo.Item {
	return c.Service.Get(c.Session.ID())
}
442781
func (c *Client) GetGameHighScores(chatID string, messageID, userID int) ([]*GameHighScore, error) {
	req := url.Values{}
	req.Set("chat_id", chatID)
	req.Set("message_id", fmt.Sprint(messageID))
	req.Set("user_id", fmt.Sprint(userID))
	var scores []*GameHighScore
	err := c.doRequest("getGameHighScores", req, &scores)
	return scores, err
}
231078
func (c *Client) PlayerDevices() ([]PlayerDevice, error) {
	var result struct {
		PlayerDevices []PlayerDevice `json:"devices"`
	}

	err := c.get(c.baseURL+"me/player/devices", &result)
	if err != nil {
		return nil, err
	}

	return result.PlayerDevices, nil
}
113957
func (g *Game) GetTagPair(k string) *TagPair {
	for _, tag := range g.tagPairs {
		if tag.Key == k {
			return tag
		}
	}
	return nil
}