Documentation ¶
Index ¶
- Constants
- func Check(err error)
- func FileExists(path string) (bool, error)
- func MakeDirForFile(filename string) error
- func MustDownload(ctx context.Context, u string, opts ...Option) string
- func NewDownloader(opts ...Option) *downloader
- func YaDiskDownload(u string, location string, interactive bool, ...) error
- func YaDiskResourcesLink(u string) string
- type FileWriter
- type InteractiveTracker
- type InteractiveWriter
- type JSONGZFile
- type Option
- type ProgressWriter
- func (w *ProgressWriter) Advance(x int)
- func (w *ProgressWriter) Disable() *ProgressWriter
- func (w *ProgressWriter) Display()
- func (w *ProgressWriter) Done()
- func (w *ProgressWriter) Inc()
- func (w *ProgressWriter) Progress() int
- func (w *ProgressWriter) SetDelay(d time.Duration) *ProgressWriter
- func (w *ProgressWriter) SetETA() *ProgressWriter
- func (w *ProgressWriter) Skip()
- func (w *ProgressWriter) Start()
- type Routines
- type Scheduler
- type Task
- type Tracker
- type YADiskAnswer
- type YADiskItem
Constants ¶
View Source
const (
UserAgent = "TenToolBot (+https://github.com/dnovikoff/tenhou/tools/tentool)"
)
Variables ¶
This section is empty.
Functions ¶
func FileExists ¶
func MakeDirForFile ¶
func NewDownloader ¶
func NewDownloader(opts ...Option) *downloader
func YaDiskDownload ¶
func YaDiskResourcesLink ¶
Types ¶
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
func CreateFile ¶
func CreateFile(name string) (*FileWriter, error)
func (*FileWriter) Close ¶
func (w *FileWriter) Close() error
func (*FileWriter) Commit ¶
func (w *FileWriter) Commit() error
func (*FileWriter) CommitOnSuccess ¶
func (w *FileWriter) CommitOnSuccess(err *error)
type InteractiveTracker ¶
type InteractiveTracker struct {
// contains filtered or unexported fields
}
func NewInteractiveTracker ¶
func NewInteractiveTracker(u, p string, i bool) *InteractiveTracker
func (*InteractiveTracker) Done ¶
func (t *InteractiveTracker) Done(total int64, err error)
func (*InteractiveTracker) SetPath ¶
func (t *InteractiveTracker) SetPath(p string)
func (*InteractiveTracker) Start ¶
func (t *InteractiveTracker) Start(total int64)
func (*InteractiveTracker) Write ¶
func (t *InteractiveTracker) Write(bytes int)
type InteractiveWriter ¶
type InteractiveWriter struct {
// contains filtered or unexported fields
}
func NewInteractiveWriter ¶
func NewInteractiveWriter(w io.Writer) *InteractiveWriter
func (*InteractiveWriter) Printf ¶
func (w *InteractiveWriter) Printf(format string, args ...interface{}) (int, error)
func (*InteractiveWriter) Println ¶
func (w *InteractiveWriter) Println(args ...interface{}) (int, error)
type JSONGZFile ¶
func (*JSONGZFile) Load ¶
func (f *JSONGZFile) Load(out interface{}) error
func (*JSONGZFile) Save ¶
func (f *JSONGZFile) Save(data interface{}) (err error)
type Option ¶
type Option func(*downloader)
func AddTracker ¶
func Compressor ¶
func Compressor(f func(io.Writer) io.WriteCloser) Option
type ProgressWriter ¶
type ProgressWriter struct {
// contains filtered or unexported fields
}
func NewProgressWriter ¶
func NewProgressWriter(w io.Writer, prefix string, total int) *ProgressWriter
func (*ProgressWriter) Advance ¶
func (w *ProgressWriter) Advance(x int)
func (*ProgressWriter) Disable ¶
func (w *ProgressWriter) Disable() *ProgressWriter
func (*ProgressWriter) Display ¶
func (w *ProgressWriter) Display()
func (*ProgressWriter) Done ¶
func (w *ProgressWriter) Done()
func (*ProgressWriter) Inc ¶
func (w *ProgressWriter) Inc()
func (*ProgressWriter) Progress ¶
func (w *ProgressWriter) Progress() int
func (*ProgressWriter) SetDelay ¶
func (w *ProgressWriter) SetDelay(d time.Duration) *ProgressWriter
func (*ProgressWriter) SetETA ¶
func (w *ProgressWriter) SetETA() *ProgressWriter
func (*ProgressWriter) Skip ¶
func (w *ProgressWriter) Skip()
func (*ProgressWriter) Start ¶
func (w *ProgressWriter) Start()
type YADiskAnswer ¶
type YADiskAnswer struct { PublicURL string `json:"public_url"` Embedded struct { Items []YADiskItem `json:"items"` } `json:"_embedded"` }
type YADiskItem ¶
type YADiskItem struct { Type string `json:"type"` File string `json:"file"` Path string `json:"path"` PublicURL string `json:"public_url"` }
func YaDiskParseItems ¶
func YaDiskParseItems(data string) ([]YADiskItem, error)
func (*YADiskItem) SetPublicURL ¶
func (i *YADiskItem) SetPublicURL(parent string)
Click to show internal directories.
Click to hide internal directories.