Documentation
¶
Index ¶
- type ActivityDailyCount
- type ActivityLog
- type Database
- func (d *Database) ClearOldLogs(daysToKeep int) (int64, error)
- func (d *Database) Close() error
- func (d *Database) CompleteJobRun(runID int64, finishedAt time.Time, status string, ...) error
- func (d *Database) GetActivityDailyCounts(days int) (map[string]ActivityDailyCount, error)
- func (d *Database) GetActivityDebug() (map[string]any, 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) GetRecentJobRuns(limit int, jobID string) ([]JobRun, error)
- func (d *Database) IncrementGlobalLimit(period string, mediaType string, resetAt time.Time) error
- func (d *Database) LogActivity(log ActivityLog) error
- func (d *Database) Path() string
- func (d *Database) StartJobRun(jobID, jobName, mediaType, mode string, startedAt time.Time) (int64, error)
- func (d *Database) UpdateActivityLogStatus(id int64, status, message string) error
- type GlobalLimit
- type JobRun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityDailyCount ¶ added in v1.4.0
type ActivityLog ¶
type ActivityLog struct {
ID int64 `json:"id"`
Timestamp time.Time `json:"timestamp"`
RunID int64 `json:"run_id,omitempty"`
JobID string `json:"job_id,omitempty"`
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) CompleteJobRun ¶ added in v1.4.0
func (d *Database) CompleteJobRun( runID int64, finishedAt time.Time, status string, totalFound, passedFilters, added, requested, skipped, rejected, failed int, errorMessage string, ) error
CompleteJobRun marks a job run as completed/failed with final counters.
func (*Database) GetActivityDailyCounts ¶ added in v1.4.0
func (d *Database) GetActivityDailyCounts(days int) (map[string]ActivityDailyCount, error)
GetActivityDailyCounts returns per-day activity counters for the given lookback window. The result uses calendar-day keys in YYYY-MM-DD format.
func (*Database) GetActivityDebug ¶ added in v1.4.0
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) GetRecentJobRuns ¶ added in v1.4.0
GetRecentJobRuns returns recent job runs, optionally filtered by job ID.
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
type JobRun ¶ added in v1.4.0
type JobRun struct {
ID int64 `json:"id"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
DurationMs int64 `json:"duration_ms"`
JobID string `json:"job_id,omitempty"`
JobName string `json:"job_name"`
MediaType string `json:"media_type"` // "movie" or "show"
Mode string `json:"mode"` // "direct" or "jellyseerr"
Status string `json:"status"` // "running", "completed", "failed"
TotalFound int `json:"total_found"`
PassedFilter int `json:"passed_filters"`
Added int `json:"added"`
Requested int `json:"requested"`
Skipped int `json:"skipped"`
Rejected int `json:"rejected"`
Failed int `json:"failed"`
ErrorMessage string `json:"error_message,omitempty"`
}