Documentation ¶
Index ¶
- func SubscriptionDiff(subs []Subscription) (Add []string, Remove []string)
- type CustomTimestamp
- type DataInterface
- type Device
- type EpisodeAction
- type SQLite
- func (s *SQLite) AddDevice(username string, deviceName string, caption string, deviceType string) (int, error)
- func (l *SQLite) AddEpisodeActionHistory(username string, e EpisodeAction) error
- func (s *SQLite) AddSubscriptionHistory(sub Subscription) error
- func (s *SQLite) AddSyncGroup(device_names []string, username string) error
- func (s *SQLite) AddUser(username, password, email, name string) error
- func (s *SQLite) CheckUserPassword(username, password string) bool
- func (s *SQLite) GetDB() *sql.DB
- func (s *SQLite) GetDeviceIdFromName(deviceName string, username string) (int, error)
- func (s *SQLite) GetDeviceNameFromDeviceSyncGroupId(id int) ([]string, error)
- func (s *SQLite) GetDeviceSyncGroupIds(username string) ([]int, error)
- func (s *SQLite) GetDevicesFromUsername(username string) ([]string, error)
- func (s *SQLite) GetDevicesInSyncGroupFromDeviceId(deviceId int) ([]int, error)
- func (s *SQLite) GetNotSyncedDevices(username string) ([]string, error)
- func (s *SQLite) GetUserIdFromName(username string) (int, error)
- func (s *SQLite) RetrieveAllDeviceSubscriptions(username string) (string, error)
- func (s *SQLite) RetrieveDeviceSubscriptions(username string, deviceName string) (string, error)
- func (s *SQLite) RetrieveDevices(username string) ([]Device, error)
- func (l *SQLite) RetrieveEpisodeActionHistory(username string, deviceId string, since time.Time) ([]EpisodeAction, error)
- func (s *SQLite) RetrieveSubscriptionHistory(username string, deviceName string, since time.Time) ([]Subscription, error)
- func (s *SQLite) StopDeviceSync(deviceName string, username string) error
- func (s *SQLite) UpdateOrCreateDevice(username string, deviceName string, caption string, deviceType string) (int, error)
- type Subscription
- type User
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 separated 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 ¶
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) // Devices RetrieveDevices(username string) ([]Device, error) AddDevice(username string, deviceName string, caption string, deviceType string) (int, error) UpdateOrCreateDevice(username string, deviceName string, caption string, deviceType string) (int, error) RetrieveAllDeviceSubscriptions(username string) (string, error) RetrieveDeviceSubscriptions(username string, deviceNme string) (string, error) GetDeviceIdFromName(deviceName string, username string) (int, error) // sync AddSyncGroup(deviceIds []string, username string) error StopDeviceSync(deviceName string, username string) error GetDeviceSyncGroupIds(username string) ([]int, error) GetDevicesInSyncGroupFromDeviceId(deviceId int) ([]int, error) GetDeviceNameFromDeviceSyncGroupId(deviceId int) ([]string, error) GetNotSyncedDevices(username string) ([]string, error) }
type EpisodeAction ¶
type EpisodeAction struct { Podcast string `json:"podcast"` Episode string `json:"episode"` Device string `json:"device"` Devices []int `json:"devices"` 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 (*SQLite) AddDevice ¶
func (s *SQLite) AddDevice(username string, deviceName string, caption string, deviceType string) (int, error)
AddDevice creates a new Device and returns the id of the device and any error
func (*SQLite) AddEpisodeActionHistory ¶
func (l *SQLite) AddEpisodeActionHistory(username string, e EpisodeAction) error
func (*SQLite) AddSubscriptionHistory ¶
func (s *SQLite) AddSubscriptionHistory(sub Subscription) error
AddSubscriptionHistory adds and updates subscription
func (*SQLite) AddSyncGroup ¶ added in v0.2.0
AddSyncGroup takes in a slice of device_ids and add them to a SyncGroup if they do not exist. Returns error if it already existed.
Each device can only have one sync group at a time. Sync group's purpose is to link devices together so that any new podcast subscriptions will always be setup and installed on each device
func (*SQLite) CheckUserPassword ¶
func (*SQLite) GetDeviceIdFromName ¶
func (*SQLite) GetDeviceNameFromDeviceSyncGroupId ¶ added in v0.2.0
GetDeviceNameFromDeviceSyncGroupId takes in a device_sync_group_id and returns a string slice of device names that belongs to the group
func (*SQLite) GetDeviceSyncGroupIds ¶ added in v0.2.0
GetDeviceSyncGroupIds takes in a username and returns a SyncStatus and error
func (*SQLite) GetDevicesFromUsername ¶
GetDevicesFromUsername returns a list of device names that belongs to username
func (*SQLite) GetDevicesInSyncGroupFromDeviceId ¶ added in v0.2.0
GetDevicesInSyncGroupFromDeviceId takes in a deviceId and returns a list of deviceIds that belongs to the same syncgroup including itself
func (*SQLite) GetNotSyncedDevices ¶ added in v0.2.0
func (*SQLite) RetrieveAllDeviceSubscriptions ¶
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 ¶
RetrieveDeviceSubscriptions takes in a username and devicename and returns the OPML of its subscriptions
func (*SQLite) RetrieveDevices ¶
func (*SQLite) RetrieveEpisodeActionHistory ¶
func (*SQLite) RetrieveSubscriptionHistory ¶
func (*SQLite) StopDeviceSync ¶ added in v0.2.0
StopDeviceSync takes in a device name and username to stop device sync