data

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubscriptionDiff

func SubscriptionDiff(subs []Subscription) (Add []string, Remove []string)

SubscriptionDiff takes in a slice of Subscription and returns a seperated string slice of podcasts that are to be added or removed. https://github.com/gpodder/mygpo/blob/e20f107009bd07e8baf226a48131fc1b1e0383ff/mygpo/subscriptions/__init__.py#L149-L167

Types

type CustomTimestamp

type CustomTimestamp struct {
	time.Time
}

CustomTimestamp is to handle ISO 8601 timestamp for unmarshalling

func (CustomTimestamp) MarshalJSON

func (c CustomTimestamp) MarshalJSON() ([]byte, error)

func (*CustomTimestamp) UnmarshalJSON

func (c *CustomTimestamp) UnmarshalJSON(b []byte) error

type DataInterface

type DataInterface interface {
	AddUser(string, string, string, string) error
	CheckUserPassword(string, string) bool
	AddSubscriptionHistory(Subscription) error
	RetrieveSubscriptionHistory(string, string, time.Time) ([]Subscription, error)
	AddEpisodeActionHistory(username string, e EpisodeAction) error
	RetrieveEpisodeActionHistory(username string, deviceId string, since time.Time) ([]EpisodeAction, error)
	//	RetrieveLoginToken(username string, password string) (string, error)
	RetrieveDevices(username string) ([]Device, error)
	AddDevice(username string, deviceName string, caption string, deviceType string) error

	RetrieveAllDeviceSubscriptions(username string) (string, error)
	RetrieveDeviceSubscriptions(username string, deviceNme string) (string, error)
}

type Device

type Device struct {
	User    *User  `json:"user"`
	Id      string `json:"id"`
	Name    string `json:"name"`
	Type    string `json:"type"`
	Caption string `json:"caption"`
}

type EpisodeAction

type EpisodeAction struct {
	Podcast   string          `json:"podcast"`
	Episode   string          `json:"episode"`
	Device    string          `json:"device"`
	Action    string          `json:"action"`
	Position  int             `json:"position"`
	Started   int             `json:"started"`
	Total     int             `json:"total"`
	Timestamp CustomTimestamp `json:"timestamp"`
}

type SQLite

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

func NewSQLite

func NewSQLite(file string) *SQLite

func (*SQLite) AddDevice

func (s *SQLite) AddDevice(username string, deviceName string, caption string, deviceType string) error

func (*SQLite) AddEpisodeActionHistory

func (l *SQLite) AddEpisodeActionHistory(username string, e EpisodeAction) error

func (*SQLite) AddSubscriptionHistory

func (s *SQLite) AddSubscriptionHistory(sub Subscription) error

func (*SQLite) AddUser

func (s *SQLite) AddUser(username, password, email, name string) error

func (*SQLite) CheckUserPassword

func (s *SQLite) CheckUserPassword(username, password string) bool

func (*SQLite) GetDeviceIdFromName

func (s *SQLite) GetDeviceIdFromName(deviceName string, username string) (int, error)

func (*SQLite) GetDevicesFromUsername

func (s *SQLite) GetDevicesFromUsername(username string) ([]string, error)

GetDevicesFromUsername returns a list of device names that belongs to username

func (*SQLite) GetUserIdFromName

func (s *SQLite) GetUserIdFromName(username string) (int, error)

func (*SQLite) RetrieveAllDeviceSubscriptions

func (s *SQLite) RetrieveAllDeviceSubscriptions(username string) (string, error)

RetrieveAllDeviceSubscriptions takes in a username and returns an OPML file of all the RSS feeds that the user was subscribed to on the platform

func (*SQLite) RetrieveDeviceSubscriptions

func (s *SQLite) RetrieveDeviceSubscriptions(username string, deviceName string) (string, error)

RetrieveDeviceSubscriptions takes in a username and devicename and returns the OPML of its subscriptions

func (*SQLite) RetrieveDevices

func (s *SQLite) RetrieveDevices(username string) ([]Device, error)

func (*SQLite) RetrieveEpisodeActionHistory

func (l *SQLite) RetrieveEpisodeActionHistory(username string, deviceId string, since time.Time) ([]EpisodeAction, error)

func (*SQLite) RetrieveSubscriptionHistory

func (s *SQLite) RetrieveSubscriptionHistory(username string, deviceName string, since time.Time) ([]Subscription, error)

type Subscription

type Subscription struct {
	User      string          `json:"user"`
	Device    string          `json:"device"`
	Podcast   string          `json:"podcast"`
	Action    string          `json:"action"`
	Timestamp CustomTimestamp `json:"timestamp"`
}

type User

type User struct {
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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