demozoo

package
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var ErrSync = errors.New("placeholder")

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.

func Sync

func Sync() (err error)

Types

type Authors

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

Authors contains Defacto2 people rolls.

type Category

type Category int
const (
	Text Category = iota
	Code
	Graphics
	Music
	Magazine
)

func (Category) String

func (c Category) String() string

type DownloadsAPIv1

type DownloadsAPIv1 struct {
	LinkClass string `json:"link_class"`
	URL       string `json:"url"`
}

DownloadsAPIv1 are DownloadLinks for ProductionsAPIv1.

type Fetched

type Fetched struct {
	Code   int
	Status string
	API    ProductionsAPIv1
}

func Fetch

func Fetch(id uint) (Fetched, error)

Fetch a Demozoo production by its ID.

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 (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.

func (*Record) Save

func (r *Record) Save() error

Save a file item record to the database.

func (*Record) String

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

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.

func (Request) Queries

func (req Request) Queries() error

Queries parses all new proofs. ow will overwrite any existing proof assets such as images. all parses every proof not just records waiting for approval.

func (*Request) Query

func (req *Request) Query(id string) (err error)

Query parses a single Demozoo entry.

Jump to

Keyboard shortcuts

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