wotwhb

package
v0.0.0-...-0af8f8c Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: ISC Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TotalAmountSpent        = float64(0)
	CurrencyList            = NewUniqueStringList()
	SubProductHumanNameList = NewUniqueStringList()
	ProductCategoryList     = NewUniqueStringList()
	ProductHumanNameList    = NewUniqueStringList()
	PayeeHumanNameList      = NewUniqueStringList()
	PlatformList            = NewUniqueStringList()
	ArchList                = NewUniqueStringList()
	TotalFileSize           = int64(0)
	DownloadStructNameList  = NewUniqueStringList()
)
View Source
var CompletionAction = &cobra.Command{
	Use:   "completion",
	Short: "Generate autocompletion files",
	Run:   CompletionActionRun,
}
View Source
var CompletionFormat = StringFromChoices{
	// contains filtered or unexported fields
}
View Source
var CompletionOutputFilePath string
View Source
var ConfigDirectoryFlagValue string
View Source
var DownloadDirectoryFlagValue string
View Source
var ForceRefreshConfigFlag bool
View Source
var (
	Logger = &logrus.Logger{
		Out:       os.Stderr,
		Formatter: formatter,
	}
)
View Source
var MetaCmd = &cobra.Command{
	Use:   "meta",
	Short: "Meta features like autocompletion",
	Run:   HelpOnly,
}
View Source
var PackageCmd = &cobra.Command{
	Use:              "wotw-hb",
	Version:          PackageVersion,
	Short:            "WIP Humble Bundle CLI",
	PersistentPreRun: PackageCmdPersistentPreRun,
	Run:              HelpOnly,
}
View Source
var PackageVersion = "0.0.0"
View Source
var UpdateCmd = &cobra.Command{
	Use:   "update",
	Short: "Update local databases",
	Run:   UpdateCmdRun,
}
View Source
var UpdateKeyListCmd = &cobra.Command{
	Use:   "keys",
	Short: "Update the full list of purchases (bundles, store purchases, etc.)",
	Run:   UpdateKeyListCmdRun,
}
View Source
var UpdateOrderListCmd = &cobra.Command{
	Use:   "orders",
	Short: "Update information about all the available orders (bundle contents, file type variants, links, etc.)",
	Run:   UpdateOrderListCmdRun,
}
View Source
var VerbosityFlagValue int

Functions

func BootstrapConfig

func BootstrapConfig(configPath, downloadPath string)

func BootstrapLogger

func BootstrapLogger(verbosityLevel int)

func CompletionActionRun

func CompletionActionRun(cmd *cobra.Command, args []string)

func Execute

func Execute() error

func HelpOnly

func HelpOnly(cmd *cobra.Command, args []string)

func PackageCmdPersistentPreRun

func PackageCmdPersistentPreRun(cmd *cobra.Command, args []string)

func UpdateCmdRun

func UpdateCmdRun(cmd *cobra.Command, args []string)

func UpdateKeyListCmdRun

func UpdateKeyListCmdRun(cmd *cobra.Command, args []string)

func UpdateOrderListCmdRun

func UpdateOrderListCmdRun(cmd *cobra.Command, args []string)

Types

type CanPrint

type CanPrint interface {
	Printf(format string, args ...interface{})
}

type HbOrder

type HbOrder struct {
	AmountSpent  float64        `json:"amount_spent"`
	Claimed      bool           `json:"claimed"`
	Created      string         `json:"created"`
	Currency     string         `json:"currency"`
	Gamekey      string         `json:"gamekey"`
	IsGiftee     bool           `json:"is_giftee"`
	MissedCredit interface{}    `json:"missed_credit"`
	PathIds      HbPathIds      `json:"path_ids"`
	Product      HbProduct      `json:"product"`
	SubProducts  []HbSubProduct `json:"subproducts"`
	Total        float64        `json:"total"`
	Uid          string         `json:"uid"`
}

jq '[.[] | keys] | flatten | unique' all-orders.json

type HbPathIds

type HbPathIds []string

type HbPayee

type HbPayee struct {
	HumanName   string `json:"human_name"`
	MachineName string `json:"machine_name"`
}

jq '[.[].subproducts[].payee | keys] | flatten | unique' all-orders.json

type HbProduct

type HbProduct struct {
	Category string `json:"category"`
	// Haven't found a pattern to this yet
	EmptyTpkds          interface{} `json:"empty_tpkds"`
	HumanName           string      `json:"human_name"`
	MachineName         string      `json:"machine_name"`
	PartialGiftEnabled  bool        `json:"partial_gift_enabled"`
	PostPurchaseText    string      `json:"post_purchase_text"`
	SubscriptionCredits int         `json:"subscription_credits"`
}

jq '[.[].product | keys] | flatten | unique' all-orders.json

type HbSubProduct

type HbSubProduct struct {
	CustomDownloadPageBox string                 `json:"custom_download_page_box_html"`
	Downloads             []HbSubProductDownload `json:"downloads"`
	HumanName             string                 `json:"human_name"`
	Icon                  string                 `json:"icon"`
	LibraryFamilyName     string                 `json:"library_family_name"`
	MachineName           string                 `json:"machine_name"`
	Payee                 HbPayee                `json:"payee"`
	Url                   string                 `json:"url"`
}

jq '[.[].subproducts[] | keys] | flatten | unique' all-orders.json

type HbSubProductDownload

type HbSubProductDownload struct {
	AndroidAppOnly        bool                                 `json:"android_app_only"`
	DownloadIdentifer     string                               `json:"download_identifier"`
	DownloadStruct        []HbSubProductDownloadDownloadStruct `json:"download_struct"`
	DownloadVersionNumber int                                  `json:"download_version_number"`
	MachineName           string                               `json:"machine_name"`
	// At least one product returns options_dict = [] which breaks Go
	// Search for "jacklumber_linux"
	OptionsDict interface{} `json:"options_dict"`
	Platform    string      `json:"platform"`
}

jq '[.[].subproducts[].downloads[] | keys] | flatten | unique' all-orders.json

type HbSubProductDownloadDownloadStruct

type HbSubProductDownloadDownloadStruct struct {
	Arch             string                                        `json:"arch"`
	AsmConfig        HbSubProductDownloadDownloadStructAsmConfig   `json:"asm_config"`
	AsmManifest      HbSubProductDownloadDownloadStructAsmManifest `json:"asm_manifest"`
	ExternalLink     string                                        `json:"external_link"`
	FileSize         int64                                         `json:"file_size"`
	ForceDownload    bool                                          `json:"force_download"`
	HdStreamUrl      string                                        `json:"hd_stream_url"`
	HumanSize        string                                        `json:"human_size"`
	KindleFriendly   bool                                          `json:"kindle_friendly"`
	Md5              string                                        `json:"md5"`
	Name             string                                        `json:"name"`
	SdStreamUrl      string                                        `json:"sd_stream_url"`
	Sha1             string                                        `json:"sha1"`
	Small            int                                           `json:"small"`
	Timestamp        int64                                         `json:"timestamp"`
	Timetstamp       int64                                         `json:"timetstamp"`
	UploadedAt       string                                        `json:"uploaded_at"`
	Url              HbSubProductDownloadDownloadStructUrl         `json:"url"`
	UsesKindleSender bool                                          `json:"uses_kindle_sender"`
}

jq '[.[].subproducts[].downloads[].download_struct[] | keys] | flatten | unique' all-orders.json

type HbSubProductDownloadDownloadStructAsmConfig

type HbSubProductDownloadDownloadStructAsmConfig struct {
	CloudMountPoint string `json:"cloudMountPoint"`
	DisplayItem     string `json:"display_item"`
	WarnCrash       bool   `json:"warnCrash"`
}

jq '[.[] | select(0 < (.subproducts | length)).subproducts[] | select(0 < (.downloads | length)).downloads[] | select(0 < (.download_struct | length)).download_struct[] | select(.asm_config != null).asm_config | keys] | flatten | unique' all-orders.json

type HbSubProductDownloadDownloadStructAsmManifest

type HbSubProductDownloadDownloadStructAsmManifest interface{}

q '[.[] | select(0 < (.subproducts | length)).subproducts[] | select(0 < (.downloads | length)).downloads[] | select(0 < (.download_struct | length)).download_struct[] | select(.asm_manifest != null).asm_manifest | keys] | flatten | unique' all-orders.json

type HbSubProductDownloadDownloadStructUrl

type HbSubProductDownloadDownloadStructUrl struct {
	BitTorrent string `json:"bittorrent"`
	Web        string `json:"web"`
}

jq '[.[] | select(0 < (.subproducts | length)).subproducts[] | select(0 < (.downloads | length)).downloads[] | select(0 < (.download_struct | length)).download_struct[] | select(.url != null).url | keys] | flatten | unique' all-orders.json

type HbSubProductDownloadOptionsDict

type HbSubProductDownloadOptionsDict struct {
	Is64BitToggle int `json:"is64bittoggle"`
}

jq '[.[] | select(0 < (.subproducts | length)).subproducts[] | select(0 < (.downloads | length)).downloads[] | select(.options_dict != null).options_dict | keys] | flatten | unique' all-orders.json

type HttpClient

type HttpClient interface {
	Do(request *http.Request) (*http.Response, error)
}

type MungeComponents

type MungeComponents struct {
	TotalAmountSpent        float64
	TotalFileSize           int64
	CurrencyList            []string
	SubProductHumanNameList []string
	ProductCategoryList     []string
	ProductHumanNameList    []string
	PayeeHumanNameList      []string
	PlatformList            []string
	ArchList                []string
	DownloadStructNameList  []string
}

type ResponseGuardNeeded

type ResponseGuardNeeded struct {
	Required bool     `json:"humble_guard_required"`
	Code     []string `json:"skip_code"`
}

type ResponseLoginSuccessful

type ResponseLoginSuccessful struct {
	UserTerms interface{} `json:"user_terms_opt_in_data"`
	Goto      string      `json:"goto"`
}

type StringFromChoices

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

func (*StringFromChoices) Set

func (s *StringFromChoices) Set(value string) error

func (*StringFromChoices) String

func (s *StringFromChoices) String() string

func (*StringFromChoices) Type

func (s *StringFromChoices) Type() string

type UniqueStringList

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

func NewUniqueStringList

func NewUniqueStringList(elements ...string) *UniqueStringList

func (*UniqueStringList) Add

func (u *UniqueStringList) Add(elements ...string) *UniqueStringList

func (*UniqueStringList) Contents

func (u *UniqueStringList) Contents() []string

func (*UniqueStringList) Size

func (u *UniqueStringList) Size() int

Jump to

Keyboard shortcuts

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