Documentation
¶
Overview ¶
Package demozoo interacts with the demozoo.org API for data scraping and fetching user file downloads.
Index ¶
- Variables
- func Counter(db *sql.DB, w io.Writer, r request) error
- func Fix(db *sql.DB, w io.Writer) error
- func InsertProds(db *sql.DB, w io.Writer, p *releases.Productions) error
- func RefreshMeta(db *sql.DB, w io.Writer) error
- func RefreshPouet(db *sql.DB, w io.Writer) error
- type Category
- type MsDosProducts
- type Product
- type Record
- func (r *Record) DoseeMeta(db *sql.DB, w io.Writer, cfg conf.Config) error
- func (r *Record) Download(w io.Writer, api *prods.ProductionsAPIv1, st Stat, overwrite bool) error
- func (r *Record) FileMeta() error
- func (r *Record) Save(db *sql.DB) error
- func (r *Record) Stmt() (string, []any)
- func (r *Record) String() string
- func (r *Record) ZipContent(w io.Writer) (bool, error)
- type Records
- type Releaser
- type ReleaserProducts
- type Request
- type Stat
- type WindowsProducts
Constants ¶
This section is empty.
Variables ¶
var ( ErrRequest = errors.New("unknown request value") ErrValues = errors.New("too few record values") )
var ( ErrDir = errors.New("filepath points to a directory") ErrOverwrite = errors.New("overwrite is false, but an existing download exists and cannot be overwritten") ErrDownload = errors.New("no suitable downloads found") ErrProdAPI = errors.New("productions api pointer cannot be nil") ErrRecord = errors.New("pointer to the record cannot be nil") ErrRecords = errors.New("pointer to the rows of records cannot be nil") ErrUUID = errors.New("uuid is empty and cannot be used") )
var ( ErrAuthors = errors.New("pointer to the author cannot be nil") ErrFile = errors.New("file requirement cannot be empty") ErrHead = errors.New("http header cannot be empty") ErrNoRel = errors.New("no productions exist for this releaser") ErrParseAPI = errors.New("parse api has skipped") ErrProds = errors.New("pointer to the productions cannot be nil") )
var ErrLogger = errors.New("zap logger cannot be nil")
Functions ¶
func Counter ¶ added in v1.11.0
Counter prints to the writer the number of records with links to the request.
func InsertProds ¶ added in v1.6.0
InsertProds adds the collection of Demozoo productions to the file database.
func RefreshMeta ¶
RefreshMeta synchronises missing file entries with Demozoo sourced metadata.
Types ¶
type MsDosProducts ¶ added in v1.7.0
type MsDosProducts struct {
Code int // Code is the HTTP status.
Status string // Status is the HTTP status.
API []releases.ProductionV1 // API v1 for a Demozoo production.
Count int // Count the total productions.
Finds int // Finds are the number of usable productions.
}
MsDosProducts are Demozoo productions that match platforms id 4, MS-DOS. Productions with the tag "lost" are skipped. Productions created on or newer than 1 Jan. 2000 are skipped.
type Product ¶ added in v1.6.0
type Product struct {
Code int // Code is the HTTP status.
Status string // Status is the HTTP status.
API prods.ProductionsAPIv1 // API v1 for a Demozoo production.
}
Product is a Demozoo production item.
type Record ¶
type Record struct {
Count int
FilePath string // FilePath is an absolute path to the file download.
ID string // ID is the database auto increment id.
UUID string // UUID is the record's unique id.
Filename string
Filesize string
FileZipContent string
CreatedAt string
UpdatedAt string
SumMD5 string // SumMD5 is the file download MD5 hash.
Sum384 string // Sum384 is the file download SHA 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 // WebIDDemozoo is a Demozoo ID associated with the record.
WebIDPouet uint // WebIDPouet is a Pouet ID associated with the record.
LastMod time.Time // LastMod is the last modified time value of the file download.
}
Record update for an item in the "file" table of the database.
func (*Record) Download ¶
Download the first available remote file linked in the Demozoo production record.
type Records ¶
type Records struct {
Rows *sql.Rows // Rows is the result of a query.
Args []any // Args are data types.
Values []sql.RawBytes // Values are byte encoded values.
}
Records contain more than one Record.
type Releaser ¶ added in v1.6.0
type Releaser struct {
Code int // Code is the HTTP status.
Status string // Status is the HTTP status.
API releaser.ReleaserV1 // API v1 for a Demozoo releaser.
}
Releaser is a Demozoo scener or group.
type ReleaserProducts ¶ added in v1.6.0
type ReleaserProducts struct {
Code int // Code is the HTTP status.
Status string // Status is the HTTP status.
API releases.Productions // API for the Demozoo productions.
}
ReleaserProducts are the productions of a Demozoo releaser.
func (*ReleaserProducts) Get ¶ added in v1.6.0
func (r *ReleaserProducts) Get(id uint) error
Get the productions of a Demozoo scener or group.
type Request ¶
type Request struct {
All bool // Parse all demozoo entries.
Overwrite bool // Overwrite any existing files.
Refresh bool // Refresh all demozoo entries.
ByID string // Filter by ID.
Config conf.Config
Logger *zap.SugaredLogger
}
Request Demozoo entries.
type Stat ¶
type Stat struct {
Count int // Count records.
Fetched int // Fetched records.
Missing int // Missing files.
Total int // Total files.
ByID string // ByID filtering.
}
Stat are statistics for the remote query.
func (*Stat) FileExist ¶
FileExist returns false when the record FilePath points to a non-existent file.
type WindowsProducts ¶ added in v1.7.0
type WindowsProducts struct {
Code int // Code is the HTTP status.
Status string // Status is the HTTP status.
API []releases.ProductionV1 // API v1 for a Demozoo production.
Count int // Count the total productions.
Finds int // Finds are the number of usable productions.
}
WindowsProducts are Demozoo productions that match the Windows platform.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
filter
Package filter confirms a Demozoo Production is suitable for Defacto2.
|
Package filter confirms a Demozoo Production is suitable for Defacto2. |
|
fix
Package fix repairs any imported Demozoo production data that may conflict or be incompatible with the Defacto2 database.
|
Package fix repairs any imported Demozoo production data that may conflict or be incompatible with the Defacto2 database. |
|
insert
Package insert adds Demozoo productions to the Defacto2 database.
|
Package insert adds Demozoo productions to the Defacto2 database. |
|
prod
Package prod obtains a Demozoo Production.
|
Package prod obtains a Demozoo Production. |
|
prods
Package prods handles marshalling of a Demozoo Production.
|
Package prods handles marshalling of a Demozoo Production. |
|
releaser
Package releaser handles Demozoo Releasers which are objects for both scene groups and people.
|
Package releaser handles Demozoo Releasers which are objects for both scene groups and people. |
|
releases
Package releases handles collections of Demozoo Productions that share a common filter such as a platform or category type.
|
Package releases handles collections of Demozoo Productions that share a common filter such as a platform or category type. |