pod

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorInvalidPath       = "cannot read or create store at given path"
	ErrorStoreDoesNotExist = "no existing store found"
)

Variables

This section is empty.

Functions

func ParseElapsed added in v0.4.0

func ParseElapsed(inSeconds int) string

func WriteStore

func WriteStore(store *Store) error

WriteStore writes to the json store

Types

type Episode

type Episode struct {
	ID        int       `json:"id"`
	Title     string    `json:"title"`
	URL       string    `json:"url"`
	Mp3       string    `json:"mp3"`
	Length    string    `json:"length"`
	Published time.Time `json:"published"`
	Played    bool      `json:"played"`
	Elapsed   int       `json:"elapsed"`
}

Episode data

func (*Episode) String

func (e *Episode) String() string

String implements the Stringer interface

type Episodes

type Episodes []*Episode

Episodes is its own type in order to implement a sort interface

func (Episodes) Len

func (e Episodes) Len() int

Implement sort interface by publish date for Episodes

func (Episodes) Less

func (e Episodes) Less(i, j int) bool

func (Episodes) Swap

func (e Episodes) Swap(i, j int)

type Feed

type Feed struct {
	Title     string           `json:"title"`
	URL       string           `json:"url"`
	RSS       string           `json:"rss"`
	Updated   time.Time        `json:"updated"`
	Episodes  Episodes         `json:"episodes"`
	Playlists map[string][]int `json:"playlists"`
}

Feed data

func FromRSS

func FromRSS(url string) (Feed, error)

FromRSS creates a new Feed obj by parsing data from an rss url

func (*Feed) Filter added in v0.8.0

func (f *Feed) Filter(e string) Episodes

Filter list by regular expression (see RE2 spec for syntax)

func (*Feed) Played

func (f *Feed) Played() int

Played episodes

func (*Feed) Playlist added in v0.9.0

func (f *Feed) Playlist(s string) Episodes

Playlist of episodes

func (*Feed) Set added in v0.8.0

func (f *Feed) Set(s string) Episodes

Set or range of episodes, a range should match a pattern like 0-100 a set should be a comma separated list (0,34,96) with no spaces

func (*Feed) String

func (f *Feed) String() string

String implements the Stringer interface

func (*Feed) Update

func (f *Feed) Update() error

Update the feed

type Feeds

type Feeds []*Feed

Feed list sortable by most reent update

func (Feeds) Len

func (f Feeds) Len() int

Implement sort interface by last update for Feeds

func (Feeds) Less

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

func (Feeds) Swap

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

type Store

type Store struct {
	Path  string
	Feeds Feeds `json:"feeds"`
}

Store is the feed collection, we load it on open and write it on changes

func ReadStore

func ReadStore(path string) (*Store, error)

ReadStore reads in the json data

func (*Store) Exists

func (store *Store) Exists(name string) bool

Exists checks for an existing version of a feed in the store

func (*Store) Update

func (store *Store) Update() error

Update the store

Jump to

Keyboard shortcuts

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