tlp

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: MIT Imports: 12 Imported by: 0

README

tlp

Build Status codecov Go Report Card godoc

Intro

tlp is the tl.net starcraft2 event parser extracted from Astral

Usage

    //assume that you already had the tl response
    p := NewTimelineParser(resp)
    if err:= p.Parse();err != nil {
        // handle error
    }
    // get json info
    jsonOut,err:= p.FmtJSON()
    if err!=nil {
        // handle error
    }

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxCountDuration = 20 * time.Minute
)

Functions

func EnableDebug

func EnableDebug()

Types

type Event

type Event struct {
	StartAt          time.Time
	IsOnGoing        bool
	VS               Versus
	TimeCountingDown string
	Series           string
	DetailURL        *url.URL
}

func (*Event) GetVersus

func (e *Event) GetVersus() string

type Option

type Option func(*TimelineParser) *TimelineParser

type TLMatchPage

type TLMatchPage struct {
	Parse struct {
		Title  string `json:"title"`
		Pageid int    `json:"pageid"`
		Revid  int    `json:"revid"`
		Text   struct {
			RawHTML string `json:"*"`
		} `json:"text"`
	} `json:"parse"`
}

TLMatchPage is a raw struct defined by https://liquipedia.net/starcraft2/api.php?action=parse&format=json&page=Liquipedia:Upcoming_and_ongoing_matches And removed useless contents

type TimelineParser

type TimelineParser struct {
	Timezone *time.Location
	RevID    string
	Events   []*Event
	// contains filtered or unexported fields
}

func NewTimelineParser

func NewTimelineParser(respBody []byte, opts ...Option) *TimelineParser

func NewTimelineParserFromReader

func NewTimelineParserFromReader(r io.Reader, opts ...Option) (*TimelineParser, error)

func (*TimelineParser) FmtJSON

func (tp *TimelineParser) FmtJSON(opts ...Option) ([]byte, error)

func (*TimelineParser) Parse

func (tp *TimelineParser) Parse() error

func (*TimelineParser) SetTimezone

func (tp *TimelineParser) SetTimezone(name string) error

type Versus

type Versus struct {
	P1      string
	P2      string
	P1Score string
	P2Score string
}

Jump to

Keyboard shortcuts

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