utils

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Dictionary = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789"

Dictionary is used for the share code decoding.

Variables

This section is empty.

Functions

func AddMatchToDatabase

func AddMatchToDatabase(matchID uint64)

AddMatchToDatabase adds a match id to the database and marks it as already downloaded

func AddShareCode added in v1.1.0

func AddShareCode(steamID string, shareCode string)

AddShareCode saves a share code associated to a steam id.

func CheckIfMatchExistsAlready

func CheckIfMatchExistsAlready(matchID uint64) bool

CheckIfMatchExistsAlready checks whether the match id is already marked as downloaded (contained) in the database.

func DownloadDemo

func DownloadDemo(url string, filepath string) error

DownloadDemo will download a demo from an url and decompress and store it in local filepath. It writes to the destination file as it downloads it, without loading the entire file into memory.

func GetLatestShareCode added in v1.1.0

func GetLatestShareCode(steamID string) string

GetLatestShareCode returns the latest saved share code for a steam id. steamID should be uint64. However, this method is only called using string steamids coming from the config.

func ScanDemosDir

func ScanDemosDir()

ScanDemosDir scans the demos dir and adds all match ids to the database

Types

type CSGOConfig added in v1.1.0

type CSGOConfig struct {
	HistoryAPIKey  string `json:"matchHistoryAuthenticationCode"`
	KnownMatchCode string `json:"knownMatchCode"`
	SteamID        string `json:"steamId"` // should be uint64
	Disabled       bool
}

CSGOConfig holds the accounts to watch.

type Config

type Config struct {
	DemosDir string        `json:"demosDir"`
	Steam    *SteamConfig  `json:"steam"`
	CSGO     []*CSGOConfig `json:"csgo"`
}

Config holds the application configuration

func GetConfiguration

func GetConfiguration() Config

GetConfiguration returns the Config information

type DemoNotFoundError added in v1.1.0

type DemoNotFoundError struct {
	URL string
}

DemoNotFoundError is used when a valid matchid / demo is not found or can no longer be downloaded.

func (*DemoNotFoundError) Error added in v1.1.0

func (e *DemoNotFoundError) Error() string

type InvalidDownloadURLError added in v1.1.0

type InvalidDownloadURLError struct{}

InvalidDownloadURLError is return when the url to be download is invalid or malicious.

func (*InvalidDownloadURLError) Error added in v1.1.0

func (e *InvalidDownloadURLError) Error() string

type ShareCode

type ShareCode struct {
	MatchID   uint64
	OutcomeID uint64
	Token     uint32
}

ShareCode holds the decoded match code

func Decode

func Decode(code string) *ShareCode

Decode decodes the share code. Taken from ValvePython/csgo

type SteamConfig added in v1.1.0

type SteamConfig struct {
	SteamAPIKey     string `json:"apiKey"`
	Username        string `json:"username"`
	Password        string `json:"password"`
	TwoFactorSecret string `json:"twoFactorSecret"`
}

SteamConfig holds the configuration about the steam account to use for communicating with the GameCoordinator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL