database

package
v1.3.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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 New

func New(dataDir string) (*Database, error)

func (*Database) ClearOldLogs

func (d *Database) ClearOldLogs(daysToKeep int) (int64, error)

ClearOldLogs removes logs older than the specified number of days

func (*Database) Close

func (d *Database) Close() error

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

func (d *Database) GetActivityStats() (map[string]interface{}, error)

GetActivityStats returns statistics about activity

func (*Database) GetCurrentGlobalCount added in v1.0.0

func (d *Database) GetCurrentGlobalCount(period string, mediaType string) (int, error)

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

func (d *Database) IncrementGlobalLimit(period string, mediaType string, resetAt time.Time) error

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

func (*Database) UpdateActivityLogStatus added in v1.1.0

func (d *Database) UpdateActivityLogStatus(id int64, status, message string) error

UpdateActivityLogStatus updates the status and message of an 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

Jump to

Keyboard shortcuts

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