Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
ID string
ServerURL string
Username string
Token string
IsDefault bool
CreatedAt time.Time
}
Account represents a stored Audiobookshelf server account.
type ListeningSession ¶
type ListeningSession struct {
ItemID string
EpisodeID string
SessionID string
CurrentTime float64
Duration float64
CreatedAt time.Time
}
ListeningSession represents the last active playback state for crash recovery.
type Store ¶
Store wraps the SQLite database connection.
func (*Store) ClearSession ¶
ClearSession removes all saved listening sessions.
func (*Store) GetDefaultAccount ¶
GetDefaultAccount returns the account marked as default. Returns an error if no default account is set.
func (*Store) GetLastSession ¶
func (s *Store) GetLastSession() (ListeningSession, error)
GetLastSession retrieves the last saved playback session. Returns an error if no session has been saved.
func (*Store) SaveAccount ¶
SaveAccount inserts or updates an account. If it's the first account, it becomes the default automatically. When the saved account is (or becomes) the default, any other accounts are unset as default atomically within a transaction so that only one default can exist at a time.
func (*Store) SaveListeningSession ¶
func (s *Store) SaveListeningSession(session ListeningSession) error
SaveListeningSession stores the current playback state. Only one session is kept at a time (the most recent), enabling crash recovery.