structs

package
v0.0.0-...-b889a0a Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Award

type Award struct {
	Category  string `json:",omitempty"`
	Reference string `json:",omitempty"` // who gave the award
}
type Breadcrumbs []Dir

Breadcrumbs represents a list of directories in the breadcrumbs.

type ByNameFolderOnTop

type ByNameFolderOnTop []File

ByNameFolderOnTop sorts files by name, with folders on top.

func (ByNameFolderOnTop) Len

func (a ByNameFolderOnTop) Len() int

func (ByNameFolderOnTop) Less

func (a ByNameFolderOnTop) Less(i, j int) bool

func (ByNameFolderOnTop) Swap

func (a ByNameFolderOnTop) Swap(i, j int)

type ByYearDesk

type ByYearDesk []File

ByYearDesk sorts files by year, with newest on top. Directories that does not match the year format are sorted alphabetically.

func (ByYearDesk) Len

func (f ByYearDesk) Len() int

func (ByYearDesk) Less

func (f ByYearDesk) Less(i, j int) bool

func (ByYearDesk) Swap

func (f ByYearDesk) Swap(i, j int)

type Category

type Category struct {
	Name   string `json:",omitempty"`
	Winner Winner `json:",omitempty"`
}

type Character

type Character struct {
	Name       string
	Actor      string `json:",omitempty"`
	Voice      string `json:",omitempty"`
	Image      *Media `json:",omitempty"`
	ActorImage *Media `json:",omitempty"`

	// populated by the generator
	Awards []Award `yml:"-" json:",omitempty"`
}

Character represents a character in a movie, tv show, etc.

type Columns

type Columns map[string]string

func (*Columns) Add

func (c *Columns) Add(key, value string)

func (*Columns) Get

func (c *Columns) Get(key string) string

type Connections

type Connections map[string]map[string][]string

Connections represents a list of connectiones that initiated by a reference. Key is a file path, where reference is pointing to. Value is a map, where key is a file path, where reference is located, and value is a type of reference. For example, three files "Alice", "Book" and "Cinema" are referencing to file "Dave", but in different contexts. File "Alice" just has a reference to file "Dave", file "Book" has a reference "Dave" as an "Author", and file "Cinema" has a reference "Dave" as a "Voice" for "Bob" (presumably, a character). Then the Connections map will look like this:

{
	"Dave": {
		"Alice": []
		"Book": ["Author"]
		"Cinema": ["Voice", "Bob"],
	}
}

In case of TV series, it's a bit more complicated, because there are multiple episodes. The problem is that same person can be a writer for a multiple episodes. And when adding connection for the same person to the same content, it will append to the list.

{
	"Charlie Brooker": {
		"Black Mirror": [
			"Writer", "", "The National Anthem",
			"Writer", "", "Fifteen Million Merits",
			"Writer", "", "The Entire History of You",
		],
	}
}

type Content

type Content struct {
	ID     string `yaml:"-"`                   // used by Search
	Source string `yaml:"-"`                   // path to the file
	HTML   string `yaml:"-" json:",omitempty"` // for Markdown files

	// for everything
	Name        string    `yaml:",omitempty" json:",omitempty"` // name of the file, used in the breadcrumbs
	Title       string    `yaml:",omitempty" json:",omitempty"` // override for the name, used as page title, fallback to Name
	Subtitle    string    `yaml:",omitempty" json:",omitempty"`
	Year        int       `yaml:",omitempty" json:",omitempty"`
	Authors     oneOrMany `yaml:",omitempty" json:",omitempty"`
	Developers  oneOrMany `yaml:",omitempty" json:",omitempty"`
	Description string    `yaml:",omitempty" json:",omitempty"`
	CoverArtist string    `yaml:"cover_artist,omitempty" json:",omitempty"`
	Designer    string    `yaml:",omitempty" json:",omitempty"`

	BasedOn  oneOrMany `yaml:"based_on,omitempty" json:",omitempty"`
	Series   string    `yaml:",omitempty" json:",omitempty"`
	Previous string    `yaml:",omitempty" json:",omitempty"` // reference to previous in the series

	// for people
	DOB     string `yaml:",omitempty" json:",omitempty"` // date of birth
	DOD     string `yaml:",omitempty" json:",omitempty"` // date of death
	Contact string `yaml:"contact,omitempty" json:",omitempty"`

	Parent   string    `yaml:",omitempty" json:",omitempty"` // for companies
	Founded  string    `yaml:",omitempty" json:",omitempty"` // for companies
	Founders oneOrMany `yaml:",omitempty" json:",omitempty"` // for companies
	Released string    `yaml:",omitempty" json:",omitempty"` // for games, ...

	// general external links
	Website          string   `yaml:",omitempty" json:",omitempty"`
	Websites         []string `yaml:",omitempty" json:",omitempty"`
	Wikipedia        string   `yaml:",omitempty" json:",omitempty"`
	GoodReads        string   `yaml:",omitempty" json:",omitempty"`
	Bookshop         string   `yaml:",omitempty" json:",omitempty"`
	AnimeNewsNetwork string   `yaml:"anime_news_network,omitempty" json:",omitempty"`
	Twitch           string   `yaml:",omitempty" json:",omitempty"`
	YouTube          string   `yaml:",omitempty" json:",omitempty"`
	Vimeo            string   `yaml:",omitempty" json:",omitempty"`
	IMDB             string   `yaml:",omitempty" json:",omitempty"`
	TMDB             string   `yaml:",omitempty" json:",omitempty"`
	TPDB             string   `yaml:",omitempty" json:",omitempty"`
	Steam            string   `yaml:",omitempty" json:",omitempty"`
	Netflix          string   `yaml:",omitempty" json:",omitempty"`
	Spotify          string   `yaml:",omitempty" json:",omitempty"`
	Soundcloud       string   `yaml:",omitempty" json:",omitempty"`
	Hulu             string   `yaml:",omitempty" json:",omitempty"`
	Max              string   `yaml:",omitempty" json:",omitempty"`
	AdultSwim        string   `yaml:",omitempty" json:",omitempty"`
	AppStore         string   `yaml:"app_store,omitempty" json:",omitempty"`
	Fandom           string   `yaml:",omitempty" json:",omitempty"`
	RottenTomatoes   string   `yaml:"rotten_tomatoes,omitempty" json:",omitempty"`
	Metacritic       string   `yaml:",omitempty" json:",omitempty"`
	Opencritic       string   `yaml:",omitempty" json:",omitempty"`
	Twitter          string   `yaml:",omitempty" json:",omitempty"`
	Mastodon         string   `yaml:",omitempty" json:",omitempty"`
	Reddit           string   `yaml:",omitempty" json:",omitempty"`
	Facebook         string   `yaml:",omitempty" json:",omitempty"`
	Instagram        string   `yaml:",omitempty" json:",omitempty"`
	Threads          string   `yaml:",omitempty" json:",omitempty"`
	LinkedIn         string   `yaml:"linkedin,omitempty" json:",omitempty"`
	TikTok           string   `yaml:",omitempty" json:",omitempty"`
	TelegramChannel  string   `yaml:"telegram_channel,omitempty" json:",omitempty"`
	PlayStation      string   `yaml:"playstation,omitempty" json:",omitempty"`
	XBox             string   `yaml:"xbox,omitempty" json:",omitempty"`
	GOG              string   `yaml:"gog,omitempty" json:",omitempty"`
	X                string   `yaml:",omitempty" json:",omitempty"`
	Discord          string   `yaml:",omitempty" json:",omitempty"`
	Epic             string   `yaml:",omitempty" json:",omitempty"`
	IGN              string   `yaml:"ign,omitempty" json:",omitempty"`
	Amazon           string   `yaml:",omitempty" json:",omitempty"`
	PrimeVideo       string   `yaml:"prime_video,omitempty" json:",omitempty"`
	AppleTV          string   `yaml:"apple_tv,omitempty" json:",omitempty"`
	ApplePodcasts    string   `yaml:"apple_podcasts,omitempty" json:",omitempty"`
	AppleBooks       string   `yaml:"apple_books,omitempty" json:",omitempty"`
	Peacock          string   `yaml:",omitempty" json:",omitempty"`
	GooglePlay       string   `yaml:"google_play,omitempty" json:",omitempty"`
	DisneyPlus       string   `yaml:"disney_plus,omitempty" json:",omitempty"`
	MicrosoftStore   string   `yaml:"microsoft_store,omitempty" json:",omitempty"`
	Nintendo         string   `yaml:",omitempty" json:",omitempty"`
	HumbleBundle     string   `yaml:"humble_bundle,omitempty" json:",omitempty"`
	Row8             string   `yaml:",omitempty" json:",omitempty"`
	Redbox           string   `yaml:",omitempty" json:",omitempty"`
	Vudu             string   `yaml:",omitempty" json:",omitempty"`
	DarkHorse        string   `yaml:",omitempty" json:",omitempty"`

	// for books
	ISBN        string    `yaml:",omitempty" json:",omitempty"`
	ISBN10      string    `yaml:",omitempty" json:",omitempty"`
	ISBN13      string    `yaml:",omitempty" json:",omitempty"`
	OCLC        string    `yaml:",omitempty" json:",omitempty"`
	Publishers  oneOrMany `yaml:",omitempty" json:",omitempty"`
	Publication string    `yaml:",omitempty" json:",omitempty"` // date or year of publication

	// for comics
	Artists      oneOrMany `yaml:",omitempty" json:",omitempty"`
	Colorist     string    `yaml:",omitempty" json:",omitempty"`
	Illustrators oneOrMany `yaml:",omitempty" json:",omitempty"`
	Imprint      string    `yaml:",omitempty" json:",omitempty"`
	UPC          string    `yaml:",omitempty" json:",omitempty"`

	// for movies, games, series, ...
	Genres         []string      `yaml:",omitempty" json:",omitempty"`
	Engine         string        `yaml:",omitempty" json:",omitempty"`
	Trailer        string        `yaml:",omitempty" json:",omitempty"`
	Rating         string        `yaml:",omitempty" json:",omitempty"`
	Length         time.Duration `yaml:",omitempty" json:",omitempty"`
	Creators       oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Writers        oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Editors        oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Directors      oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Cinematography oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Producers      oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Screenplay     oneOrMany     `yaml:",omitempty" json:",omitempty"`
	StoryBy        oneOrMany     `yaml:"story_by,omitempty" json:",omitempty"`
	DialoguesBy    oneOrMany     `yaml:"dialogues_by,omitempty" json:",omitempty"`
	Music          oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Production     oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Distributors   oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Network        string        `yaml:",omitempty" json:",omitempty"`
	Composers      oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Programmers    oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Designers      oneOrMany     `yaml:",omitempty" json:",omitempty"`

	// for podcasts
	Hosts  oneOrMany `yaml:",omitempty" json:",omitempty"`
	Guests oneOrMany `yaml:",omitempty" json:",omitempty"`

	RemakeOf string `yaml:"remake_of,omitempty" json:",omitempty"`

	Characters []*Character `yaml:",omitempty" json:",omitempty"`

	// for awards
	Categories []Category `yaml:",omitempty" json:",omitempty"`

	// unknown fields are stored in the Extra map
	Extra map[string]interface{} `yaml:",inline" json:",omitempty"`

	References []Reference `yaml:"refs,omitempty" json:",omitempty"`

	Episodes []*Episode `yaml:",omitempty" json:",omitempty"` // for series

	// fields populated by the generator
	Image                *Media  `yaml:"-" json:",omitempty"`
	Awards               []Award `yaml:"-" json:",omitempty"`
	EditorsAwards        []Award `yaml:"-" json:",omitempty"`
	WritersAwards        []Award `yaml:"-" json:",omitempty"`
	DirectorsAwards      []Award `yaml:"-" json:",omitempty"`
	CinematographyAwards []Award `yaml:"-" json:",omitempty"`
	MusicAwards          []Award `yaml:"-" json:",omitempty"`
	ScreenplayAwards     []Award `yaml:"-" json:",omitempty"`
}

Content represents the content of a file.

type Contents

type Contents map[string]Content

Contents represents a list of contents, where key is a file path. It is used to properly render references.

type Dir

type Dir struct {
	Name string
	Path string
}

Dir represents a directory in the breadcrumbs.

type Episode

type Episode struct {
	Name           string
	Description    string        `yaml:",omitempty" json:",omitempty"`
	Length         time.Duration `yaml:",omitempty" json:",omitempty"`
	Released       string        `yaml:",omitempty" json:",omitempty"`
	Directors      oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Writers        oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Editors        oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Cinematography oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Teleplay       oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Story          oneOrMany     `yaml:",omitempty" json:",omitempty"`
	Studio         string        `yaml:",omitempty" json:",omitempty"`
	Characters     []*Character  `yaml:",omitempty" json:",omitempty"`

	IMDB      string `yaml:",omitempty" json:",omitempty"`
	TMDB      string `yaml:",omitempty" json:",omitempty"`
	Netflix   string `yaml:",omitempty" json:",omitempty"`
	Wikipedia string `yaml:",omitempty" json:",omitempty"`
	Fandom    string `yaml:",omitempty" json:",omitempty"`

	// unknown fields are stored in the Extra map
	Extra map[string]interface{} `yaml:",inline" json:",omitempty"`
}

type Extra

type Extra struct {
	Primary []string
	Addon   string
}

Extra usind in "splitExtra" template function to separate episode titles from the rest of the data.

type File

type File struct {
	Name      string
	Title     string // value from YAML "name" field, may contain colons
	IsFolder  bool   // used to render folder icon and to sort files
	IsMissing bool   // for pages that have no source file; used to show striped background
	Image     *Media

	Columns Columns // extra fields to use in list view
}

File represents a file or directory in the file system.

type FileLists

type FileLists map[string]Panel

FileLists is a map, where key is a directory path, and value is a Panel that corresponds to that directory.

type Media

type Media struct {
	Path                string
	Width               int    `yaml:"width,omitempty" json:",omitempty"`
	Height              int    `yaml:"height,omitempty" json:",omitempty"`
	ThumbPath           string `yaml:"thumb,omitempty" json:",omitempty"`
	ThumbXOffset        int    `yaml:"thumb_x,omitempty" json:",omitempty"`
	ThumbYOffset        int    `yaml:"thumb_y,omitempty" json:",omitempty"`
	ThumbWidth          int    `yaml:"thumb_width,omitempty" json:",omitempty"`
	ThumbHeight         int    `yaml:"thumb_height,omitempty" json:",omitempty"`
	ThumbTotalWidth     int    `yaml:"thumb_total_width,omitempty" json:",omitempty"`
	ThumbTotalHeight    int    `yaml:"thumb_total_height,omitempty" json:",omitempty"`
	Blurhash            string `yaml:"blurhash,omitempty" json:",omitempty"`
	BlurhashImageBase64 string `yaml:"blurhash_image_base64,omitempty" json:",omitempty"`
}

func ParseMediaFile

func ParseMediaFile(path string) ([]Media, error)

type Missing

type Missing struct {
	To     string
	From   map[string][]string
	Awards []Award
}

Missing represents a missing reference. Used in "missing" template function to render Missing.gomd file.

type PageData

type PageData struct {
	OutputPath  string
	CurrentPath string
	Dir         string
	Breadcrumbs []Dir
	Panels      Panels
	Content     *Content
	Timestamp   int64
	Connections Connections
}

type Panel

type Panel struct {
	Dir   string
	Files []File
}

Panel represents a single directory with files.

type Panels

type Panels []Panel

Panels represents a list of panels.

type Reference

type Reference struct {
	Path string
	Name string
}

Reference represents a reference to another file. Often it has only a path.

func (*Reference) UnmarshalYAML

func (r *Reference) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML is a custom unmarshaler for Reference. It can be either a string or a map.

type Winner

type Winner struct {
	Reference      string    `yaml:"ref,omitempty" json:",omitempty"` // full path to referenced content
	Movie          string    `yaml:",omitempty" json:",omitempty"`
	Game           string    `yaml:",omitempty" json:",omitempty"`
	Series         string    `yaml:",omitempty" json:",omitempty"`
	Person         string    `yaml:",omitempty" json:",omitempty"`
	Actor          string    `yaml:",omitempty" json:",omitempty"`
	Editors        oneOrMany `yaml:",omitempty" json:",omitempty"`
	Track          string    `yaml:",omitempty" json:",omitempty"`
	Directors      oneOrMany `yaml:",omitempty" json:",omitempty"`
	Writers        oneOrMany `yaml:",omitempty" json:",omitempty"`
	Cinematography oneOrMany `yaml:",omitempty" json:",omitempty"`
	Music          oneOrMany `yaml:",omitempty" json:",omitempty"`
	Screenplay     oneOrMany `yaml:",omitempty" json:",omitempty"`
	Producers      oneOrMany `yaml:",omitempty" json:",omitempty"`
	Casting        oneOrMany `yaml:",omitempty" json:",omitempty"`
	ConstumeDesign oneOrMany `yaml:",omitempty" json:",omitempty"`
	MakeUpAndHair  oneOrMany `yaml:",omitempty" json:",omitempty"`

	Fallback string `yaml:"-" json:"-,omitempty"` // used to store the fallback value for template
}

Jump to

Keyboard shortcuts

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