command

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2017 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const Name string = "feedTube"

Name is the name of this program

View Source
const Version string = "0.3.1"

Version is the current version

Variables

View Source
var Commands = []cli.Command{
	{
		Name:         "channel",
		Aliases:      []string{"c"},
		Usage:        "Builds your rss file from a youtube channel",
		Action:       CmdChannel(runner.Real{}),
		BashComplete: Completion,
		Flags: append(
			flags,
			cli.StringFlag{
				Name:  "after, a",
				Usage: "Only process videos after a given date",
			},
		),
	},
	{
		Name:         "playlist",
		Aliases:      []string{"p"},
		Usage:        "Builds your rss file from a youtube playlist",
		Action:       CmdPlaylist(runner.Real{}),
		BashComplete: Completion,
		Flags:        flags,
	},
}

Commands defines the commands that can be called on hostBuilder

View Source
var YoutubeAPIURLBase = "https://www.googleapis.com/youtube/v3/"

YoutubeAPIURLBase is the base url to use for the youtube API. This should only be changed for tests.

Functions

func Build added in v0.3.1

func Build(c *cli.Context, cmdBuilder runner.Builder, items []*VideoData, info *ChannelInfo) error

Build downloads the videos and builds the feed XML

func CmdChannel

func CmdChannel(cmdBuilder runner.Builder) func(c *cli.Context) error

CmdChannel builds an rss feed from a youtube channel

func CmdPlaylist

func CmdPlaylist(cmdBuilder runner.Builder) func(c *cli.Context) error

CmdPlaylist builds an rss feed from a youtube playlist

func Completion

func Completion(c *cli.Context)

Completion handles bash completion for the commands

func ContainsString added in v0.3.1

func ContainsString(needle string, haystack []string) bool

ContainsString searches a string slice to see if it contains a given string

func RootCompletion added in v0.3.1

func RootCompletion(c *cli.Context)

RootCompletion prints the list of root commands as the root completion method This is similar to the default method, but it excludes aliases

Types

type ChannelInfo added in v0.3.1

type ChannelInfo struct {
	Title       string
	Description string
	Link        string
	Thumbnail   string
}

ChannelInfo contains the metadata for a channel

type ChannelScraper added in v0.3.1

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

ChannelScraper retrieves data about youtube videos

func NewChannelScraper added in v0.3.1

func NewChannelScraper(apiKey string) *ChannelScraper

NewChannelScraper returns a YoutubeScraper

func (ChannelScraper) GetVideosForChannel added in v0.3.1

func (scraper ChannelScraper) GetVideosForChannel(channelName, after string) ([]*VideoData, *ChannelInfo, error)

GetVideosForChannel returns an array of all the youtube video ids on a channel

type DirectoryCleaner added in v0.3.1

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

DirectoryCleaner cleans up unrelated files

func NewDirectoryCleaner added in v0.3.1

func NewDirectoryCleaner(outputFolder string) *DirectoryCleaner

NewDirectoryCleaner returns a new directoryCleaner

func (DirectoryCleaner) CleanupUnrelatedFiles added in v0.3.1

func (cleaner DirectoryCleaner) CleanupUnrelatedFiles(relatedFiles []string, writer io.Writer) error

CleanupUnrelatedFiles searches the outputFolder for files that are not in relatedFiles and deletes them

type Downloader added in v0.3.1

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

Downloader downloads youtube videos

func NewDownloader added in v0.3.1

func NewDownloader(cmdBuilder runner.Builder, outputFolder string, quality string) *Downloader

NewDownloader returns a new Downloader

func (Downloader) DownloadVideos added in v0.3.1

func (downloader Downloader) DownloadVideos(items []*VideoData) error

DownloadVideos downloads any items that are not already in outputfolder

type PlaylistScraper added in v0.3.1

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

PlaylistScraper retrieves data about youtube videos

func NewPlaylistScraper added in v0.3.1

func NewPlaylistScraper(apiKey string) *PlaylistScraper

NewPlaylistScraper returns a YoutubeScraper

func (PlaylistScraper) GetVideosForPlaylist added in v0.3.1

func (scraper PlaylistScraper) GetVideosForPlaylist(playlistID string) ([]*VideoData, *ChannelInfo, error)

GetVideosForPlaylist returns an array of all the youtube video ids in a playlist

type VideoData added in v0.3.1

type VideoData struct {
	GUID        string
	Link        string
	Title       string
	Description string
	FileName    string
	Image       string
	PubDate     time.Time
}

VideoData holds all the data that we scrape from YouTube

type XMLBuilder added in v0.3.1

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

XMLBuilder handles building RSS XML

func NewXMLBuilder added in v0.3.1

func NewXMLBuilder(cmdBuilder runner.Builder, xmlFileName, outputFolder, baseURL, generator string, channelInfo *ChannelInfo) *XMLBuilder

NewXMLBuilder returns a new XMLBuilder

func (XMLBuilder) BuildRss added in v0.3.1

func (xmlBuilder XMLBuilder) BuildRss(items []*VideoData) error

BuildRss builds an RSS XML feed from an list of VideoData

Jump to

Keyboard shortcuts

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