pod

package
v0.0.0-...-3feca8e Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReservedPodName = "all"
)

Variables

View Source
var (
	ErrPodExists    = errors.New("podcast by that name already exists")
	ErrNoEntry      = errors.New("no podcast is managed by that name")
	ErrReservedName = errors.New("the name " + ReservedPodName + " is reserved by gopodgrab")
	ErrArchiveEmpty = errors.New("feed file zip archive empty")
)

Functions

This section is empty.

Types

type Episode

type Episode struct {
	XMLName  xml.Name `xml:"item"`
	Title    string   `xml:"title"`
	PubDate  *podTime `xml:"pubDate"`
	File     *podFile `xml:"enclosure"`
	Duration int      `xml:"duration"`
	Bytes    int64    `xml:"-"`
}

func (*Episode) String

func (e *Episode) String() string

type Podcast

type Podcast struct {
	FeedURL    string `json:"feed_url"`    // URL to retrieve the podcast feed from
	Name       string `json:"name"`        // The name under which this podcast is managed
	LocalStore string `json:"local_store"` // Directory path of the local store for this podcast
}

Podcast represents a podcast. It has a feed URL, name and additional metadata.

func Get

func Get(name string) (*Podcast, error)

Get returns a specific podcast from the configuration by name. If the podcast is not found by name, or the configuration file cannot be read, then an error is returned.

func List

func List() ([]*Podcast, error)

List returns the list of managed podcasts from the configuration file. Failure to read the configuration file results in a error.

func New

func New(name, feedURL, storageDir string) (*Podcast, error)

New creates a new podcast and intializes the local storage for it. If creation of the local storage fails, or a podcast by that name is already managed by gopodgrab, an error is returned.

func (*Podcast) DownloadEpisodes

func (pod *Podcast) DownloadEpisodes(eps []*Episode) error

DownloadEpisodes retrieves all episodes and stores them in the local storage. For each retrieved episode the size in bytes is recorded in Episode.Bytes.

func (*Podcast) FeedFile

func (pod *Podcast) FeedFile() string

FeedFile returns the full file path of the locally stored, zipped feed.

func (*Podcast) NewEpisodes

func (pod *Podcast) NewEpisodes() ([]*Episode, error)

NewEpisodes reads the feed and compares the list of episodes in the feed against the one already in the local storage. It returns the difference feed - storage.

func (*Podcast) RefreshFeed

func (pod *Podcast) RefreshFeed() error

RefreshFeed updates the locally stored feed from remote.

Jump to

Keyboard shortcuts

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