demozoo

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: Apache-2.0 Imports: 29 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")
	ErrNoRel    = errors.New("no productions exist for this releaser")
)

Functions

func Fix

func Fix() error

Fix repairs imported Demozoo data conflicts.

func InsertProds added in v1.6.0

func InsertProds(p *releases.Productions, quiet bool) error

InsertProds adds the collection of Demozoo productions to the file database.

func RefreshMeta

func RefreshMeta(quiet bool) error

RefreshMeta synchronises missing file entries with Demozoo sourced metadata.

func RefreshPouet added in v1.6.0

func RefreshPouet(quiet bool) error

RefreshPouet 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 MsDosProducts added in v1.7.0

type MsDosProducts struct {
	Code   int
	Status string
	API    []releases.ProductionV1
	Count  int
	Finds  int
	Quiet  bool
}

MsDosProducts are 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.

func (*MsDosProducts) Get added in v1.7.0

func (m *MsDosProducts) Get() error

type Product added in v1.6.0

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

Product is a demozoo production.

func (*Product) Get added in v1.6.0

func (p *Product) Get(id uint) error

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 update for an item in the "file" table of the database.

func NewRecord

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

NewRecord initialises a new file record.

func (*Record) DoseeMeta

func (r *Record) DoseeMeta() error

DoseeMeta generates DOSee related metadata from the file archive.

func (*Record) Download

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

Download the first available remote file linked in the Demozoo production record.

func (*Record) FileMeta

func (r *Record) FileMeta() error

FileMeta generates metadata from the file archive.

func (*Record) Save

func (r *Record) Save() error

Save the record to the database.

func (*Record) Stmt added in v1.6.0

func (r *Record) Stmt() (query string, args []any)

Stmt creates the SQL prepare statement and values to update a Demozoo production.

func (*Record) String

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

func (*Record) ZipContent

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

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

type Records

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

Records contain more than one Record.

type Releaser added in v1.6.0

type Releaser struct {
	Code   int
	Status string
	API    releaser.ReleaserV1
}

Releaser is a demozoo scener or group.

func (*Releaser) Get added in v1.6.0

func (r *Releaser) Get(id uint) error

type ReleaserProducts added in v1.6.0

type ReleaserProducts struct {
	Code   int
	Status string
	API    releases.Productions
}

ReleaserProducts are the productions of a demozoo releaser.

func (*ReleaserProducts) Get added in v1.6.0

func (r *ReleaserProducts) Get(id uint) error

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.
	Quiet     bool
}

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

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

Stat are the remote query statistics.

func (*Stat) FileExist

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

FileExist returns false if the FilePath of the record points to a missing file.

func (*Stat) NextPouet added in v1.6.0

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

NextPouet iterates over the linked Demozoo records and sync any linked Pouet data to the local files table.

func (*Stat) NextRefresh

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

NextRefresh iterates over the Records to update sync their Demozoo data to the database.

type WindowsProducts added in v1.7.0

type WindowsProducts struct {
	Code   int
	Status string
	API    []releases.ProductionV1
	Count  int
	Finds  int
	Quiet  bool
}

func (*WindowsProducts) Get added in v1.7.0

func (m *WindowsProducts) Get() error

Directories

Path Synopsis
internal
fix

Jump to

Keyboard shortcuts

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