gocricket

package module
v0.0.0-...-01a06b2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2017 License: AGPL-3.0 Imports: 6 Imported by: 4

README

GoDoc Go Report Card

#Usage

###Import

  import "github.com/akashshinde/go_cricket"

Start cricket watcher

event := make(chan gocricket.ResponseEvent)
cricket := gocricket.NewCricketWatcher("IND",event)

This will start goroutine to check cricket score for India.

###ResponseEvent

type ResponseEvent struct {
    EventType int
    Response
}

you will receive cricket response with EventType

###EventType

	EVENT_NO_CHANGE           = 0
	EVENT_OUT                 = 1
	EVENT_MATCH_STATUS_CHANGE = 2
	EVENT_OVER_CHANGED        = 3
	EVENT_RUN_CHANGE          = 4

Documentation

Index

Constants

View Source
const (
	EVENT_NO_CHANGE           = 0
	EVENT_OUT                 = 1
	EVENT_MATCH_STATUS_CHANGE = 2
	EVENT_OVER_CHANGED        = 3
	EVENT_RUN_CHANGE          = 4
	CRICBUZZ_URL              = "http://synd.cricbuzz.com/j2me/1.0/livematches.xml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BattingTeam

type BattingTeam struct {
	Name  string   `xml:"sName,attr"`
	ID    string   `xml:"id,attr"`
	Inngs []Inning `xml:"Inngs"`
}

type Cricket

type Cricket struct {
	// contains filtered or unexported fields
}

func NewCricketWatcher

func NewCricketWatcher(teamName string, event chan ResponseEvent) (c *Cricket)

func (*Cricket) Start

func (c *Cricket) Start()

func (*Cricket) TeamMatchStat

func (c *Cricket) TeamMatchStat(m MatchData) (s MatchStat)

type Inning

type Inning struct {
	Description string `xml:"desc,attr"`
	Run         string `xml:"r,attr"`
	Overs       string `xml:"ovrs,attr"`
	Wickets     string `xml:"wkts,attr"`
}

type InningDetails

type InningDetails struct {
	Overs string `xml:"noofovers"`
}

type MatchData

type MatchData struct {
	MatchStats []MatchStat `xml:"match"`
}

func (*MatchData) Print

func (m *MatchData) Print()

type MatchStat

type MatchStat struct {
	XMLName     xml.Name     `xml:"match"`
	Type        string       `xml:"type,attr"`
	States      State        `xml:"state"`
	Teams       []Team       `xml:"Tm"`
	BattingTeam *BattingTeam `xml:"mscr>btTm"`
}

func (*MatchStat) TriggerEvent

func (m *MatchStat) TriggerEvent(lastFetchedStat MatchStat, event chan ResponseEvent)

type Response

type Response struct {
	BtTeamName  string
	Overs       string
	MatchStatus string
	Runs        string
	Wickets     string
}

type ResponseEvent

type ResponseEvent struct {
	Response
	EventType int
}

type State

type State struct {
	MatchState string `xml:"mchState,attr"`
	Status     string `xml:"status,attr"`
}

type Team

type Team struct {
	Name string `xml:"Name,attr"`
}

Jump to

Keyboard shortcuts

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