logs

package
v0.0.0-...-bd21981 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Location = "tenhou/logs/"
)
View Source
const (
	XmlUrlPrefix = "https://tenhou.net/0/log/?"
)

Variables

This section is empty.

Functions

func CMD

func CMD() *cobra.Command

func Collect

func Collect(args []string)
func GetDownloadLink(id *ParsedID) string

func GetFilePath

func GetFilePath(id *ParsedID, fullID string) (string, error)

func NewParsedIndex

func NewParsedIndex() *stats.FileIndex

func ParseIDs

func ParseIDs(data string) []string

ParseIDs parses stat file to find ids of logs

func RemoveIndex

func RemoveIndex(prefix string)

func Status

func Status()

Types

type ConfigRecord

type ConfigRecord struct {
	Search string `json:"search"`
	File   string `json:"file"`
	// contains filtered or unexported fields
}

type FileIndex

type FileIndex struct {
	utils.JSONGZFile
	// contains filtered or unexported fields
}

func LoadIndex

func LoadIndex() (*FileIndex, error)

func NewFileIndex

func NewFileIndex(p string) *FileIndex

func NewIndex

func NewIndex() *FileIndex

func (*FileIndex) AddIDs

func (i *FileIndex) AddIDs(ids []string) int

func (*FileIndex) AddStat

func (i *FileIndex) AddStat(v *pstats.Record) bool

func (*FileIndex) Check

func (i *FileIndex) Check(id string) bool

func (*FileIndex) CountDownloaded

func (i *FileIndex) CountDownloaded() int

func (*FileIndex) CreateZip

func (i *FileIndex) CreateZip(file string) *FileInfos

func (*FileIndex) Get

func (i *FileIndex) Get(id string) *FileInfo

func (*FileIndex) Len

func (i *FileIndex) Len() int

func (*FileIndex) Load

func (i *FileIndex) Load() error

func (*FileIndex) Save

func (i *FileIndex) Save() error

func (*FileIndex) SetError

func (i *FileIndex) SetError(id string) *FileInfo

func (*FileIndex) SetFile

func (i *FileIndex) SetFile(parent *FileInfos, id string, file string) *FileInfo

func (*FileIndex) SetRootFile

func (i *FileIndex) SetRootFile(id string, file string) *FileInfo

func (*FileIndex) Validate

func (i *FileIndex) Validate() ([]string, error)

func (*FileIndex) ValidateNames

func (i *FileIndex) ValidateNames() []*FileInfo

func (*FileIndex) Visit

func (i *FileIndex) Visit(f func(info *FileInfo, opener Opener) error) error

type FileInfo

type FileInfo struct {
	ID        string   `json:"id"`
	File      string   `json:"file,omitempty"`
	Failed    int      `json:"failed,omitempty"`
	LogNames  []string `json:"log-names,omitempty"`
	StatNames []string `json:"stat-names,omitempty"`

	// Special flag for cleanup
	Remove bool `json:"remove,omitempty"`
	// contains filtered or unexported fields
}

func (*FileInfo) Check

func (i *FileInfo) Check() bool

func (*FileInfo) IsInsideZip

func (i *FileInfo) IsInsideZip() bool

type FileInfoMap

type FileInfoMap map[string]*FileInfo

type FileInfos

type FileInfos struct {
	File  string       `json:"file,omitempty"`
	Files []*FileInfo  `json:"files,omitempty"`
	Zips  []*FileInfos `json:"zips,omitempty"`
	// contains filtered or unexported fields
}

func (*FileInfos) Count

func (i *FileInfos) Count() int

func (*FileInfos) Empty

func (f *FileInfos) Empty() bool

func (*FileInfos) Index

func (f *FileInfos) Index() FileInfoMap

func (*FileInfos) IsRoot

func (i *FileInfos) IsRoot() bool

func (*FileInfos) Visit

func (i *FileInfos) Visit(f func(info *FileInfo))

type Opener

type Opener interface {
	Open() (io.ReadCloser, error)
}

type ParsedID

type ParsedID struct {
	// Year,month,day,hour
	Time       string
	Type       string
	Number     string
	OriginalID string
	DownloadID string
}

func ParseID

func ParseID(input string) *ParsedID

type ZipIndex

type ZipIndex map[string]*FileInfos

Jump to

Keyboard shortcuts

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