demozoo

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package demozoo interacts with the demozoo.org API for data scraping and file downloads.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilePath = errors.New("filepath requirement cannot be empty")
	ErrFilename = errors.New("filename requirement cannot be empty")
	ErrTooFew   = errors.New("too few record values")
	ErrNA       = errors.New("this feature is not implemented")
)

Functions

func Fix

func Fix() error

Fix repairs imported Demozoo data conflicts.

func RefreshMeta

func RefreshMeta() error

RefreshMeta synchronises missing file entries with Demozoo sourced metadata.

Types

type Category

type Category int

Category are tags for production imports.

const (
	Text     Category = iota // Text based files.
	Code                     // Code are binary files.
	Graphics                 // Graphics are images.
	Music                    // Music is audio.
	Magazine                 // Magazine are publications.
)

func (Category) String

func (c Category) String() string

type Fetched

type Fetched struct {
	Code   int
	Status string
	API    prods.ProductionsAPIv1
}

Fetched production.

func Fetch

func Fetch(id uint) (Fetched, error)

Fetch a Demozoo production by an id.

type Record

type Record struct {
	Count          int
	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
}

Record of a file item.

func NewRecord added in v1.4.0

func NewRecord(c int, values []sql.RawBytes) (Record, error)

NewRecord initialises a new file record.

func (*Record) DoseeMeta added in v1.4.0

func (r *Record) DoseeMeta() error

func (*Record) Download added in v1.4.0

func (r *Record) Download(overwrite bool, api *prods.ProductionsAPIv1, st Stat) (skip bool)

func (*Record) FileMeta added in v1.4.0

func (r *Record) FileMeta() error

func (*Record) SQL added in v1.4.0

func (r *Record) SQL() (query string, args []interface{})

func (*Record) Save

func (r *Record) Save() error

Save the record to the database.

func (*Record) String

func (r *Record) String(total int) string

func (*Record) ZipContent added in v1.4.0

func (r *Record) ZipContent() (ok bool, err error)

ZipContent reads an archive and saves its content to the database.

type Records added in v1.4.0

type Records struct {
	Rows     *sql.Rows
	ScanArgs []interface{}
	Values   []sql.RawBytes
}

type Request

type Request struct {
	All       bool   // Parse all demozoo entries.
	Overwrite bool   // Overwrite any existing files.
	Refresh   bool   // Refresh all demozoo entries.
	Simulate  bool   // Simulate database save.
	ByID      string // Filter by ID.
}

Request Demozoo entries.

func (Request) Queries

func (r Request) Queries() error

Queries parses all new proofs. Overwrite will replace existing assets such as images. All parses every Demozoo entry, not just records waiting for approval.

func (*Request) Query

func (r *Request) Query(id string) error

Query parses a single Demozoo entry.

type Stat added in v1.4.0

type Stat struct {
	Count   int
	Fetched int
	Missing int
	Total   int
	ByID    string
}

Stat are the remote query statistics.

func (*Stat) FileExist added in v1.4.0

func (st *Stat) FileExist(r *Record) (missing bool)

func (*Stat) NextRefresh added in v1.4.0

func (st *Stat) NextRefresh(rec Records) error

Directories

Path Synopsis
internal
fix

Jump to

Keyboard shortcuts

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