Documentation ¶
Index ¶
- func CreateChannelPage(channel *Channel, projectRoot string) error
- func CreateChannelVideoFolder(channel *Channel, projectRoot string) error
- func GetCreatorVideos(slug string, projectRoot string) ([]string, error)
- func SaveChannel(channel *Channel, dataDir string) error
- func SaveChannels(channelList ChannelList, dataDir string) bool
- type Channel
- type ChannelList
- type ChannelPage
- type Provider
- type URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateChannelPage ¶
CreateChannelPage takes the permalink for the channel and creates a .md file in the content directory.
func CreateChannelVideoFolder ¶
CreateChannelVideoFolder creates an empty folder within the videos data folder
func GetCreatorVideos ¶
GetCreatorVideos returns a list of video IDs for a given creator
func SaveChannel ¶
SaveChannel saves an individual channel, overwriting the channel file if it already exists
func SaveChannels ¶
func SaveChannels(channelList ChannelList, dataDir string) bool
SaveChannels saves all the channel definitions back to disk
Types ¶
type Channel ¶
type Channel struct { Name string Slug string Permalink string Providers map[string]Provider Tags []interface{} // contains filtered or unexported fields }
Channel represents a YouTube channel and it's associated providers
func (*Channel) GetChannelPage ¶
func (c *Channel) GetChannelPage(projectRoot string) *ChannelPage
GetChannelPage returns the ChannelPage for the specifid channel
func (Channel) MarshalYAML ¶
MarshalYAML handles the well defined channel details as well as any other fields specified
func (*Channel) UnmarshalYAML ¶
UnmarshalYAML handles the well defined channel details as well as any other fields specified
func (Channel) YouTubeURL ¶
YouTubeURL fetches the URL if this channel has the encoded provider URL and falls back to the top level channel URL if it's not found.
type ChannelList ¶
ChannelList is a collection of channels
func LoadChannels ¶
func LoadChannels(dataDir string) ChannelList
LoadChannels reads all the channel definitions off disk
func (ChannelList) Contains ¶
func (channelList ChannelList) Contains(slug string) bool
Contains returns true if the supplied URL matches any provider's URL
type ChannelPage ¶
type ChannelPage struct { Aliases []string `yaml:",omitempty"` Title string TypeString string `yaml:"type"` // type is reserved Channel string Tags []string Url string Videos []string `yaml:",omitempty"` Menu struct { Main struct { Parent string } } }
ChannelPage represents all the fields required to create a channel specific page.
type URL ¶
URL is a newtype wrapper for url.URL which adds handling for yaml
func MustParseURL ¶
MustParseURL is designed for parsing valid URLs, known to be valid at compile time
func (URL) MarshalYAML ¶
MarshalYAML converts a URL to a literal string (instead of the GO default of breaking it up into its components)
func (*URL) UnmarshalYAML ¶
UnmarshalYAML converts a string to a URL