cast

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build added in v0.0.6

func Build(
	cfg *Config, episodes []*Episode, rootDir, generator, destination string,
	parents, doClear bool, buildDate time.Time) error

func IsSupportedMediaExt

func IsSupportedMediaExt(ext string) bool

func LoadEpisode

func LoadEpisode(
	rootDir, audioFile, body string, ignoreMissing, saveMeta bool,
	pubDate time.Time, slug, title, subtitle string, loc *time.Location) (string, bool, error)

The `audioFile` is specified either by file path, filename in the audio placement directory or URL. This means there are follwing patterns for `audioFile`:

- File path:

  • Relative path: "./audio/1.mp3" (this will be relative to the current directory, not the rootDir)
  • Absolute path: "/path/to/audio/mp.3"

- File name: "1.mp3" (subdirectories are currently not supported) - URL: "https://example.com/audio/1.mp3"

In any case, the audio files must exist under the audio placement directory.

func NewMarkdown

func NewMarkdown() goldmark.Markdown

func Scaffold

func Scaffold(outDir string) error

Types

type Audio

type Audio struct {
	Name     string     `json:"-"`
	Title    string     `json:"title"`
	FileSize int64      `json:"file_size"`
	Duration uint64     `json:"duration"`
	Chapters []*Chapter `json:"chapters,omitempty"`
	// contains filtered or unexported fields
}

func LoadAudio

func LoadAudio(fname string) (*Audio, error)

func NewAudio

func NewAudio(fname string) (*Audio, error)

func (*Audio) ReadFrom

func (au *Audio) ReadFrom(r io.ReadSeeker) error

func (*Audio) SaveMeta

func (au *Audio) SaveMeta(rootDir string) error

func (*Audio) UpdateChapter added in v0.0.13

func (au *Audio) UpdateChapter(fpath string, chs []*Chapter) error

type Builder

type Builder struct {
	Config    *Config
	Episodes  []*Episode
	RootDir   string
	Generator string
	BuildDir  string
	BuildDate time.Time
	// contains filtered or unexported fields
}

func NewBuilder added in v0.0.6

func NewBuilder(
	cfg *Config, episodes []*Episode, rootDir, generator, dest string, parents bool, buildDate time.Time) (*Builder, error)

func (*Builder) Build

func (bdr *Builder) Build() error

type Categories

type Categories []string

func (*Categories) UnmarshalYAML

func (cats *Categories) UnmarshalYAML(unmarshal func(interface{}) error) error

type ChannelConfig

type ChannelConfig struct {
	Link        YAMLURL    `yaml:"link"`
	Title       string     `yaml:"title"`
	Description string     `yaml:"description"`
	Categories  Categories `yaml:"category"` // XXX sub category is not supported yet
	Language    YAMLLang   `yaml:"language"`
	Author      string     `yaml:"author"`
	Email       string     `yaml:"email"`
	Artwork     string     `yaml:"artwork"`
	Copyright   string     `yaml:"copyright"`
	Explicit    bool       `yaml:"explicit"`
	Private     bool       `yaml:"private"`
}

func (*ChannelConfig) FeedURL

func (channel *ChannelConfig) FeedURL() *url.URL

func (*ChannelConfig) ImageURL

func (channel *ChannelConfig) ImageURL() string

type Chapter added in v0.0.8

type Chapter struct {
	Title string `json:"title"`
	Start uint64 `json:"start"`
}

func (*Chapter) MarshalYAML added in v0.0.13

func (chs *Chapter) MarshalYAML() ([]byte, error)

func (*Chapter) String added in v0.0.13

func (chs *Chapter) String() string

func (*Chapter) UnmarshalYAML added in v0.0.13

func (chs *Chapter) UnmarshalYAML(b []byte) error

type Config

type Config struct {
	Channel *ChannelConfig `yaml:"channel"`

	TimeZone       string  `yaml:"timezone"`
	AudioBucketURL YAMLURL `yaml:"audio_bucket_url"`
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(rootDir string) (*Config, error)

func (*Config) AudioBaseURL

func (cfg *Config) AudioBaseURL() *url.URL

func (*Config) Location

func (cfg *Config) Location() *time.Location

type Episode

type Episode struct {
	EpisodeFrontMatter
	Slug          string
	RawBody, Body string
	URL           *url.URL
	ChaptersBody  string
	// contains filtered or unexported fields
}

func LoadEpisodes

func LoadEpisodes(
	rootDir string, rootURL *url.URL, audioBaseURL *url.URL, loc *time.Location) ([]*Episode, error)

func (*Episode) AudioURL

func (ep *Episode) AudioURL() *url.URL

type EpisodeFrontMatter

type EpisodeFrontMatter struct {
	AudioFile string     `yaml:"audio"`
	Title     string     `yaml:"title"`
	Date      string     `yaml:"date"`
	Subtitle  string     `yaml:"subtitle"`
	Chapters  []*Chapter `yaml:"chapters,omitempty"`
	// contains filtered or unexported fields
}

func (*EpisodeFrontMatter) Audio

func (epm *EpisodeFrontMatter) Audio() *Audio

func (*EpisodeFrontMatter) PubDate

func (epm *EpisodeFrontMatter) PubDate() time.Time

type Feed

type Feed struct {
	Channel *ChannelConfig
	Podcast *podcast.Podcast
}

func NewFeed

func NewFeed(generator string, channel *ChannelConfig, pubDate, lastBuildDate time.Time) *Feed

func (*Feed) AddEpisode

func (f *Feed) AddEpisode(ep *Episode, audioBaseURL *url.URL) (int, error)

type MediaType

type MediaType int
const (
	MP3 MediaType = iota + 1
	M4A
)

func GetMediaTypeByExt

func GetMediaTypeByExt(ext string) (MediaType, bool)

func (MediaType) String

func (i MediaType) String() string

type Page

type Page struct {
	RawFrontmatter, RawBody string

	Body string
}

func LoadIndex

func LoadIndex(rootDir string, cfg *Config, episodes []*Episode) (*Page, error)

func LoadPage added in v0.0.14

func LoadPage(mdPath string, cfg *Config, episodes []*Episode) (*Page, error)

type PageArg added in v0.0.14

type PageArg struct {
	Page     *PageInfo
	Body     template.HTML
	Episodes []*Episode
	Channel  *ChannelConfig
}

type PageInfo added in v0.0.14

type PageInfo struct {
	Title       string
	Description string
	URL         *url.URL
}

type YAMLLang

type YAMLLang struct {
	*language.Tag
}

func (*YAMLLang) MarshalYAML

func (yl *YAMLLang) MarshalYAML() (interface{}, error)

func (*YAMLLang) String

func (yl *YAMLLang) String() string

func (*YAMLLang) UnmarshalYAML

func (yl *YAMLLang) UnmarshalYAML(unmarshal func(interface{}) error) error

type YAMLURL

type YAMLURL struct {
	*url.URL
}

func (*YAMLURL) MarshalYAML

func (yu *YAMLURL) MarshalYAML() (interface{}, error)

func (*YAMLURL) UnmarshalYAML

func (yu *YAMLURL) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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