db

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Favorites added in v0.2.0

type Favorites map[string]bool

Favorites contains items that have been added to favorites

func (Favorites) Delete added in v0.2.0

func (f Favorites) Delete(db *bolt.DB, key string) error

Delete will remove a favorite item from the database

func (Favorites) Insert added in v0.2.0

func (f Favorites) Insert(db *bolt.DB, key string) error

Insert favorite item into database

func (Favorites) Read added in v0.2.0

func (f Favorites) Read(db *bolt.DB) error

Read will load the contents of the database into this structure

type Feed added in v0.2.0

type Feed struct {
	Title       string          `json:"title"`
	Description string          `json:"description"`
	UpdateURL   string          `json:"updateurl"`
	Link        string          `json:"link"`
	Items       map[string]bool `json:"items"`
}

Feed is the structure of the Feed from RSS that we care about. The Items contains the unique Location.

func (*Feed) Compare added in v0.2.0

func (f *Feed) Compare(i *Feed) bool

Compare will determine equality of strings

func (*Feed) FindNewItems added in v0.2.0

func (f *Feed) FindNewItems(citems map[string]*Item) (map[string]*Item, error)

FindNewItems will process the items under the feed and add return any new ones since last update

type Feeds added in v0.2.0

type Feeds map[string]*Feed

Feeds is a map of the UpdateURL to the Feed.

func (Feeds) AddItems added in v0.2.0

func (f Feeds) AddItems(db *bolt.DB, url string, items Items) error

AddItems will update the feeds map of items and unread count

func (Feeds) Delete added in v0.2.0

func (f Feeds) Delete(db *bolt.DB, url string) (map[string]bool, error)

Delete will remove a feed from the database

func (Feeds) Insert added in v0.2.0

func (f Feeds) Insert(db *bolt.DB, url string) ([]*gofeed.Item, error)

Insert feed into database by url

func (Feeds) Read added in v0.2.0

func (f Feeds) Read(db *bolt.DB) error

Read will load the contents of the database into this structure

type Item added in v0.2.0

type Item struct {
	FeedURL     string    `json:"feedurl"`
	Title       string    `json:"title"`
	Content     string    `json:"content"`
	Link        string    `json:"link"`
	Date        time.Time `json:"date"`
	Location    string    `json:"location"`
	Type        string    `json:"type"`
	Length      string    `json:"length"`
	Read        bool      `json:"read"`
	Favorite    bool      `json:"favorite"`
	PlaybackPOS int       `json:"playbackposition"`
}

Item is the structure of the Item from RSS that we care about.

func (*Item) Compare added in v0.2.0

func (q *Item) Compare(i *Item) bool

Compare will determine equality of dates

func (*Item) DeleteFile added in v0.2.0

func (q *Item) DeleteFile(path string, feeds Feeds)

DeleteFile will delete the item that has been downloaded, note if the item is favorited it will not be deleted

func (*Item) Download added in v0.2.0

func (q *Item) Download(path string, feeds Feeds) error

Download the item is it is a podcast

func (*Item) ExtPlay added in v0.2.0

func (q *Item) ExtPlay(bin string, args []string, path string, feeds Feeds) error

ExtPlay will play the item using an external program

type Items added in v0.2.0

type Items map[string]*Item

Items is a map of the Location to the Item

func (Items) Delete added in v0.2.0

func (f Items) Delete(db *bolt.DB, key string) error

Delete will remove a item from the database

func (Items) Insert added in v0.2.0

func (f Items) Insert(db *bolt.DB, item *Item) (string, error)

Insert will add the item to the database

func (Items) ProcessInsert added in v0.2.0

func (f Items) ProcessInsert(db *bolt.DB, it *gofeed.Item, url string) (string, error)

ProcessInsert will convert the feed and insert item into database

func (Items) Read added in v0.2.0

func (f Items) Read(db *bolt.DB) error

Read will load the contents of the database into this structure

func (Items) ToggleFavorite added in v0.2.0

func (f Items) ToggleFavorite(db *bolt.DB, key string) error

ToggleFavorite will update the favorite status

func (Items) ToggleRead added in v0.2.0

func (f Items) ToggleRead(db *bolt.DB, key string) error

ToggleRead will update the read status

type Queue added in v0.2.0

type Queue map[string]bool

Queue of the items to be played

func (Queue) Delete added in v0.2.0

func (f Queue) Delete(db *bolt.DB, key string) error

Delete will remove a queue item from the database

func (Queue) Insert added in v0.2.0

func (f Queue) Insert(db *bolt.DB, key string) error

Insert queue item into database

func (Queue) Read added in v0.2.0

func (f Queue) Read(db *bolt.DB) error

Read will load the contents of the database into this structure

type Storage

type Storage struct {
	Feeds     Feeds
	Items     Items
	Queue     Queue
	Favorites Favorites
	Path      string
}

Storage contains the main data needed to run the app.

func ReadDB

func ReadDB(path string) (*Storage, error)

ReadDB will grab all data from the database to use while running the app.

func (*Storage) CreateFeed

func (s *Storage) CreateFeed(url string) error

CreateFeed will collect the rss feed and process through the elements and add the relevant data elements to the database

func (*Storage) DeleteFeed

func (s *Storage) DeleteFeed(url string) error

DeleteFeed will delete the Feed, Items, and relevant items it the queue.

func (*Storage) Favorite added in v0.2.0

func (s *Storage) Favorite(key string) error

Favorite wil update the Storage to note that an item has been added to favorites.

func (*Storage) MarkRead

func (s *Storage) MarkRead(key string) (map[string]bool, error)

MarkRead wil update the Storage to note that an item has been read, remove the item from the list.

func (*Storage) MarkUnread added in v0.2.0

func (s *Storage) MarkUnread(key string) error

MarkUnread wil update the Storage to note that an item has been unread, add the item from the list.

func (*Storage) Unfavorite added in v0.2.0

func (s *Storage) Unfavorite(key string) error

Unfavorite wil update the Storage to note that an item has been removed from favorites.

func (*Storage) Update

func (s *Storage) Update() (map[string]*Item, error)

Update will check for rss updates

Jump to

Keyboard shortcuts

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