Documentation
¶
Index ¶
- type ActivityLog
- type Database
- func (d *Database) ClearOldLogs(daysToKeep int) (int64, error)
- func (d *Database) Close() error
- func (d *Database) GetActivityLogByID(id int64) (*ActivityLog, error)
- func (d *Database) GetActivityStats() (map[string]any, error)
- func (d *Database) GetCurrentGlobalCount(period string, mediaType string) (int, error)
- func (d *Database) GetGlobalLimit(period string, mediaType string) (*GlobalLimit, error)
- func (d *Database) GetRecentActivity(limit int) ([]ActivityLog, error)
- func (d *Database) GetRecentActivityFiltered(limit int, status, mediaType, jobType string) ([]ActivityLog, error)
- func (d *Database) IncrementGlobalLimit(period string, mediaType string, resetAt time.Time) error
- func (d *Database) LogActivity(log ActivityLog) error
- func (d *Database) UpdateActivityLogStatus(id int64, status, message string) error
- type GlobalLimit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityLog ¶
type ActivityLog struct {
ID int64 `json:"id"`
Timestamp time.Time `json:"timestamp"`
JobType string `json:"job_type"`
MediaType string `json:"media_type"` // "movie" or "show"
Title string `json:"title"`
Year int `json:"year"`
TMDBID int `json:"tmdb_id,omitempty"`
TVDBID int `json:"tvdb_id,omitempty"`
IMDBID string `json:"imdb_id,omitempty"`
PosterURL string `json:"poster_url,omitempty"`
Score float64 `json:"score,omitempty"` // Content score (0-1)
Rank int `json:"rank,omitempty"` // Rank among all items
Status string `json:"status"` // "added", "failed", "skipped"
Message string `json:"message,omitempty"`
FilterDetails string `json:"filter_details,omitempty"` // JSON array of filter checks
}
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) ClearOldLogs ¶
ClearOldLogs removes logs older than the specified number of days
func (*Database) GetActivityLogByID ¶ added in v1.1.0
func (d *Database) GetActivityLogByID(id int64) (*ActivityLog, error)
GetActivityLogByID retrieves a single activity log entry by ID
func (*Database) GetActivityStats ¶
GetActivityStats returns statistics about activity
func (*Database) GetCurrentGlobalCount ¶ added in v1.0.0
GetCurrentGlobalCount returns the current count for a period and media type Returns 0 if no record exists or if the record has expired
func (*Database) GetGlobalLimit ¶ added in v1.0.0
func (d *Database) GetGlobalLimit(period string, mediaType string) (*GlobalLimit, error)
GetGlobalLimit retrieves the current limit record for a period and media type
func (*Database) GetRecentActivity ¶
func (d *Database) GetRecentActivity(limit int) ([]ActivityLog, error)
GetRecentActivity retrieves recent activity logs
func (*Database) GetRecentActivityFiltered ¶ added in v1.0.0
func (d *Database) GetRecentActivityFiltered(limit int, status, mediaType, jobType string) ([]ActivityLog, error)
GetRecentActivityFiltered retrieves recent activity logs with optional filters
func (*Database) IncrementGlobalLimit ¶ added in v1.0.0
IncrementGlobalLimit increments the count for a period and media type Creates a new record if one doesn't exist or if the current one has expired
func (*Database) LogActivity ¶
func (d *Database) LogActivity(log ActivityLog) error
LogActivity adds a new activity log entry
type GlobalLimit ¶ added in v1.0.0
type GlobalLimit struct {
ID int64 `json:"id"`
Period string `json:"period"` // sync, daily, weekly, monthly
MediaType string `json:"media_type"` // movie, show
Count int `json:"count"`
ResetAt time.Time `json:"reset_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
GlobalLimit represents a limit tracking record