Documentation
¶
Overview ¶
Package demozoo interacts with the demozoo.org API for data scraping and file downloads.
Index ¶
- Variables
- func Fix() error
- func RefreshMeta() error
- func Sync() error
- type Authors
- type Category
- type DownloadsAPIv1
- type Fetched
- type Production
- type ProductionsAPIv1
- func (p *ProductionsAPIv1) Authors() Authors
- func (p *ProductionsAPIv1) Download(l DownloadsAPIv1) error
- func (p *ProductionsAPIv1) DownloadLink() (name, link string)
- func (p *ProductionsAPIv1) Downloads()
- func (p *ProductionsAPIv1) JSON() ([]byte, error)
- func (p *ProductionsAPIv1) PouetID(ping bool) (id, statusCode int, err error)
- func (p *ProductionsAPIv1) Print() error
- type Record
- type Request
Constants ¶
This section is empty.
Variables ¶
var ( ErrNegativeID = errors.New("demozoo production id cannot be a negative integer") ErrFilePath = errors.New("filepath requirement cannot be empty") ErrFilename = errors.New("filename requirement cannot be empty") ErrTooFew = errors.New("too few record values") )
var ErrSync = errors.New("placeholder")
ErrSync is a placeholder.
Functions ¶
func RefreshMeta ¶
func RefreshMeta() error
RefreshMeta synchronises missing file entries with Demozoo sourced metadata.
Types ¶
type Authors ¶
type Authors struct {
// contains filtered or unexported fields
}
Authors contains Defacto2 people rolls.
type DownloadsAPIv1 ¶
DownloadsAPIv1 are DownloadLinks for ProductionsAPIv1.
type Fetched ¶
type Fetched struct {
Code int
Status string
API ProductionsAPIv1
}
Fetched production.
type Production ¶
type Production struct {
ID int64 // Demozoo production ID
Timeout time.Duration // HTTP request timeout in seconds (default 5)
StatusCode int // received HTTP statuscode
Status string // received HTTP status
// contains filtered or unexported fields
}
Production API production request.
func (*Production) URL ¶
func (p *Production) URL() error
URL creates a productions API v.1 request link. example: https://demozoo.org/api/v1/productions/158411/?format=json
type ProductionsAPIv1 ¶
type ProductionsAPIv1 struct {
URL string `json:"url"`
DemozooURL string `json:"demozoo_url"`
ID int `json:"id"`
Title string `json:"title"`
AuthorNicks []struct {
Name string `json:"name"`
Abbreviation string `json:"abbreviation"`
Releaser struct {
URL string `json:"url"`
ID int `json:"id"`
Name string `json:"name"`
IsGroup bool `json:"is_group"`
} `json:"releaser"`
} `json:"author_nicks"`
AuthorAffiliationNicks []interface{} `json:"author_affiliation_nicks"`
ReleaseDate string `json:"release_date"`
Supertype string `json:"supertype"`
Platforms []struct {
URL string `json:"url"`
ID int `json:"id"`
Name string `json:"name"`
} `json:"platforms"`
Types []struct {
URL string `json:"url"`
ID int `json:"id"`
Name string `json:"name"`
Supertype string `json:"supertype"`
} `json:"types"`
Credits []struct {
Nick struct {
Name string `json:"name"`
Abbreviation string `json:"abbreviation"`
Releaser struct {
URL string `json:"url"`
ID int `json:"id"`
Name string `json:"name"`
IsGroup bool `json:"is_group"`
} `json:"releaser"`
} `json:"nick"`
Category string `json:"category"`
Role string `json:"role"`
} `json:"credits"`
DownloadLinks []struct {
LinkClass string `json:"link_class"`
URL string `json:"url"`
} `json:"download_links"`
ExternalLinks []struct {
LinkClass string `json:"link_class"`
URL string `json:"url"`
} `json:"external_links"`
ReleaseParties []interface{} `json:"release_parties"`
CompetitionPlacings []interface{} `json:"competition_placings"`
InvitationParties []interface{} `json:"invitation_parties"`
Screenshots []struct {
OriginalURL string `json:"original_url"`
OriginalWidth int `json:"original_width"`
OriginalHeight int `json:"original_height"`
StandardURL string `json:"standard_url"`
StandardWidth int `json:"standard_width"`
StandardHeight int `json:"standard_height"`
ThumbnailURL string `json:"thumbnail_url"`
ThumbnailWidth int `json:"thumbnail_width"`
ThumbnailHeight int `json:"thumbnail_height"`
} `json:"screenshots"`
}
ProductionsAPIv1 productions API v1. This can be dynamically generated at https://mholt.github.io/json-to-go/ Get the Demozoo JSON output from https://demozoo.org/api/v1/productions/{{.ID}}/?format=json
func (*ProductionsAPIv1) Authors ¶
func (p *ProductionsAPIv1) Authors() Authors
Authors parses Demozoo authors and reclassifies them into Defacto2 people rolls.
func (*ProductionsAPIv1) Download ¶
func (p *ProductionsAPIv1) Download(l DownloadsAPIv1) error
func (*ProductionsAPIv1) DownloadLink ¶
func (p *ProductionsAPIv1) DownloadLink() (name, link string)
DownloadLink parses the Demozoo DownloadLinks to return the filename and link of the first suitable download.
func (*ProductionsAPIv1) Downloads ¶
func (p *ProductionsAPIv1) Downloads()
Downloads parses the Demozoo DownloadLinks and saves the first suitable download.
func (*ProductionsAPIv1) JSON ¶
func (p *ProductionsAPIv1) JSON() ([]byte, error)
JSON returns the production API results as tabbed JSON. This is used by internal/generator.go.
func (*ProductionsAPIv1) PouetID ¶
func (p *ProductionsAPIv1) PouetID(ping bool) (id, statusCode int, err error)
PouetID returns the ID value used by Pouet's which prod URL syntax and its HTTP status code. example: https://www.pouet.net/prod.php?which=30352
func (*ProductionsAPIv1) Print ¶
func (p *ProductionsAPIv1) Print() error
Print displays the production API results as tabbed JSON.
type Record ¶
type Record struct {
FilePath string // absolute path to file
ID string // MySQL auto increment id
UUID string // record unique id
Filename string
Filesize string
FileZipContent string
CreatedAt string
UpdatedAt string
SumMD5 string // file download MD5 hash
Sum384 string // file download SHA384 hash
Readme string
DOSeeBinary string
Platform string
GroupFor string
GroupBy string
Title string
Section string
CreditText []string
CreditCode []string
CreditArt []string
CreditAudio []string
WebIDDemozoo uint // demozoo production id
WebIDPouet uint
LastMod time.Time // file download last modified time
// contains filtered or unexported fields
}
Record of a file item.
type Request ¶
type Request struct {
All bool // parse all demozoo entries
Overwrite bool // overwrite existing files
Refresh bool // refresh all demozoo entries
Simulate bool // simulate database save
// contains filtered or unexported fields
}
Request proofs.